Skip to content
Snippets Groups Projects
Commit ba31e728 authored by Daniel Plagge's avatar Daniel Plagge
Browse files

Merge branch 'develop' into feature/theory_plugin

Conflicts:
	de.prob.core/.classpath
	de.prob.core/META-INF/MANIFEST.MF
	de.prob.core/src/de/prob/eventb/translator/internal/EventBTranslator.java
parents 0eaf49d1 fe287ca8
No related branches found
No related tags found
No related merge requests found
Showing
with 487 additions and 842 deletions
// to trigger a full tycho build please use 'gradle deleteFromClassPath completeInstall'
import org.apache.tools.ant.taskdefs.condition.Os
project.ext{
targetRepositories = ["http://www.stups.uni-duesseldorf.de/prob_dev_target/","http://download.eclipse.org/releases/indigo/","http://rodin-b-sharp.sourceforge.net/updates"]
groupID = "de.prob"
}
apply from: 'tycho_build.gradle'
......@@ -64,16 +69,51 @@ def download(address,target) {
}
task downloadCli << {
dir = workspacePath+'de.prob.core/prob/'
def dir = workspacePath+'de.prob.core/prob/'
delete file(dir)
new File(dir).mkdirs()
['leopard64':'macos','linux':'linux','linux64':'linux64','win32':'windows'].each {
n = it.getKey()
def n = it.getKey()
targetdir = dir+it.getValue()
targetzip = dir+"probcli_${n}.zip"
url = "http://nightly.cobra.cs.uni-duesseldorf.de/cli/probcli_${n}.zip"
def targetdir = dir+it.getValue()
def targetzip = dir+"probcli_${n}.zip"
def url = "http://nightly.cobra.cs.uni-duesseldorf.de/cli/probcli_${n}.zip"
download(url,targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}
def targetdir = dir+"windows/"
def targetzip = targetdir+"windowslib.zip"
download("http://nightly.cobra.cs.uni-duesseldorf.de/cli/windowslib.zip",targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}
task downloadCli2 ( type: Exec ) {
def dir = workspacePath+'de.prob.core/prob/'
delete file(dir)
new File(dir).mkdirs()
['leopard64':'macos','linux':'linux','linux64':'linux64','win32':'windows'].each {
def n = it.getKey()
def targetdir = dir+it.getValue()
def targetzip = dir+"probcli_${n}.zip"
def url = "http://nightly.cobra.cs.uni-duesseldorf.de/cli/probcli_${n}.zip"
download(url,targetzip)
FileTree zip = zipTree(targetzip)
copy {
......@@ -83,8 +123,8 @@ task downloadCli << {
delete file(targetzip)
}
targetdir = dir+"windows/"
targetzip = targetdir+"windowslib.zip"
def targetdir = dir+"windows/"
def targetzip = targetdir+"windowslib.zip"
download("http://nightly.cobra.cs.uni-duesseldorf.de/cli/windowslib.zip",targetzip)
FileTree zip = zipTree(targetzip)
copy {
......@@ -93,9 +133,21 @@ task downloadCli << {
}
delete file(targetzip)
['leopard64':'macos','linux32':'linux','linux64':'linux64'].each {
def n = it.getKey()
targetdir = dir+it.getValue()
download( "http://nightly.cobra.cs.uni-duesseldorf.de/cspm/cspm-"+n, targetdir+"/cspm" )
}
commandLine 'chmod', 'a+x', dir+'linux'+'/cspm', dir+'linux64'+'/cspm', dir+'macos'+'/cspm'
//commandLine 'chmod', 'a+x', dir+'*'+'/cspm'
download( "http://nightly.cobra.cs.uni-duesseldorf.de/cspm/cspm-windows", dir+"windows"+"/cspm.exe" )
}
completeInstall.dependsOn downloadCli
completeInstall.dependsOn subprojects.setClassPath
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BMotion Studio Editor Plug-in
Bundle-SymbolicName: de.bmotionstudio.gef.editor;singleton:=true
Bundle-Version: 5.4.0.qualifier
Bundle-Version: 5.4.2.qualifier
Bundle-Activator: de.bmotionstudio.gef.editor.BMotionEditorPlugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
......@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.databinding.beans;bundle-version="[1.1.1,2.0.0)",
org.eclipse.gef;bundle-version="[3.7.0,4.0.0)";visibility:=reexport,
de.prob.core;bundle-version="[9.3.0,9.4.0)";visibility:=reexport,
org.eventb.core;bundle-version="[2.1.0,2.6.0)"
org.eventb.core;bundle-version="[2.1.0,2.6.0)",
org.eclipse.help;bundle-version="3.5.100"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: de.prob.core
......
de.bmotionstudio.gef.editor/icons/eclipse16/linkto_help.gif

618 B

de.bmotionstudio.gef.editor/icons/icon_add.gif

386 B

de.bmotionstudio.gef.editor/icons/icon_ascript.png

489 B

de.bmotionstudio.gef.editor/icons/icon_motion.gif

1017 B

de.bmotionstudio.gef.editor/icons/icon_motion_wiz.gif

1.09 KiB

de.bmotionstudio.gef.editor/icons/icon_screenshot.gif

613 B

File added
This diff is collapsed.
......@@ -18,7 +18,6 @@
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="control" minOccurs="0" maxOccurs="1"/>
<element ref="group" minOccurs="0" maxOccurs="1"/>
<element ref="control" minOccurs="0" maxOccurs="1"/>
</sequence>
......@@ -75,9 +74,6 @@
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="attributes" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
......@@ -122,69 +118,14 @@
</complexType>
</element>
<element name="attribute-string">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
The id of the referenced attribute. Since the same attribute could be assigned to different controls the corresponding attibute is defined in a seperate exention point (de.bmotionstudio.gef.editor.attribute).
</documentation>
</annotation>
</attribute>
<attribute name="default-value" type="string" use="required">
<annotation>
<documentation>
The default value of this attribute for this control
</documentation>
</annotation>
</attribute>
<attribute name="editable" type="boolean" use="default" value="true">
<annotation>
<documentation>
Boolean value - Option to decide whenever this attribute should be editable or not.
</documentation>
</annotation>
</attribute>
<attribute name="show" type="boolean" use="default" value="true">
<annotation>
<documentation>
Boolean value - Option to decide whenever this attribute should be displayed in the properties view.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="attribute-java">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="default-value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":de.bmotionstudio.core.IGetDefaultValue"/>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="attributes">
<complexType>
<sequence>
<element ref="attribute-java" minOccurs="0" maxOccurs="unbounded"/>
<element ref="attribute-string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<annotation>
<appInfo>
......@@ -204,15 +145,6 @@
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
......
......@@ -54,6 +54,9 @@
</appInfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="observer"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
......@@ -71,9 +74,6 @@
</appInfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="control"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
......@@ -87,7 +87,7 @@
<element name="include">
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="observer"/>
<element ref="control"/>
</sequence>
<attribute name="language" type="string" use="required">
<annotation>
......
......@@ -25,7 +25,6 @@ import org.eclipse.ui.actions.ActionFactory;
import de.bmotionstudio.gef.editor.action.OpenSchedulerEventAction;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode;
import de.bmotionstudio.gef.editor.model.Visualization;
import de.bmotionstudio.gef.editor.scheduler.SchedulerEvent;
......@@ -120,8 +119,6 @@ public class BMSContextMenuProvider extends ContextMenuProvider {
if (model instanceof BControl)
bcontrol = (BControl) model;
else if (model instanceof ObserverRootVirtualTreeNode)
bcontrol = ((ObserverRootVirtualTreeNode) model).getControl();
else
return;
......@@ -131,51 +128,9 @@ public class BMSContextMenuProvider extends ContextMenuProvider {
"icons/icon_observer.gif"), "observerMenu");
menu.appendToGroup(GEFActionConstants.GROUP_ADD, handleObserverMenu);
IExtensionPoint extensionPoint = registry
.getExtensionPoint("de.bmotionstudio.gef.editor.observer");
for (IExtension extension : extensionPoint.getExtensions()) {
for (IConfigurationElement configurationElement : extension
.getConfigurationElements()) {
if ("observer".equals(configurationElement.getName())) {
final String observerClassName = configurationElement
.getAttribute("class");
final String observerName = configurationElement
.getAttribute("name");
if (checkIncludeObserver(observerClassName, bcontrol)) {
IAction action = getActionRegistry().getAction(
"de.bmotionstudio.gef.editor.observerAction."
+ observerClassName);
action.setText(observerName);
action.setToolTipText(observerName);
if (bcontrol.hasObserver(observerClassName)) {
action.setImageDescriptor(BMotionStudioImage
.getImageDescriptor(
BMotionEditorPlugin.PLUGIN_ID,
"icons/icon_chop.gif"));
} else {
action.setImageDescriptor(null);
}
handleObserverMenu.add(action);
}
}
}
}
}
private boolean checkIncludeObserver(String observerID, BControl control) {
IExtensionPoint extensionPoint = registry
.getExtensionPoint("de.bmotionstudio.gef.editor.includeObserver");
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
.getExtensionPoint(
"de.bmotionstudio.gef.editor.includeObserver");
for (IExtension extension : extensionPoint.getExtensions()) {
for (IConfigurationElement configurationElement : extension
......@@ -187,25 +142,35 @@ public class BMSContextMenuProvider extends ContextMenuProvider {
.getAttribute("language");
if (langID != null
&& langID.equals(control.getVisualization()
.getLanguage())) {
&& langID.equals(bcontrol.getVisualization().getLanguage())) {
for (IConfigurationElement configC : configurationElement
.getChildren("control")) {
for (IConfigurationElement cObserver : configurationElement
String cID = configC.getAttribute("id");
if (bcontrol.getType().equals(cID)) {
for (IConfigurationElement configO : configC
.getChildren("observer")) {
String oID = cObserver.getAttribute("id");
String oID = configO.getAttribute("id");
IAction action = getActionRegistry()
.getAction(
"de.bmotionstudio.gef.editor.observerAction."
+ oID);
if (observerID.equals(oID)) {
String name = oID;
for (IConfigurationElement configBControl : cObserver
.getChildren("control")) {
IConfigurationElement observerExtension = BMotionEditorPlugin
.getObserverExtension(oID);
if (observerExtension != null)
name = observerExtension
.getAttribute("name");
String bID = configBControl
.getAttribute("id");
action.setText(name);
if (control.getType().equals(bID)) {
return true;
}
handleObserverMenu.add(action);
}
......@@ -220,8 +185,6 @@ public class BMSContextMenuProvider extends ContextMenuProvider {
}
}
return false;
}
private void buildEventMenu(IMenuManager menu, AbstractEditPart editPart) {
......@@ -282,14 +245,6 @@ public class BMSContextMenuProvider extends ContextMenuProvider {
action.setText(configSchedulerElement
.getAttribute("name"));
// if (bcontrol.hasEvent(eventIDs[0])) {
// action
// .setImageDescriptor(BMotionStudioImage
// .getImageDescriptor(
// BMotionEditorPlugin.PLUGIN_ID,
// "icons/icon_chop.gif"));
// } else {
action.setImageDescriptor(null);
// }
......
......@@ -6,29 +6,79 @@
package de.bmotionstudio.gef.editor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import de.bmotionstudio.gef.editor.model.BControl;
public abstract class BMotionAbstractWizard extends Wizard {
public abstract class BMotionAbstractWizard extends TrayDialog {
private BControl control;
public BMotionAbstractWizard(BControl control) {
this.control = control;
}
public static final int CLOSE = 2;
@Override
public boolean performFinish() {
return prepareToFinish();
public BMotionAbstractWizard(Shell shell, BControl control) {
super(shell);
this.control = control;
}
public BControl getBControl() {
return this.control;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
}
public abstract String getName();
protected abstract Boolean prepareToFinish();
@Override
protected int getShellStyle() {
return SWT.SHELL_TRIM;
}
@Override
protected Control createDialogArea(Composite parent) {
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(layout);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
createWizardContent(container);
return container;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.CLOSE_ID,
IDialogConstants.CLOSE_LABEL, true);
}
@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.CLOSE_ID == buttonId)
closePressed();
}
protected void closePressed() {
setReturnCode(CLOSE);
close();
}
public abstract Control createWizardContent(Composite parent);
}
......@@ -8,7 +8,7 @@ package de.bmotionstudio.gef.editor;
public class EditorImageRegistry implements IBMotionStudioImageRegistry {
public static final String IMG_ICON_ADD = "icon_add";
// public static final String IMG_ICON_ADD = "icon_add";
public static final String IMG_ICON_CHOP = "icon_chop";
public static final String IMG_ICON_DELETE = "icon_delete";
public static final String IMG_ICON_DELETE21 = "icon_delete21";
......@@ -18,7 +18,6 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
public static final String IMG_ICON_OBSERVER = "icon_observer";
public static final String IMG_ICON_LOADING = "icon_loading";
public static final String IMG_ICON_LIBRARY = "icon_library";
public static final String IMG_ICON_ASCRIPT = "icon_ascript";
public static final String IMG_ICON_UP = "icon_up";
public static final String IMG_ICON_DOWN = "icon_down";
public static final String IMG_ICON_CONNECTION16 = "icon_connection16";
......@@ -28,6 +27,7 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
public static final String IMG_ICON_TR_UP = "icon_tr_up";
public static final String IMG_ICON_TR_LEFT = "icon_tr_left";
public static final String IMG_ICON_CONTROL_HIDDEN = "icon_control_hidden";
public static final String IMG_ICON_HELP = "icon_help";
public static final String IMG_ICON_JPG = "icon_jpg";
public static final String IMG_ICON_GIF = "icon_gif";
......@@ -36,8 +36,8 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
public void registerImages() {
BMotionStudioImage.registerImage(IMG_ICON_ADD,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_add.gif");
// BMotionStudioImage.registerImage(IMG_ICON_ADD,
// BMotionEditorPlugin.PLUGIN_ID, "icons/icon_add.gif");
BMotionStudioImage.registerImage(IMG_ICON_CHOP,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_chop.gif");
BMotionStudioImage.registerImage(IMG_ICON_DELETE,
......@@ -54,8 +54,6 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_loading.gif");
BMotionStudioImage.registerImage(IMG_ICON_LIBRARY,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_library.gif");
BMotionStudioImage.registerImage(IMG_ICON_ASCRIPT,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_ascript.png");
BMotionStudioImage.registerImage(IMG_ICON_UP,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_up.gif");
BMotionStudioImage.registerImage(IMG_ICON_DOWN,
......@@ -72,6 +70,9 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
"org.eclipse.ui", "$nl$/icons/full/etool16/delete_edit.gif");
BMotionStudioImage.registerImage(IMG_ICON_DELETE_EDIT,
"org.eclipse.ui", "$nl$/icons/full/etool16/delete_edit.gif");
BMotionStudioImage.registerImage(IMG_ICON_HELP,
BMotionEditorPlugin.PLUGIN_ID,
"icons/eclipse16/linkto_help.gif");
BMotionStudioImage
.registerImage(IMG_ICON_TR_UP, BMotionEditorPlugin.PLUGIN_ID,
"icons/eclipse16/updated_co.gif");
......
/**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
* Heinrich Heine Universitaet Duesseldorf
* This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.bmotionstudio.gef.editor.action;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IWorkbenchPart;
import de.bmotionstudio.gef.editor.BMotionStudioImage;
import de.bmotionstudio.gef.editor.EditorImageRegistry;
public abstract class BMotionAbstractWizardDialog extends WizardDialog {
public static final int DELETE = 3;
private IWorkbenchPart workbenchPart;
private String deleteToolTip;
public BMotionAbstractWizardDialog(IWorkbenchPart workbenchPart, IWizard newWizard) {
super(workbenchPart.getSite().getShell(), newWizard);
this.workbenchPart = workbenchPart;
}
@Override
protected Control createButtonBar(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.horizontalSpacing = 0;
composite.setLayout(layout);
composite
.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
composite.setFont(parent.getFont());
// create help control if needed
if (isHelpAvailable()) {
Control helpControl = createHelpControl(composite);
((GridData) helpControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
}
Control deleteControl = createDeleteControl(composite);
((GridData) deleteControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
setHelpAvailable(false);
Control buttonSection = super.createButtonBar(composite);
((GridData) buttonSection.getLayoutData()).grabExcessHorizontalSpace = true;
return composite;
}
private Control createDeleteControl(Composite parent) {
return createDeleteImageButton(parent,
BMotionStudioImage
.getImage(EditorImageRegistry.IMG_ICON_DELETE21));
}
private ToolBar createDeleteImageButton(Composite parent, Image image) {
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem deleteToolItem = new ToolItem(toolBar, SWT.NONE);
deleteToolItem.setImage(image);
deleteToolItem.setToolTipText(deleteToolTip);
deleteToolItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
deletePressed();
}
});
return toolBar;
}
protected abstract void deletePressed();
public IWorkbenchPart getWorkbenchPart() {
return workbenchPart;
}
protected void setDeleteToolTip(String msg) {
this.deleteToolTip = msg;
}
}
/**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
* Heinrich Heine Universitaet Duesseldorf
* This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.bmotionstudio.gef.editor.action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
public class BMotionObserverWizardDialog extends BMotionAbstractWizardDialog {
public BMotionObserverWizardDialog(IWorkbenchPart workbenchPart, IWizard newWizard) {
super(workbenchPart, newWizard);
setShellStyle(SWT.CLOSE | SWT.RESIZE);
setDeleteToolTip("Delete Observer");
}
@Override
protected void deletePressed() {
if (MessageDialog.openConfirm(Display.getDefault().getActiveShell(),
"Do you really want to delete this Observer?",
"Do you really want to delete this Observer?")) {
setReturnCode(DELETE);
close();
}
}
}
/**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
* Heinrich Heine Universitaet Duesseldorf
* This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.bmotionstudio.gef.editor.action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
import de.bmotionstudio.gef.editor.scheduler.SchedulerWizard;
public class BMotionSchedulerEventWizardDialog extends BMotionAbstractWizardDialog {
public BMotionSchedulerEventWizardDialog(IWorkbenchPart workbenchPart,
IWizard newWizard) {
super(workbenchPart, newWizard);
setShellStyle(SWT.CLOSE);
setDeleteToolTip("Delete Event");
}
@Override
protected void deletePressed() {
if (MessageDialog.openConfirm(Display.getDefault().getActiveShell(),
"Do you really want to delete this Event?",
"Do you really want to delete this Event?")) {
RemoveSchedulerEventAction action = new RemoveSchedulerEventAction(
getWorkbenchPart());
action.setControl(((SchedulerWizard) getWizard()).getBControl());
action.setSchedulerEvent(((SchedulerWizard) getWizard())
.getScheduler());
action.run();
setReturnCode(DELETE);
close();
}
}
}
......@@ -8,18 +8,12 @@ package de.bmotionstudio.gef.editor.action;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
import de.bmotionstudio.gef.editor.BMotionEditorPlugin;
import de.bmotionstudio.gef.editor.BMotionStudioImage;
import de.bmotionstudio.gef.editor.command.RemoveObserverCommand;
import de.bmotionstudio.gef.editor.command.SetObserverCommand;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode;
import de.bmotionstudio.gef.editor.observer.Observer;
import de.bmotionstudio.gef.editor.observer.ObserverWizard;
import de.prob.logging.Logger;
......@@ -50,79 +44,23 @@ public class OpenObserverAction extends SelectionAction {
if (actionControl != null) {
Observer oldObserver = null;
Observer observer = getControl().getObserver(getClassName());
// If an observer does not exist, add one
if (observer == null) {
try {
observer = (Observer) BMotionEditorPlugin
.getObserverExtension(getClassName())
.createExecutableExtension("class");
} catch (CoreException e) {
}
} else { // else edit the current observer
// therefore, clone the current observer, if the user aborts
// editing the current observer
try {
oldObserver = observer.clone();
} catch (CloneNotSupportedException e) {
}
}
ObserverWizard wizard = observer.getWizard(actionControl);
ObserverWizard wizard = observer.getWizard(Display.getDefault()
.getActiveShell(), actionControl);
if (wizard != null) {
BMotionObserverWizardDialog dialog = new BMotionObserverWizardDialog(
getWorkbenchPart(), wizard);
dialog.create();
dialog.getShell().setSize(wizard.getSize());
String title = "Observer: " + observer.getName()
+ " Control: " + getControl().getID();
wizard.setWindowTitle("BMotion Studio Observer Wizard");
dialog.setTitle(title);
dialog.setMessage(observer.getDescription());
dialog.setTitleImage(BMotionStudioImage
.getImage(BMotionStudioImage.IMG_LOGO_BMOTION64));
int status = dialog.open();
// The user clicked on the "OK" button in order to confirm his
// changes on the observer
if (status == WizardDialog.OK) {
// If the observer delete flag is set to true, delete the
// observer anyway
if (wizard.isObserverDelete()) {
RemoveObserverCommand cmd = createRemoveObserverCommand(
observer, actionControl);
execute(cmd);
} else {
SetObserverCommand cmd = createObserverSetCommand(
actionControl, observer, oldObserver);
execute(cmd);
}
// else the user canceled his changes on the observer
} else if (status == WizardDialog.CANCEL) {
// Reset observer without using a command!
if (oldObserver != null)
actionControl.getObservers().put(oldObserver.getID(),
oldObserver);
// else the user clicked on the delete button in order to
// delete the observer
} else if (status == BMotionObserverWizardDialog.DELETE) {
RemoveObserverCommand cmd = createRemoveObserverCommand(
observer, actionControl);
execute(cmd);
}
wizard.create();
wizard.getShell().setSize(wizard.getSize());
String title = "Observer: " + observer.getName() + " Control: "
+ getControl().getID();
wizard.getShell().setText(title);
// wizard.setWindowTitle("BMotion Studio Observer Wizard");
// wizard.setTitle(title);
// wizard.setMessage(observer.getDescription());
// wizard.setTitleImage(BMotionStudioImage
// .getImage(BMotionStudioImage.IMG_LOGO_BMOTION64));
wizard.open();
} else {
Logger.notifyUserWithoutBugreport("The Observer \""
+ observer.getName()
......@@ -132,28 +70,6 @@ public class OpenObserverAction extends SelectionAction {
}
private RemoveObserverCommand createRemoveObserverCommand(
Observer observer, BControl control) {
RemoveObserverCommand cmd = new RemoveObserverCommand();
cmd.setControl(control);
cmd.setObserver(observer);
return cmd;
}
public SetObserverCommand createObserverSetCommand(BControl control,
Observer newObserver, Observer oldObserver) {
SetObserverCommand cmd = new SetObserverCommand();
cmd.setNewObserver(newObserver);
cmd.setOldObserver(oldObserver);
cmd.setControl(control);
return cmd;
}
public SetObserverCommand createObserverSetCommand(BControl control,
Observer newObserver) {
return createObserverSetCommand(control, newObserver, null);
}
public void setClassName(String className) {
this.className = className;
}
......@@ -172,10 +88,7 @@ public class OpenObserverAction extends SelectionAction {
if ((objects.get(0) instanceof EditPart)) {
EditPart part = (EditPart) objects.get(0);
BControl control = null;
if (part.getModel() instanceof ObserverRootVirtualTreeNode)
control = ((ObserverRootVirtualTreeNode) part.getModel())
.getControl();
else if (part.getModel() instanceof BControl)
if (part.getModel() instanceof BControl)
control = (BControl) part.getModel();
return control;
}
......
......@@ -8,16 +8,12 @@ package de.bmotionstudio.gef.editor.action;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.BMotionEditorPlugin;
import de.bmotionstudio.gef.editor.BMotionStudioImage;
import de.bmotionstudio.gef.editor.command.SchedulerEventCommand;
import de.bmotionstudio.gef.editor.model.BControl;
import de.bmotionstudio.gef.editor.scheduler.SchedulerEvent;
import de.bmotionstudio.gef.editor.scheduler.SchedulerWizard;
......@@ -27,7 +23,6 @@ public class OpenSchedulerEventAction extends SelectionAction {
private String className;
private String eventID;
private SchedulerEvent clonedSchedulerEvent;
public OpenSchedulerEventAction(IWorkbenchPart part) {
super(part);
......@@ -46,82 +41,33 @@ public class OpenSchedulerEventAction extends SelectionAction {
public void run() {
BControl bcontrol = getControl();
clonedSchedulerEvent = null;
if (bcontrol != null) {
SchedulerEvent newSchedulerEvent = bcontrol.getEvent(getEventID());
// Add Scheduler Event
if (newSchedulerEvent == null) {
try {
newSchedulerEvent = (SchedulerEvent) BMotionEditorPlugin
.getSchedulerExtension(getClassName())
.createExecutableExtension("class");
} catch (CoreException e) {
}
} else { // Edit Scheduler Event
// Clone Scheduler Event
try {
clonedSchedulerEvent = newSchedulerEvent.clone();
} catch (CloneNotSupportedException e) {
}
}
if (newSchedulerEvent != null) {
newSchedulerEvent.setEventID(getEventID());
SchedulerWizard wizard = newSchedulerEvent.getWizard(bcontrol);
SchedulerWizard wizard = newSchedulerEvent.getWizard(Display
.getDefault().getActiveShell(), bcontrol);
if (wizard != null) {
BMotionSchedulerEventWizardDialog dialog = new BMotionSchedulerEventWizardDialog(
getWorkbenchPart(), wizard);
dialog.create();
dialog.getShell().setSize(wizard.getSize());
wizard.create();
wizard.getShell().setSize(wizard.getSize());
String title = "Scheduler Event: "
+ newSchedulerEvent.getName()
+ " Control: "
+ bcontrol
.getAttributeValue(AttributeConstants.ATTRIBUTE_ID);
wizard.setWindowTitle("BMotion Studio Scheduler Event Wizard");
dialog.setTitle(title);
dialog.setMessage(newSchedulerEvent.getDescription());
dialog.setTitleImage(BMotionStudioImage
.getImage(BMotionStudioImage.IMG_LOGO_BMOTION64));
int status = dialog.open();
if (status == WizardDialog.OK) {
SchedulerEventCommand schedulerEventCommand = createSchedulerEventCommand();
schedulerEventCommand
.setNewSchedulerEvent(newSchedulerEvent);
if (wizard.isEventDelete()) {
RemoveSchedulerEventAction action = new RemoveSchedulerEventAction(
getWorkbenchPart());
action.setControl(getControl());
action.setSchedulerEvent(clonedSchedulerEvent);
action.run();
} else {
if (clonedSchedulerEvent != null) {
schedulerEventCommand
.setClonedSchedulerEvent(clonedSchedulerEvent);
}
execute(schedulerEventCommand);
}
} else if (status == WizardDialog.CANCEL) {
if (clonedSchedulerEvent != null)
bcontrol.addEvent(getEventID(),
clonedSchedulerEvent);
}
wizard.getShell().setText(title);
// wizard.setWindowTitle("BMotion Studio Scheduler Event Wizard");
// wizard.setTitle(title);
// wizard.setMessage(newSchedulerEvent.getDescription());
// wizard.setTitleImage(BMotionStudioImage
// .getImage(BMotionStudioImage.IMG_LOGO_BMOTION64));
wizard.open();
} else {
Logger.notifyUserWithoutBugreport("The Scheduler Event \""
......@@ -137,14 +83,6 @@ public class OpenSchedulerEventAction extends SelectionAction {
}
public SchedulerEventCommand createSchedulerEventCommand() {
SchedulerEventCommand command = new SchedulerEventCommand();
command.setClassName(getClassName());
command.setEventID(getEventID());
command.setControl(getControl());
return command;
}
public void setClassName(String className) {
this.className = className;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment