Skip to content
Snippets Groups Projects
Commit 2aefbd74 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Tutorial is now opened as dummy element in navigator.

refs 2567
parent 779cfc1d
No related branches found
No related tags found
No related merge requests found
...@@ -150,5 +150,14 @@ ...@@ -150,5 +150,14 @@
provider="org.fortiss.tooling.kernel.ui.internal.ConstraintVerificationUIService"> provider="org.fortiss.tooling.kernel.ui.internal.ConstraintVerificationUIService">
</storagePostLoadProvider> </storagePostLoadProvider>
</extension> </extension>
<extension
point="org.fortiss.tooling.kernel.ui.modelElementHandler">
<modelElementHandler
handler="org.fortiss.tooling.kernel.ui.internal.handler.TutorialDefinitionHandler">
<modelElementClass
modelElementClass="org.fortiss.tooling.kernel.model.tutorial.TutorialDefinition">
</modelElementClass>
</modelElementHandler>
</extension>
</plugin> </plugin>
/*--------------------------------------------------------------------------+
$Id: DataDictionaryHandler.java 11307 2014-08-04 13:32:46Z teufl $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.internal.handler;
import static org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator.getImageDescriptor;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.tooling.kernel.model.tutorial.TutorialDefinition;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
/**
* {@link IModelElementHandler} for {@link TutorialDefinition}.
*
* @author eder
* @author $Author: teufl $
* @version $Rev: 11307 $
* @ConQAT.Rating GREEN Hash: FCF4A8026124D391128E28129C698161
*/
public final class TutorialDefinitionHandler extends ModelElementHandlerBase<TutorialDefinition> {
/** Navigator view height. */
private static final int NAVIGATOR_VIEW_HEIGHT = 0;
/** {@inheritDoc} */
@Override
public String getName(TutorialDefinition element) {
return element.getName();
}
/** {@inheritDoc} */
@Override
public String getDescription(TutorialDefinition element) {
return element.getComment();
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return getImageDescriptor("icons/tutorial.gif");
}
/** {@inheritDoc} */
@Override
public int getNavigatorViewWeight(TutorialDefinition element) {
return NAVIGATOR_VIEW_HEIGHT;
}
/** {@inheritDoc} */
@Override
public List<EObject> getSubnodes(TutorialDefinition element) {
return Collections.emptyList();
}
}
...@@ -17,9 +17,8 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ ...@@ -17,9 +17,8 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.extension; package org.fortiss.tooling.kernel.extension;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.data.TutorialStep; import org.fortiss.tooling.kernel.extension.data.TutorialStep;
import org.fortiss.tooling.kernel.model.tutorial.TutorialDefinition;
/** /**
* A tutorial provider provides all data about a single tutorial to the kernel infrastructure. * A tutorial provider provides all data about a single tutorial to the kernel infrastructure.
...@@ -30,11 +29,11 @@ import org.fortiss.tooling.kernel.model.tutorial.TutorialDefinition; ...@@ -30,11 +29,11 @@ import org.fortiss.tooling.kernel.model.tutorial.TutorialDefinition;
* @ConQAT.Rating RED Hash: * @ConQAT.Rating RED Hash:
*/ */
public interface ITutorialProvider { public interface ITutorialProvider {
/** Returns the top-level element of this tutorial. */ /** Returns the description of the tutorial. */
public ITopLevelElement getTopLevelElement(); public String getDescription();
/** Returns the tutorial definition element. */ /** Returns the root element of this tutorial. */
public TutorialDefinition getTutorialDefinition(); public EObject getRootElement();
/** Returns the initial step of this tutorial. */ /** Returns the initial step of this tutorial. */
public TutorialStep getInitialStep(); public TutorialStep getInitialStep();
......
...@@ -129,6 +129,9 @@ final class DummyTopLevelElement implements ITopLevelElement { ...@@ -129,6 +129,9 @@ final class DummyTopLevelElement implements ITopLevelElement {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public String getId(EObject modelElement) { public String getId(EObject modelElement) {
if(modelElement instanceof IIdLabeled) {
return String.valueOf(((IIdLabeled)modelElement).getId());
}
return null; return null;
} }
......
...@@ -279,6 +279,7 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe ...@@ -279,6 +279,7 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe
DummyTopLevelElement dummy = new DummyTopLevelElement(dummyRoot); DummyTopLevelElement dummy = new DummyTopLevelElement(dummyRoot);
dummyCache.put(dummyRoot, dummy); dummyCache.put(dummyRoot, dummy);
elementCache.add(dummy); elementCache.add(dummy);
notifyListenersAboutAdd(dummy);
return dummy; return dummy;
} }
...@@ -288,8 +289,10 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe ...@@ -288,8 +289,10 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe
if(dummyCache == null || !dummyCache.containsKey(dummy)) { if(dummyCache == null || !dummyCache.containsKey(dummy)) {
return; return;
} }
elementCache.remove(dummyCache.get(dummy)); ITopLevelElement top = dummyCache.get(dummy);
elementCache.remove(top);
dummyCache.remove(dummy); dummyCache.remove(dummy);
notifyListenersAboutRemove(top);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
......
...@@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject; ...@@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.ITutorialProvider; import org.fortiss.tooling.kernel.extension.ITutorialProvider;
import org.fortiss.tooling.kernel.extension.ITutorialWhitelistProvider; import org.fortiss.tooling.kernel.extension.ITutorialWhitelistProvider;
import org.fortiss.tooling.kernel.extension.data.TutorialStep; import org.fortiss.tooling.kernel.extension.data.TutorialStep;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.service.ITutorialService; import org.fortiss.tooling.kernel.service.ITutorialService;
/** /**
...@@ -83,6 +84,10 @@ public final class TutorialService implements ITutorialService, ITutorialWhiteli ...@@ -83,6 +84,10 @@ public final class TutorialService implements ITutorialService, ITutorialWhiteli
public void startTutorial(ITutorialProvider provider) { public void startTutorial(ITutorialProvider provider) {
activeTutorial = provider; activeTutorial = provider;
activeStep = activeTutorial.getInitialStep(); activeStep = activeTutorial.getInitialStep();
IPersistencyService.INSTANCE.addDummyEObjectAsTopLevelElement(activeTutorial
.getRootElement());
System.out.println("start tutorial for provider: " + activeTutorial.getClass().getName());
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment