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

KISS implementation for the tutorial services.

refs 2582
parent 595677f8
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ package org.fortiss.tooling.kernel.ui.internal;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
......@@ -29,6 +30,10 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.fortiss.tooling.kernel.extension.ITutorialProvider;
import org.fortiss.tooling.kernel.extension.data.TutorialStepBase;
import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService;
import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService;
import org.fortiss.tooling.kernel.service.ITutorialService;
import org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator;
import org.fortiss.tooling.kernel.ui.extension.ITutorialStepUI;
......@@ -46,7 +51,8 @@ import org.fortiss.tooling.kernel.ui.service.ITutorialUIService;
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public final class TutorialUIService implements ITutorialUIService, ITutorialUIWhitelistProvider {
public final class TutorialUIService implements ITutorialUIService, ITutorialUIWhitelistProvider,
IIntrospectiveKernelService {
/** The map from tutorial providers to their UI counter-part. */
private final Map<Class<? extends ITutorialProvider>, Class<? extends ITutorialUIProvider>> providerMap =
......@@ -62,7 +68,22 @@ public final class TutorialUIService implements ITutorialUIService, ITutorialUIW
/** Starts the service. */
public void startService() {
// nothing to do here
KernelIntrospectionSystemService.getInstance().registerService(this);
}
/** {@inheritDoc} */
@Override
public String getIntrospectionLabel() {
return "Tutorial UI Service";
}
/** {@inheritDoc} */
@Override
public String getIntrospectionDescription() {
return getIntrospectionLabel() +
"\n\nThis service manages the user interface part of the tutorial service." +
"\nIt provides information about elements visible in the navigator, whether the default" +
"\nactions are enabled, and which context menu entries are visible.";
}
/** {@inheritDoc} */
......@@ -178,4 +199,22 @@ public final class TutorialUIService implements ITutorialUIService, ITutorialUIW
error(ToolingKernelUIActivator.getDefault(), pex.getMessage(), pex);
}
}
/** {@inheritDoc} */
@Override
public boolean showInIntrospectionNavigation() {
return true;
}
/** {@inheritDoc} */
@Override
public Collection<IIntrospectionItem> getIntrospectionItems() {
return null;
}
/** {@inheritDoc} */
@Override
public IIntrospectionDetailsItem getDetailsItem() {
return null;
}
}
......@@ -39,6 +39,10 @@ import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.extension.data.TutorialAtomicStep;
import org.fortiss.tooling.kernel.extension.data.TutorialCompositeStep;
import org.fortiss.tooling.kernel.extension.data.TutorialStepBase;
import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService;
import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.service.ITutorialService;
......@@ -52,7 +56,8 @@ import org.fortiss.tooling.kernel.service.listener.ITutorialServiceListener;
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public final class TutorialService implements ITutorialService, CommandStackListener {
public final class TutorialService implements ITutorialService, CommandStackListener,
IIntrospectiveKernelService {
/** The collection of all defined tutorials. */
private Map<String, Map<String, Class<? extends ITutorialProvider>>> allTutorials =
new HashMap<>();
......@@ -78,7 +83,24 @@ public final class TutorialService implements ITutorialService, CommandStackList
/** Starts the service. */
public void startService() {
// FIXME (FH): KernelIntrospectionSystemService.getInstance().registerService(this);
KernelIntrospectionSystemService.getInstance().registerService(this);
}
/** {@inheritDoc} */
@Override
public String getIntrospectionLabel() {
return "Tutorial Service";
}
/** {@inheritDoc} */
@Override
public String getIntrospectionDescription() {
return getIntrospectionLabel() +
"\n\nThis service manages tutorials, which can be registered via it." +
"\nThis service can be asked to start and to stop tutorials. It also provides information " +
"\nabout the currently active tutorial and the current tutorial step." +
"\nIt notifies interested listeners about progress and changes to the current step." +
"\nThis service provides access to prototypes constrained by the current step.";
}
/** {@inheritDoc} */
......@@ -141,7 +163,8 @@ public final class TutorialService implements ITutorialService, CommandStackList
activeStep = atomicStepList.get(0);
finalAtomicStep = atomicStepList.get(atomicStepList.size() - 1);
EObject root = activeTutorial.getRootElement();
activeTopElement = IPersistencyService.getInstance().addDummyEObjectAsTopLevelElement(root);
activeTopElement =
IPersistencyService.getInstance().addDummyEObjectAsTopLevelElement(root);
ICommandStackService.getInstance().addCommandStackListener(activeTopElement, this);
fireTutorialStarted();
} catch(InstantiationException e) {
......@@ -168,7 +191,8 @@ public final class TutorialService implements ITutorialService, CommandStackList
public void stopTutorial() {
fireTutorialStopped();
ICommandStackService.getInstance().removeCommandStackListener(activeTopElement, this);
IPersistencyService.getInstance().removeDummyTopLevelElement(activeTutorial.getRootElement());
IPersistencyService.getInstance().removeDummyTopLevelElement(
activeTutorial.getRootElement());
activeTopElement = null;
atomicStepList.clear();
activeStep = null;
......@@ -279,4 +303,22 @@ public final class TutorialService implements ITutorialService, CommandStackList
l.tutorialStopped(activeTutorial);
}
}
/** {@inheritDoc} */
@Override
public boolean showInIntrospectionNavigation() {
return true;
}
/** {@inheritDoc} */
@Override
public Collection<IIntrospectionItem> getIntrospectionItems() {
return null;
}
/** {@inheritDoc} */
@Override
public IIntrospectionDetailsItem getDetailsItem() {
return null;
}
}
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