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

Added part of the editor creation for tutorial steps.

refs 2567
parent 18ac0643
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,11 @@
id="org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor"
name="Extendable Model Editor">
</editor>
<editor
default="false"
id="org.fortiss.tooling.kernel.ui.internal.editor.TutorialStepUIEditor"
name="Tutorial Editor">
</editor>
</extension>
<extension
point="org.eclipse.ui.views">
......
......@@ -17,6 +17,7 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.extension.data;
import org.eclipse.swt.widgets.Composite;
import org.fortiss.tooling.kernel.extension.data.TutorialStep;
import org.fortiss.tooling.kernel.ui.extension.ITutorialUIWhitelistProvider;
import org.fortiss.tooling.kernel.ui.extension.base.TutorialUIBlacklistAllProvider;
......@@ -42,4 +43,7 @@ public abstract class TutorialStepUI extends TutorialStep {
public ITutorialUIWhitelistProvider getUIWhitelistProvider() {
return new TutorialUIBlacklistAllProvider();
}
/** Creates the composite to be shown in the editor for the given tutorial step. */
public abstract void createDetailsComposite(Composite parent);
}
......@@ -25,12 +25,17 @@ import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.fortiss.tooling.kernel.extension.ITutorialProvider;
import org.fortiss.tooling.kernel.extension.data.TutorialStep;
import org.fortiss.tooling.kernel.service.ITutorialService;
import org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator;
import org.fortiss.tooling.kernel.ui.extension.ITutorialUIProvider;
import org.fortiss.tooling.kernel.ui.extension.data.TutorialStepUI;
import org.fortiss.tooling.kernel.ui.internal.editor.TutorialStepUIEditorInput;
import org.fortiss.tooling.kernel.ui.service.ITutorialUIService;
/**
......@@ -139,4 +144,24 @@ public final class TutorialUIService implements ITutorialUIService {
}
return false;
}
/** {@inheritDoc} */
@Override
public void openInEditor(TutorialStepUI selected) {
// TODO: fix it
try {
IEditorInput input = new TutorialStepUIEditorInput(selected);
IEditorPart part =
PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.openEditor(
input,
"org.fortiss.tooling.kernel.ui.internal.editor.TutorialStepUIEditor",
true);
} catch(PartInitException pex) {
}
}
}
/*--------------------------------------------------------------------------+
$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.ui.internal.editor;
import org.conqat.ide.commons.ui.editor.ReadonlyEditorBase;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import org.fortiss.tooling.kernel.ui.extension.data.TutorialStepUI;
/**
* {@link EditorPart} for {@link TutorialStepUI} read-only editors.
*
* @author hoelzl
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public final class TutorialStepUIEditor extends ReadonlyEditorBase {
/** {@inheritDoc} */
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
TutorialStepUI step = ((TutorialStepUIEditorInput)input).getStep();
}
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
TutorialStepUI step = ((TutorialStepUIEditorInput)getEditorInput()).getStep();
}
/** {@inheritDoc} */
@Override
public void setFocus() {
// do nothing
}
}
/*--------------------------------------------------------------------------+
$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.ui.internal.editor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator;
import org.fortiss.tooling.kernel.ui.extension.data.TutorialStepUI;
/**
* {@link IEditorInput} for {@link TutorialStepUIEditorInput}.
*
* @author hoelzl
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public final class TutorialStepUIEditorInput implements IEditorInput {
/** The underlying {@link TutorialStepUI}. */
private final TutorialStepUI step;
/** Constructor. */
public TutorialStepUIEditorInput(TutorialStepUI step) {
this.step = step;
}
/** Returns step. */
public TutorialStepUI getStep() {
return step;
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
return null;
}
/** {@inheritDoc} */
@Override
public boolean exists() {
return false;
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getImageDescriptor() {
return ToolingKernelUIActivator.getImageDescriptor("icons/tutorial.gif");
}
/** {@inheritDoc} */
@Override
public String getName() {
return step.getTitle();
}
/** {@inheritDoc} */
@Override
public IPersistableElement getPersistable() {
return null;
}
/** {@inheritDoc} */
@Override
public String getToolTipText() {
return "";
}
}
......@@ -22,8 +22,10 @@ import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.data.TutorialStepUI;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
import org.fortiss.tooling.kernel.ui.service.ITutorialUIService;
import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils;
/**
......@@ -64,6 +66,11 @@ class DoubleClick implements IDoubleClickListener {
}
}
IModelEditorBindingService.INSTANCE.openInEditor(element);
} else {
Object selected = ((IStructuredSelection)event.getSelection()).getFirstElement();
if(selected instanceof TutorialStepUI) {
ITutorialUIService.INSTANCE.openInEditor((TutorialStepUI)selected);
}
}
}
}
......
......@@ -21,6 +21,7 @@ import org.fortiss.tooling.kernel.extension.ITutorialProvider;
import org.fortiss.tooling.kernel.service.ITutorialService;
import org.fortiss.tooling.kernel.ui.extension.ITutorialUIProvider;
import org.fortiss.tooling.kernel.ui.extension.ITutorialUIWhitelistProvider;
import org.fortiss.tooling.kernel.ui.extension.data.TutorialStepUI;
import org.fortiss.tooling.kernel.ui.internal.TutorialUIService;
/**
......@@ -38,4 +39,7 @@ public interface ITutorialUIService extends ITutorialUIWhitelistProvider {
/** Programmatically register a tutorial provider. */
public void registerTutorialUIProvider(Class<? extends ITutorialProvider> nonUIprovider,
Class<? extends ITutorialUIProvider> uiProvider);
/** Opens the editor for the given tutorial step. */
public void openInEditor(TutorialStepUI selected);
}
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