diff --git a/org.fortiss.tooling.kernel.ui/trunk/plugin.xml b/org.fortiss.tooling.kernel.ui/trunk/plugin.xml index 5e4aaeb1791a37058f52e0747ddbc3a7c6a474d0..d461fe82fe7b37ace215e1e3ce65f31b2e8750dd 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/plugin.xml +++ b/org.fortiss.tooling.kernel.ui/trunk/plugin.xml @@ -150,5 +150,14 @@ provider="org.fortiss.tooling.kernel.ui.internal.ConstraintVerificationUIService"> </storagePostLoadProvider> </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> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/handler/TutorialDefinitionHandler.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/handler/TutorialDefinitionHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..5933408aebb69fb008f000258b4e48c897ef1d94 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/handler/TutorialDefinitionHandler.java @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------+ +$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(); + } +} diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ITutorialProvider.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ITutorialProvider.java index a42a761ef6e8facaeb2940f3b7bd0300d4765684..f04beac90eb7f68989e9d82347b477d9a167f38d 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ITutorialProvider.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ITutorialProvider.java @@ -17,9 +17,8 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +--------------------------------------------------------------------------*/ 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.model.tutorial.TutorialDefinition; /** * 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; * @ConQAT.Rating RED Hash: */ public interface ITutorialProvider { - /** Returns the top-level element of this tutorial. */ - public ITopLevelElement getTopLevelElement(); + /** Returns the description of the tutorial. */ + public String getDescription(); - /** Returns the tutorial definition element. */ - public TutorialDefinition getTutorialDefinition(); + /** Returns the root element of this tutorial. */ + public EObject getRootElement(); /** Returns the initial step of this tutorial. */ public TutorialStep getInitialStep(); diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/DummyTopLevelElement.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/DummyTopLevelElement.java index 5d345d24d34985db30ce30bbf2f9f907371d9515..d142bcc9f5c9514f9a7904fd6b8656e542a38d01 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/DummyTopLevelElement.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/DummyTopLevelElement.java @@ -129,6 +129,9 @@ final class DummyTopLevelElement implements ITopLevelElement { /** {@inheritDoc} */ @Override public String getId(EObject modelElement) { + if(modelElement instanceof IIdLabeled) { + return String.valueOf(((IIdLabeled)modelElement).getId()); + } return null; } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java index 8d30706a2c46b9b9215263912ed69abd9475cc54..212f776b0dfbc2ed5b8add92594af6ea758b9b31 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java @@ -279,6 +279,7 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe DummyTopLevelElement dummy = new DummyTopLevelElement(dummyRoot); dummyCache.put(dummyRoot, dummy); elementCache.add(dummy); + notifyListenersAboutAdd(dummy); return dummy; } @@ -288,8 +289,10 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe if(dummyCache == null || !dummyCache.containsKey(dummy)) { return; } - elementCache.remove(dummyCache.get(dummy)); + ITopLevelElement top = dummyCache.get(dummy); + elementCache.remove(top); dummyCache.remove(dummy); + notifyListenersAboutRemove(top); } /** {@inheritDoc} */ diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/TutorialService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/TutorialService.java index 8bf675b250ad6f3fa8ede7b248948a50adfa7a51..65f6b599f1fb0327bb84f193c619ecdc4bd857d0 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/TutorialService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/TutorialService.java @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.extension.ITutorialProvider; import org.fortiss.tooling.kernel.extension.ITutorialWhitelistProvider; import org.fortiss.tooling.kernel.extension.data.TutorialStep; +import org.fortiss.tooling.kernel.service.IPersistencyService; import org.fortiss.tooling.kernel.service.ITutorialService; /** @@ -83,6 +84,10 @@ public final class TutorialService implements ITutorialService, ITutorialWhiteli public void startTutorial(ITutorialProvider provider) { activeTutorial = provider; activeStep = activeTutorial.getInitialStep(); + + IPersistencyService.INSTANCE.addDummyEObjectAsTopLevelElement(activeTutorial + .getRootElement()); + System.out.println("start tutorial for provider: " + activeTutorial.getClass().getName()); } /** {@inheritDoc} */