Bug 511573

Added "Symbex Workflow" View on symbex perspective
Resume of the symbex run configurations with collapsible sections
Still work in progress

Change-Id: Ia7f7d14c55901e054d77695996b4ca27290947dc
Signed-off-by: Erwan Mahe <erwan.mahe@cea.fr>
diff --git a/gui/org.eclipse.efm.ui.views/.classpath b/gui/org.eclipse.efm.ui.views/.classpath
new file mode 100644
index 0000000..b862a29
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>

+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

+	<classpathentry kind="src" path="src"/>

+	<classpathentry kind="output" path="bin"/>

+</classpath>

diff --git a/gui/org.eclipse.efm.ui.views/.gitignore b/gui/org.eclipse.efm.ui.views/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/gui/org.eclipse.efm.ui.views/.project b/gui/org.eclipse.efm.ui.views/.project
new file mode 100644
index 0000000..de9c404
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>org.eclipse.efm.ui.views</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/gui/org.eclipse.efm.ui.views/.settings/org.eclipse.jdt.core.prefs b/gui/org.eclipse.efm.ui.views/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..295926d
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8

+org.eclipse.jdt.core.compiler.compliance=1.8

+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

+org.eclipse.jdt.core.compiler.source=1.8

diff --git a/gui/org.eclipse.efm.ui.views/META-INF/MANIFEST.MF b/gui/org.eclipse.efm.ui.views/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c957f57
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Views
+Bundle-SymbolicName: org.eclipse.efm.ui.views;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.debug.core
diff --git a/gui/org.eclipse.efm.ui.views/about.html b/gui/org.eclipse.efm.ui.views/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+ 
+<p>June 5, 2007</p>	
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise 
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available 
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is 
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was 
+provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/gui/org.eclipse.efm.ui.views/build.properties b/gui/org.eclipse.efm.ui.views/build.properties
new file mode 100644
index 0000000..6f20375
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/build.properties
@@ -0,0 +1,5 @@
+source.. = src/

+output.. = bin/

+bin.includes = META-INF/,\

+               .,\

+               plugin.xml

diff --git a/gui/org.eclipse.efm.ui.views/icons/sample.gif b/gui/org.eclipse.efm.ui.views/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/icons/sample.gif
Binary files differ
diff --git a/gui/org.eclipse.efm.ui.views/plugin.xml b/gui/org.eclipse.efm.ui.views/plugin.xml
new file mode 100644
index 0000000..35ee838
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<?eclipse version="3.4"?>

+<plugin>

+   <extension

+         point="org.eclipse.ui.views">

+      <category

+            id="org.eclipse.efm.ui.views"

+            name="EFM Views">

+      </category>

+      <view

+            category="org.eclipse.efm.ui.views"

+            class="org.eclipse.efm.ui.views.SymbexWorkflowView"

+            icon="icons/sample.gif"

+            id="org.eclipse.efm.ui.views.SymbexWorkflowView"

+            name="Symbex Workflow">

+      </view>

+   </extension>

+

+</plugin>

diff --git a/gui/org.eclipse.efm.ui.views/pom.xml b/gui/org.eclipse.efm.ui.views/pom.xml
new file mode 100644
index 0000000..212a09e
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.eclipse.efm</groupId>
+		<artifactId>org.eclipse.efm.modeling.gui</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+	<artifactId>org.eclipse.efm.ui.views</artifactId>
+	<packaging>eclipse-plugin</packaging>
+	<name>org.eclipse.efm.ui.views</name>
+	<description>This plug-in contains the XXXXXXXXX.</description>
+</project>
\ No newline at end of file
diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/AbstractSymbexWorkflowView.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/AbstractSymbexWorkflowView.java
new file mode 100644
index 0000000..e025c62
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/AbstractSymbexWorkflowView.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr
+ *   - Initial API and Implementation
+ *******************************************************************************/
+package org.eclipse.efm.ui.views;
+
+
+
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.swt.widgets.Composite;
+
+public abstract class AbstractSymbexWorkflowView extends ViewPart {
+	
+	protected Composite parentComposite;
+	protected Composite selfCreatedMainComposite;
+	
+	protected Action[] actions;
+
+	protected void contributeToActionBars() {
+		IActionBars bars = getViewSite().getActionBars();
+		fillLocalPullDown(bars.getMenuManager());
+		fillLocalToolBar(bars.getToolBarManager());
+	}
+
+	private void fillLocalPullDown(IMenuManager manager) {
+		for(Action action: actions) {
+			manager.add(action);
+			manager.add(new Separator());
+		}
+	}
+
+	private void fillContextMenu(IMenuManager manager) {
+		for(Action action: actions) {
+			manager.add(action);
+		}
+		// Other plug-ins can contribute there actions here
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+	
+	private void fillLocalToolBar(IToolBarManager manager) {
+		for(Action action: actions) {
+			manager.add(action);
+		}
+	}
+	
+	void showMessage(String message) {
+		MessageDialog.openInformation(
+			selfCreatedMainComposite.getShell(),
+			"Symbex Workflow",
+			message);
+	}
+
+	/**
+	 * Passing the focus request to the viewer's control.
+	 */
+	public void setFocus() {
+		selfCreatedMainComposite.setFocus();
+	}
+}
diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/GenericCompositeCreator.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/GenericCompositeCreator.java
new file mode 100644
index 0000000..3728d0f
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/GenericCompositeCreator.java
@@ -0,0 +1,74 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views;

+

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.graphics.FontMetrics;

+import org.eclipse.swt.graphics.GC;

+import org.eclipse.swt.layout.GridData;

+import org.eclipse.swt.layout.GridLayout;

+import org.eclipse.swt.widgets.Combo;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Text;

+

+public class GenericCompositeCreator {

+

+	public static Composite create_GridListing_HorizontalGrabbing_Composite(Composite parentComposite, int colnum) {

+		Composite composite = new Composite(parentComposite, SWT.NONE);

+		

+		GridLayout gl = new GridLayout(colnum, false);

+		composite.setLayout(gl);

+		

+		GridData gd = new GridData(SWT.FILL,SWT.FILL, true, false);

+		composite.setLayoutData(gd);

+		

+		return composite;

+	}

+	

+	

+	public static Text createComposite_vertical_label_text(Composite parentComposite, String labeltext) {

+		

+		Composite composite = create_GridListing_HorizontalGrabbing_Composite(parentComposite, 1);

+		

+		Label label_title = new Label(composite, SWT.LEFT);

+		label_title.setText(labeltext);

+		

+		GridData gd = new GridData(SWT.FILL,SWT.FILL, true, false);

+		Text label_content = new Text(composite, SWT.LEFT);

+		label_content.setLayoutData(gd);

+		

+		label_content.setText("...");

+		label_content.setEditable(false);

+		 

+		return label_content;

+	}

+	

+	public static Text createComposite_horizontal_label_text(Composite parentComposite, String labeltext) {

+		

+		Composite composite = create_GridListing_HorizontalGrabbing_Composite(parentComposite, 2);

+		

+		Label label_title = new Label(composite, SWT.LEFT);

+		label_title.setText(labeltext);

+		

+		GridData gd2 = new GridData(SWT.FILL,SWT.FILL, true, false);

+		Text label_content = new Text(composite, SWT.LEFT);

+		label_content.setLayoutData(gd2);

+		

+		label_content.setText("...");

+		label_content.setEditable(false);

+		 

+		return label_content;

+	}

+	

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/SymbexWorkflowView.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/SymbexWorkflowView.java
new file mode 100644
index 0000000..958262c
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/SymbexWorkflowView.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr
+ *   - Initial API and Implementation
+ *******************************************************************************/
+package org.eclipse.efm.ui.views;
+
+
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.part.*;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.*;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.efm.ui.views.mitems.ManagerLinker;
+import org.eclipse.efm.ui.views.symbexworkflow_viewpart.collapsible_composites.AnalysisProfileCompositeCreator;
+import org.eclipse.efm.ui.views.symbexworkflow_viewpart.collapsible_composites.StopCriteriaCompositeCreator;
+
+
+public class SymbexWorkflowView extends AbstractSymbexWorkflowView {
+
+	/**
+	 * The ID of the view as specified by the extension.
+	 */
+	public static final String ID = "org.eclipse.efm.ui.views.SymbexWorkflowView";
+	
+	private ManagerLinker mLinker;
+	
+	private GridLayout gl_shell;
+	
+	private ILaunchConfiguration selectedLC;
+	
+	private Text text_model_file_path;
+	private Text text_model_file_path2;
+	
+	class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
+		public String getColumnText(Object obj, int index) {
+			return getText(obj);
+		}
+		public Image getColumnImage(Object obj, int index) {
+			return getImage(obj);
+		}
+		public Image getImage(Object obj) {
+			return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
+		}
+	}
+	
+	/**
+	 * The constructor.
+	 */
+	public SymbexWorkflowView() {
+		mLinker = new ManagerLinker();
+		}
+
+	/**
+	 * This is a callback that will allow us
+	 * to create the viewer and initialize it.
+	 */
+	public void createPartControl(Composite parent) {
+		parentComposite = parent;
+		
+		selfCreatedMainComposite = GenericCompositeCreator.create_GridListing_HorizontalGrabbing_Composite(parentComposite, 1);
+				
+
+		createContents();
+		//viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+		
+		//viewer.setContentProvider(ArrayContentProvider.getInstance());
+		//viewer.setInput(new String[] { "One", "Two", "Three" });
+		//String[] contents = mLinker.getSymbexRunConfigurationNames();
+
+		//viewer.setInput(contents);
+		
+		//viewer.setLabelProvider(new ViewLabelProvider());
+		//getSite().setSelectionProvider(viewer);
+		makeActions();
+		//hookContextMenu();
+		//hookDoubleClickAction();
+		contributeToActionBars();
+		
+		
+		
+	}
+	
+	private void addSeparator() {
+		Label label = new Label(selfCreatedMainComposite, SWT.LEFT);
+		label.setText("==========");
+	}
+	
+	private void createContents() {
+
+		Label label = new Label(selfCreatedMainComposite, SWT.LEFT);
+		label.setText("Selected Run Configuration");
+		
+		Combo combo = new Combo(selfCreatedMainComposite, SWT.READ_ONLY);
+		String[] contents = mLinker.getSymbexRunConfigurationNames();
+		combo.setItems(contents);
+		
+		addSeparator();
+		
+		text_model_file_path = GenericCompositeCreator.createComposite_vertical_label_text(selfCreatedMainComposite, "Model File :");
+		
+		addSeparator();
+		
+		text_model_file_path2 = GenericCompositeCreator.createComposite_horizontal_label_text(selfCreatedMainComposite, "Model File :");
+		
+		addSeparator();
+		StopCriteriaCompositeCreator sccc = new StopCriteriaCompositeCreator(mLinker, combo);
+		sccc.addComposite(selfCreatedMainComposite);
+		
+		addSeparator();
+		AnalysisProfileCompositeCreator apcc = new AnalysisProfileCompositeCreator(mLinker, combo);
+		apcc.addComposite(selfCreatedMainComposite);
+		
+		combo.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int index = combo.getSelectionIndex();
+				if (index != -1) {
+					String text = mLinker.getSymbexRunConfigurations()[index].getName();
+					text_model_file_path.setText(text);
+					text_model_file_path2.setText(text);
+				}
+			}
+		});
+	}
+	
+	
+	
+
+	private void makeActions() {
+		Action action1 = new Action() {
+			public void run() {
+				showMessage("Action 1 executed");
+			}
+		};
+		action1.setText("Action 1");
+		action1.setToolTipText("Action 1 tooltip");
+		action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+			getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+		
+		Action action2 = new Action() {
+			public void run() {
+				showMessage("Action 2 executed");
+			}
+		};
+		action2.setText("Action 2");
+		action2.setToolTipText("Action 2 tooltip");
+		action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+				getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+		
+		actions = (new Action[] {action1, action2});
+	}
+
+}
diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/gitems/TreeObject.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/gitems/TreeObject.java
new file mode 100644
index 0000000..38cb636
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/gitems/TreeObject.java
@@ -0,0 +1,54 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.gitems;

+

+import org.eclipse.core.resources.IResource;

+

+public class TreeObject {

+

+	private String name;

+	private TreeParent parent;

+	private IResource resource;

+	

+	public TreeObject(String name) {

+		this.name = name;

+	}

+	

+	public String getName() {

+		return this.name;

+	}

+	

+	public void setParent(TreeParent parent) {

+		this.parent = parent;

+	}

+	

+	public TreeParent getParent() {

+		return parent;

+	}

+	

+	public String toString() {

+		return getName();

+	}

+	

+	public Object getAdapter(Class key) {

+		return null;

+	}

+	

+	protected IResource getResource() {

+		return resource;

+	}

+	

+	protected void setResource(IResource resource) {

+		this.resource = resource;

+	}

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/gitems/TreeParent.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/gitems/TreeParent.java
new file mode 100644
index 0000000..f4f3e4c
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/gitems/TreeParent.java
@@ -0,0 +1,43 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.gitems;

+

+import java.util.ArrayList;

+

+public class TreeParent extends TreeObject {

+

+	private ArrayList<TreeObject> children;

+

+	public TreeParent(String name) {

+		super(name);

+		this.children = new ArrayList<TreeObject>();

+	}

+	

+	public void addChild(TreeObject child) {

+		children.add(child);

+		child.setParent(this);

+	}

+	

+	public void removeChild(TreeObject child) {

+		children.remove(child);

+		child.setParent(null);

+	}

+	

+	public TreeObject[] getChildren() {

+		return (TreeObject[]) children.toArray(new TreeObject[children.size()]);

+	}

+	

+	public boolean hasChildren() {

+		return children.size() > 0;

+	}

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/mitems/ManagerLinker.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/mitems/ManagerLinker.java
new file mode 100644
index 0000000..7bdd4e8
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/mitems/ManagerLinker.java
@@ -0,0 +1,61 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.mitems;

+

+import org.eclipse.core.runtime.CoreException;

+import org.eclipse.debug.core.DebugPlugin;

+import org.eclipse.debug.core.ILaunchConfiguration;

+import org.eclipse.debug.core.ILaunchConfigurationType;

+import org.eclipse.debug.core.ILaunchManager;

+

+public class ManagerLinker {

+	

+	private ILaunchManager lc_manager;

+	

+	private String SYMBEX_LAUNCH_CONFIGURATION_ID = "org.eclipse.efm.runconfiguration.launchConfigurationType";

+	private ILaunchConfigurationType lc_symbex_type;

+	

+	public ILaunchConfiguration[] getSymbexRunConfigurations() {

+		lc_manager = DebugPlugin.getDefault().getLaunchManager();

+		lc_symbex_type = lc_manager.getLaunchConfigurationType(SYMBEX_LAUNCH_CONFIGURATION_ID);

+		ILaunchConfiguration[] lcs;

+		try {

+			lcs = lc_manager.getLaunchConfigurations(lc_symbex_type);

+		} catch (CoreException e) {

+			e.printStackTrace();

+			lcs = new ILaunchConfiguration[0];

+		}

+		return lcs;

+//            for (ILaunchConfiguration iLaunchConfiguration : lcs) {

+//                if (iLaunchConfiguration.getName().equals("Test PThread")) {

+//                    ILaunchConfigurationWorkingCopy t = iLaunchConfiguration.getWorkingCopy();

+//                    ILaunchConfiguration config = t.doSave();

+//                    if (config != null) {

+//                        // config.launch(ILaunchManager.RUN_MODE, null);

+//                        DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);

+//                    }

+//                }

+//            }

+		

+	}

+	

+	public String[] getSymbexRunConfigurationNames() {

+		ILaunchConfiguration[] lcs = getSymbexRunConfigurations();

+		String[] contents = new String[lcs.length];

+		for (int i=0; i<lcs.length; i++) {

+			contents[i] = lcs[i].getName();

+		}

+		return contents;

+	}

+	

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/mitems/SymbexContentProvider.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/mitems/SymbexContentProvider.java
new file mode 100644
index 0000000..c9c6f0f
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/mitems/SymbexContentProvider.java
@@ -0,0 +1,71 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.mitems;

+

+import org.eclipse.efm.ui.views.SymbexWorkflowView;

+import org.eclipse.efm.ui.views.gitems.*;

+

+import org.eclipse.jface.viewers.ITreeContentProvider;

+import org.eclipse.jface.viewers.Viewer;

+

+

+

+class SymbexContentProvider implements ITreeContentProvider {

+

+	private SymbexWorkflowView parentView;

+	

+	public SymbexContentProvider(SymbexWorkflowView parentView) {

+		this.parentView = parentView;

+	}

+	

+	

+	public void inputChanged(Viewer v, Object oldInput, Object newInput){} 

+	

+	public void dispose() {}

+	

+	@Override

+	public Object[] getElements(Object parent) {

+//		if (parent.equals(parentView.getViewSite())) {

+//			if (parentView.invisibleRoot == null) {

+//				parentView.initialize();

+//			}

+//			return getChidlren(parentView.invisibleRoot);

+//		}

+		return getChildren(parent);

+	}

+	

+	@Override

+	public Object getParent(Object child) {

+		if (child instanceof TreeObject) {

+			return ((TreeObject) child).getParent();

+		}

+		return null;

+	}

+	

+	@Override

+	public Object[] getChildren(Object parent) {

+		if (parent instanceof TreeParent) {

+			return ((TreeParent) parent).getChildren();

+		}

+		return new Object[0];

+	}

+

+	@Override

+	public boolean hasChildren(Object parent) {

+		if (parent instanceof TreeParent) {

+			return ((TreeParent) parent).hasChildren();

+		}

+		return false;

+	}

+

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/AnalysisProfileCompositeCreator.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/AnalysisProfileCompositeCreator.java
new file mode 100644
index 0000000..60df9e4
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/AnalysisProfileCompositeCreator.java
@@ -0,0 +1,54 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.symbexworkflow_viewpart.collapsible_composites;

+

+import org.eclipse.efm.ui.views.GenericCompositeCreator;

+import org.eclipse.efm.ui.views.mitems.ManagerLinker;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.events.SelectionAdapter;

+import org.eclipse.swt.events.SelectionEvent;

+import org.eclipse.swt.widgets.Combo;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Text;

+

+public class AnalysisProfileCompositeCreator extends CollapsibleCompositeCreator {

+

+	private Text ana_profile;

+	private Text ana_strategy;

+	

+	public AnalysisProfileCompositeCreator(ManagerLinker ml, Combo combo) {

+		super(ml, combo);

+	}

+	

+	public void addComposite(Composite parentComposite) {

+		addComposite_internal(parentComposite, "Analysis");

+	}

+

+	@Override

+	protected void addCollapsedContent() {

+		ana_profile = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Profile :");

+		ana_strategy = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Strategy :");

+	}

+

+	@Override

+	protected void updateCollapsedContent() {

+		int index = combo.getSelectionIndex();

+		if (index != -1) {

+			String text = ml.getSymbexRunConfigurations()[index].getName();

+			

+			ana_profile.setText(text);

+			ana_strategy.setText(text);

+		}

+	}

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/CollapsibleCompositeCreator.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/CollapsibleCompositeCreator.java
new file mode 100644
index 0000000..164648c
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/CollapsibleCompositeCreator.java
@@ -0,0 +1,119 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.symbexworkflow_viewpart.collapsible_composites;

+

+import org.eclipse.efm.ui.views.GenericCompositeCreator;

+import org.eclipse.efm.ui.views.mitems.ManagerLinker;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.events.SelectionAdapter;

+import org.eclipse.swt.events.SelectionEvent;

+import org.eclipse.swt.layout.GridData;

+import org.eclipse.swt.layout.GridLayout;

+import org.eclipse.swt.widgets.Combo;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Text;

+import org.eclipse.ui.ISharedImages;

+import org.eclipse.ui.PlatformUI;

+import org.eclipse.swt.widgets.Button;

+

+public abstract class CollapsibleCompositeCreator {

+

+	Combo combo;

+	Composite parentComposite;

+	Composite composite;

+	Composite collapsible_part;

+	GridData collapsible_gd;

+	Button button_collapse;

+	ManagerLinker ml; 

+	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();

+	

+	public CollapsibleCompositeCreator(ManagerLinker ml, Combo combo) {

+		this.ml = ml;

+		this.combo = combo;

+	}

+	

+	public abstract void addComposite(Composite parentComposite);

+	

+	protected void addComposite_internal(Composite parentComposite, String title) {

+		this.parentComposite = parentComposite;

+		composite = GenericCompositeCreator.create_GridListing_HorizontalGrabbing_Composite(parentComposite, 1);

+		

+		Composite titlecomposite = GenericCompositeCreator.create_GridListing_HorizontalGrabbing_Composite(composite, 2);

+		

+		Label label_title = new Label(titlecomposite, SWT.LEFT);

+		label_title.setText("     " + title);

+		

+		button_collapse = new Button(titlecomposite, SWT.RIGHT);

+		button_collapse.setImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO).createImage());

+		

+		collapsible_part = GenericCompositeCreator.create_GridListing_HorizontalGrabbing_Composite(composite, 1);

+		collapsible_gd = (GridData) collapsible_part.getLayoutData();

+		collapsible_gd.exclude = !collapsible_gd.exclude;

+		

+		addCollapsedContent();

+		collapsible_part.setVisible(!collapsible_gd.exclude);

+		repackParentComposite();

+		

+		button_collapse.addSelectionListener(new SelectionAdapter() {

+

+			public void widgetSelected(SelectionEvent e) {

+				collapsible_gd.exclude = !collapsible_gd.exclude;

+				collapsible_part.setVisible(!collapsible_gd.exclude);

+				repackParentComposite();

+				if (collapsible_gd.exclude) {

+					button_collapse.setImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO).createImage());

+				} else {

+					button_collapse.setImage(sharedImages.getImageDescriptor(ISharedImages.IMG_ELCL_COLLAPSEALL).createImage());

+				}

+				updateCollapsedContent();

+			}

+		});

+		

+		combo.addSelectionListener(new SelectionAdapter() {

+			@Override

+			public void widgetSelected(SelectionEvent e) {

+				updateCollapsedContent();

+			}

+		});

+	}

+		

+	private void repackParentComposite() {

+//		GridLayout parentgridlayout = (GridLayout) composite.getParent().getLayout();

+//		GridData parentgriddata = (GridData) composite.getParent().getLayoutData();

+//		composite.getParent().pack();

+//		composite.getParent().setLayout(parentgridlayout);

+//		composite.getParent().setLayoutData(parentgriddata);

+		//parentComposite.pack();

+		//parentComposite.computeSize(SWT.FILL, SWT.FILL, true);

+		

+		//parentComposite.setSize(parentComposite.computeSize(SWT.FILL, SWT.FILL, true));

+		//parentComposite.setSize(parentComposite.computeSize(SWT.FILL, SWT.FILL, true));

+		//parentComposite.setSize(parentComposite.computeSize(SWT.FILL, SWT.DEFAULT, true));

+		//parentComposite.pack(true);

+		int width = parentComposite.getSize().x;

+		parentComposite.pack();

+		int height = parentComposite.getSize().y;

+		

+		parentComposite.setSize(width, height);

+//		GridLayout gl = new GridLayout(1, false);

+//		parentComposite.setLayout(gl);

+//		

+		//GridData gd = new GridData(SWT.FILL,SWT.FILL, true, false);

+//		parentComposite.setLayoutData(gd);

+	}

+	

+	protected abstract void addCollapsedContent();

+	

+	protected abstract void updateCollapsedContent();

+}

diff --git a/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/StopCriteriaCompositeCreator.java b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/StopCriteriaCompositeCreator.java
new file mode 100644
index 0000000..eee6cf8
--- /dev/null
+++ b/gui/org.eclipse.efm.ui.views/src/org/eclipse/efm/ui/views/symbexworkflow_viewpart/collapsible_composites/StopCriteriaCompositeCreator.java
@@ -0,0 +1,72 @@
+/*******************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  Erwan Mahe (CEA LIST) erwan.mahe@cea.fr

+ *   - Initial API and Implementation

+ *******************************************************************************/

+package org.eclipse.efm.ui.views.symbexworkflow_viewpart.collapsible_composites;

+

+import org.eclipse.efm.ui.views.GenericCompositeCreator;

+import org.eclipse.efm.ui.views.mitems.ManagerLinker;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.events.SelectionAdapter;

+import org.eclipse.swt.events.SelectionEvent;

+import org.eclipse.swt.widgets.Combo;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Text;

+

+public class StopCriteriaCompositeCreator extends CollapsibleCompositeCreator {

+

+	private Text gslim_nodes;

+	private Text gslim_width;

+	private Text gslim_height;

+	

+	private Text evalim_steps;

+	private Text evalim_timeout;

+	

+	public StopCriteriaCompositeCreator(ManagerLinker ml, Combo combo) {

+		super(ml, combo);

+	}

+	

+	public void addComposite(Composite parentComposite) {

+		addComposite_internal(parentComposite, "Stop Criteria");

+	}

+

+	@Override

+	protected void addCollapsedContent() {

+		Label label_graphsize = new Label(collapsible_part, SWT.LEFT);

+		label_graphsize.setText("Graph size limits");

+		

+		gslim_nodes = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Nodes :");

+		gslim_width = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Width :");

+		gslim_height = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Height :");

+	

+		Label label_evalimit = new Label(collapsible_part, SWT.LEFT);

+		label_evalimit.setText("Evaluation Limits");

+		

+		evalim_steps = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Steps :");

+		evalim_timeout = GenericCompositeCreator.createComposite_horizontal_label_text(collapsible_part, "Timeout :");

+	}

+

+	@Override

+	protected void updateCollapsedContent() {

+		int index = combo.getSelectionIndex();

+		if (index != -1) {

+			String text = ml.getSymbexRunConfigurations()[index].getName();

+			

+			gslim_nodes.setText(text);

+			gslim_width.setText(text);

+			gslim_height.setText(text);

+			

+			evalim_steps.setText(text);

+			evalim_timeout.setText(text);

+		}

+	}

+}

diff --git a/gui/org.eclipse.efm.ui/plugin.xml b/gui/org.eclipse.efm.ui/plugin.xml
index 22453f4..7da6e2e 100644
--- a/gui/org.eclipse.efm.ui/plugin.xml
+++ b/gui/org.eclipse.efm.ui/plugin.xml
@@ -120,7 +120,7 @@
          </view>
          <view
                closeable="true"
-               id="org.eclipse.ui.views.TaskList"
+               id="org.eclipse.efm.ui.views.SymbexWorkflowView"
                minimized="false"
                moveable="true"
                ratio="0.7"