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

First version of hierarchical tutorial steps.

refs 2581
parent ddbd0010
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import org.conqat.ide.commons.ui.jface.TreeContentProviderBase;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.extension.data.TutorialDefinition;
import org.fortiss.tooling.kernel.extension.data.TutorialStepComposite;
import org.fortiss.tooling.kernel.model.ILibrary;
import org.fortiss.tooling.kernel.model.ILibraryElementReference;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......@@ -90,6 +91,9 @@ public class NavigatorTreeContentProvider extends TreeContentProviderBase {
if(parent instanceof TutorialDefinition) {
return ((TutorialDefinition)parent).getSteps().toArray();
}
if(parent instanceof TutorialStepComposite) {
return ((TutorialStepComposite)parent).getSteps().toArray();
}
return new Object[0];
}
......
......@@ -37,7 +37,7 @@ public final class TutorialDefinition {
private final List<TutorialStep> steps = new LinkedList<TutorialStep>();
/** Constructor. */
public TutorialDefinition(String title, TutorialStep initialStep, String category) {
public TutorialDefinition(String title, TutorialStep initialStep) {
this.title = title;
addStep(initialStep);
}
......
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2016 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.extension.data;
import static org.conqat.lib.commons.collections.CollectionUtils.asUnmodifiable;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.ITutorialStepCompletionChecker;
import org.fortiss.tooling.kernel.service.ITutorialService;
/**
* A composite step, which encapsulates other tutorial steps.
*
* @author hoelzl
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public class TutorialStepComposite extends TutorialStep {
/** The list of contained steps. */
private final List<TutorialStep> steps = new LinkedList<TutorialStep>();
/** Constructor. */
public TutorialStepComposite(String title, String description) {
super(title, description);
}
/** Adds the given step to the end of the step list. */
public void addStep(TutorialStep step) {
steps.add(step);
}
/** Returns steps. */
public List<TutorialStep> getSteps() {
return asUnmodifiable(steps);
}
/** {@inheritDoc} */
@Override
public ITutorialStepCompletionChecker getCompletionChecker() {
return new ITutorialStepCompletionChecker() {
@Override
public boolean isTutorialStepComplete(EObject model) {
if(steps.isEmpty()) {
return true;
}
TutorialStep current = ITutorialService.INSTANCE.getActiveTutorialStep();
return steps.lastIndexOf(current) == steps.size() - 1;
}
};
}
}
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