Skip to content
This repository
Browse code

1. Added org.semanticsoft.vaaclipse.additions project with some

additions for vaaclipse projects. Currently there are Show View dialog
and action.
2. OptionDialog improved.
  • Loading branch information...
commit 0bcc765c623dd90e7f1caae45c326c787c1deda8 1 parent d69838f
Rushan Gilmullin authored January 05, 2013

Showing 28 changed files with 371 additions and 21 deletions. Show diff stats Hide diff stats

  1. 7  org.semanticsoft.vaaclipse.additions/.classpath
  2. 28  org.semanticsoft.vaaclipse.additions/.project
  3. 7  org.semanticsoft.vaaclipse.additions/.settings/org.eclipse.jdt.core.prefs
  4. 3  org.semanticsoft.vaaclipse.additions/.settings/org.eclipse.pde.core.prefs
  5. 17  org.semanticsoft.vaaclipse.additions/META-INF/MANIFEST.MF
  6. BIN  ...emanticsoft.vaaclipse.additions/bin/org/semanticsoft/vaaclipse/additions/view/ShowViewDialogContent$1.class
  7. BIN  org.semanticsoft.vaaclipse.additions/bin/org/semanticsoft/vaaclipse/additions/view/ShowViewDialogContent.class
  8. BIN  org.semanticsoft.vaaclipse.additions/bin/org/semanticsoft/vaaclipse/additions/view/ShowViewHandler.class
  9. 4  org.semanticsoft.vaaclipse.additions/build.properties
  10. 200  org.semanticsoft.vaaclipse.additions/src/org/semanticsoft/vaaclipse/additions/view/ShowViewDialogContent.java
  11. 52  org.semanticsoft.vaaclipse.additions/src/org/semanticsoft/vaaclipse/additions/view/ShowViewHandler.java
  12. 3  ...ft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/engine/GenericPresentationEngine.java
  13. 6  ...oft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/engine/VaadinPresentationEngine.java
  14. 2  ....vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
  15. BIN  ...anticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/NewApplicationWizardPage$4.class
  16. BIN  ...emanticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/NewApplicationWizardPage.class
  17. BIN  org.semanticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/PluginContentPage.class
  18. BIN  org.semanticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/TemplateOperation.class
  19. 28  org.semanticsoft.vaaclipsedemo.cassandra.app/Application.e4xmi
  20. 3  org.semanticsoft.vaaclipsedemo.cassandra.app/META-INF/MANIFEST.MF
  21. 1  org.semanticsoft.vaaclipsedemo.cassandra.app/cassandra.product
  22. 9  ...oft.vaaclipsedemo.cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/views/PackageExplorer.java
  23. 2  ...sedemo.mediaplayer/src/org/semanticsoft/vaaclipsedemo/mediaplayer/handlers/medialib/AddMediaEntryBasic.java
  24. BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog$1.class
  25. BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog$2.class
  26. BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog$ComponentProvider.class
  27. BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog.class
  28. 20  org.semanticsoft.vaadin/src/org/semanticsoft/vaadin/optiondialog/OptionDialog.java
7  org.semanticsoft.vaaclipse.additions/.classpath
... ...
@@ -0,0 +1,7 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<classpath>
  3
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
  4
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
  5
+	<classpathentry kind="src" path="src"/>
  6
+	<classpathentry kind="output" path="bin"/>
  7
+</classpath>
28  org.semanticsoft.vaaclipse.additions/.project
... ...
@@ -0,0 +1,28 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<projectDescription>
  3
+	<name>org.semanticsoft.vaaclipse.additions</name>
  4
+	<comment></comment>
  5
+	<projects>
  6
+	</projects>
  7
+	<buildSpec>
  8
+		<buildCommand>
  9
+			<name>org.eclipse.jdt.core.javabuilder</name>
  10
+			<arguments>
  11
+			</arguments>
  12
+		</buildCommand>
  13
+		<buildCommand>
  14
+			<name>org.eclipse.pde.ManifestBuilder</name>
  15
+			<arguments>
  16
+			</arguments>
  17
+		</buildCommand>
  18
+		<buildCommand>
  19
+			<name>org.eclipse.pde.SchemaBuilder</name>
  20
+			<arguments>
  21
+			</arguments>
  22
+		</buildCommand>
  23
+	</buildSpec>
  24
+	<natures>
  25
+		<nature>org.eclipse.pde.PluginNature</nature>
  26
+		<nature>org.eclipse.jdt.core.javanature</nature>
  27
+	</natures>
  28
+</projectDescription>
7  org.semanticsoft.vaaclipse.additions/.settings/org.eclipse.jdt.core.prefs
... ...
@@ -0,0 +1,7 @@
  1
+eclipse.preferences.version=1
  2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  3
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
  4
+org.eclipse.jdt.core.compiler.compliance=1.7
  5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  6
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  7
+org.eclipse.jdt.core.compiler.source=1.7
3  org.semanticsoft.vaaclipse.additions/.settings/org.eclipse.pde.core.prefs
... ...
@@ -0,0 +1,3 @@
  1
+eclipse.preferences.version=1
  2
+pluginProject.extensions=false
  3
+resolve.requirebundle=false
17  org.semanticsoft.vaaclipse.additions/META-INF/MANIFEST.MF
... ...
@@ -0,0 +1,17 @@
  1
+Manifest-Version: 1.0
  2
+Bundle-ManifestVersion: 2
  3
+Bundle-Name: Additions
  4
+Bundle-SymbolicName: org.semanticsoft.vaaclipse.additions
  5
+Bundle-Version: 1.0.0.M1
  6
+Bundle-Vendor: Rusha Gilmullin
  7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
  8
+Export-Package: org.semanticsoft.vaaclipse.additions.view
  9
+Import-Package: javax.annotation
  10
+Require-Bundle: javax.inject;bundle-version="1.0.0",
  11
+ org.eclipse.e4.core.di;bundle-version="1.1.0",
  12
+ org.eclipse.e4.ui.model.workbench;bundle-version="0.10.1",
  13
+ org.eclipse.e4.core.contexts;bundle-version="1.1.0",
  14
+ org.semanticsoft.vaadin;bundle-version="1.0.0",
  15
+ org.eclipse.e4.ui.workbench;bundle-version="0.10.100",
  16
+ com.vaadin;bundle-version="6.8.1",
  17
+ org.semanticsoft.vaaclipse.publicapi;bundle-version="1.0.0"
BIN  ...nticsoft.vaaclipse.additions/bin/org/semanticsoft/vaaclipse/additions/view/ShowViewDialogContent$1.class
Binary file not shown
BIN  ...manticsoft.vaaclipse.additions/bin/org/semanticsoft/vaaclipse/additions/view/ShowViewDialogContent.class
Binary file not shown
BIN  org.semanticsoft.vaaclipse.additions/bin/org/semanticsoft/vaaclipse/additions/view/ShowViewHandler.class
Binary file not shown
4  org.semanticsoft.vaaclipse.additions/build.properties
... ...
@@ -0,0 +1,4 @@
  1
+source.. = src/
  2
+output.. = bin/
  3
+bin.includes = META-INF/,\
  4
+               .
200  ...emanticsoft.vaaclipse.additions/src/org/semanticsoft/vaaclipse/additions/view/ShowViewDialogContent.java
... ...
@@ -0,0 +1,200 @@
  1
+/**
  2
+ * 
  3
+ */
  4
+package org.semanticsoft.vaaclipse.additions.view;
  5
+
  6
+import java.util.HashMap;
  7
+import java.util.HashSet;
  8
+import java.util.List;
  9
+import java.util.Map;
  10
+import java.util.Set;
  11
+
  12
+import javax.annotation.PostConstruct;
  13
+import javax.inject.Inject;
  14
+
  15
+import org.eclipse.e4.core.contexts.IEclipseContext;
  16
+import org.eclipse.e4.ui.model.application.MApplication;
  17
+import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
  18
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
  19
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
  20
+import org.semanticsoft.vaaclipse.publicapi.resources.BundleResource;
  21
+import org.semanticsoft.vaadin.optiondialog.OptionDialog;
  22
+import org.semanticsoft.vaadin.optiondialog.OptionDialog.ComponentProvider;
  23
+
  24
+import com.vaadin.data.Item;
  25
+import com.vaadin.data.util.HierarchicalContainer;
  26
+import com.vaadin.event.ItemClickEvent;
  27
+import com.vaadin.terminal.ThemeResource;
  28
+import com.vaadin.ui.Component;
  29
+import com.vaadin.ui.Panel;
  30
+import com.vaadin.ui.Tree;
  31
+import com.vaadin.ui.Tree.TreeDragMode;
  32
+
  33
+
  34
+/**
  35
+ * @author rushan
  36
+ *
  37
+ */
  38
+class ShowViewDialogContent implements ComponentProvider
  39
+{
  40
+	private static final String NAME_PROP = "name";
  41
+	private static final String ICON_PROP = "icon";
  42
+	private static final String OBJECT_PROP = "object";
  43
+	
  44
+	final private static String CATEGORY_TAG = "categoryTag:";
  45
+	final private static int CATEGORY_TAG_LENGTH = CATEGORY_TAG.length();
  46
+	
  47
+	private Tree tree;
  48
+	private Panel panel;
  49
+	private HierarchicalContainer container;
  50
+	private OptionDialog optionDialog;
  51
+	
  52
+//	private Map<Integer, MPartDescriptor> descriptorsMap = new HashMap<Integer, MPartDescriptor>();
  53
+	
  54
+	@Inject
  55
+	private EPartService partService;
  56
+	
  57
+	@Inject
  58
+	private MApplication application;
  59
+	
  60
+	@Inject
  61
+	IEclipseContext context;
  62
+	
  63
+	@Override
  64
+	public Component getComponent(OptionDialog optionDialog)
  65
+	{
  66
+		this.optionDialog = optionDialog;
  67
+		return this.panel;
  68
+	}
  69
+	
  70
+	@PostConstruct
  71
+	public void init()
  72
+	{
  73
+		panel = new Panel();
  74
+		createTree();
  75
+	}
  76
+	
  77
+	@Override
  78
+	public void optionSelected(OptionDialog optionDialog, int optionId)
  79
+	{
  80
+		if (optionId == 0)
  81
+		{
  82
+			Object selected = tree.getValue();
  83
+			if (selected instanceof MPartDescriptor)
  84
+			{
  85
+				optionDialog.close();
  86
+				
  87
+				MPartDescriptor descriptor = (MPartDescriptor)selected;
  88
+				showView(descriptor);
  89
+			}
  90
+		}
  91
+		else if (optionId == 1)
  92
+			optionDialog.close();
  93
+	}
  94
+	
  95
+	public void showView(MPartDescriptor... descriptors)
  96
+	{
  97
+		for (MPartDescriptor descriptor : descriptors) 
  98
+		{
  99
+			partService.showPart(descriptor.getElementId(), PartState.ACTIVATE);
  100
+		}
  101
+	}
  102
+	
  103
+	@Override
  104
+	public void setMessage(String message) {}
  105
+	
  106
+	private void createTree()
  107
+	{
  108
+		tree = new Tree();
  109
+		tree.setDragMode(TreeDragMode.NODE);
  110
+		tree.setSizeFull();
  111
+		tree.setImmediate(true);
  112
+		panel.addComponent(tree);
  113
+
  114
+		container = createDataSource();
  115
+		tree.setContainerDataSource(container);
  116
+		
  117
+		// Set tree to show the 'name' property as caption for items
  118
+		tree.setItemCaptionPropertyId(NAME_PROP);
  119
+		tree.setItemIconPropertyId(ICON_PROP);
  120
+		
  121
+		tree.addListener(new ItemClickEvent.ItemClickListener() {
  122
+
  123
+			private static final long serialVersionUID = 1L;
  124
+
  125
+			public void itemClick(final ItemClickEvent event)
  126
+			{
  127
+				if (event.getButton() == ItemClickEvent.BUTTON_LEFT)
  128
+				{
  129
+					Item item = event.getItem();
  130
+					Object object = item.getItemProperty(OBJECT_PROP).getValue();
  131
+					optionDialog.setOptionEnabled(0, object instanceof MPartDescriptor);
  132
+				}
  133
+			}
  134
+		});
  135
+		
  136
+		// Expand whole tree
  137
+		for (Object id : tree.rootItemIds())
  138
+		{
  139
+			tree.expandItemsRecursively(id);
  140
+		}
  141
+	}
  142
+	
  143
+	private void setupCategoryItem(Item categoryItem, String category)
  144
+	{
  145
+		categoryItem.getItemProperty(NAME_PROP).setValue(category);
  146
+		categoryItem.getItemProperty(ICON_PROP).setValue(BundleResource.valueOf("platform:/plugin/org.semanticsoft.vaaclipse.resources/VAADIN/themes/vaaclipse_default_theme/img/folder.png"));
  147
+		categoryItem.getItemProperty(OBJECT_PROP).setValue(category);
  148
+	}
  149
+	
  150
+	private void setupDescriptorItem(Item descriptorItem, MPartDescriptor descriptor)
  151
+	{
  152
+		descriptorItem.getItemProperty(NAME_PROP).setValue(descriptor.getLabel());
  153
+		descriptorItem.getItemProperty(ICON_PROP).setValue(BundleResource.valueOf(descriptor.getIconURI()));
  154
+		descriptorItem.getItemProperty(OBJECT_PROP).setValue(descriptor);
  155
+	}
  156
+
  157
+	private HierarchicalContainer createDataSource()
  158
+	{
  159
+		HierarchicalContainer data = new HierarchicalContainer();
  160
+		
  161
+		data.addContainerProperty(NAME_PROP, String.class, "No Name");
  162
+		data.addContainerProperty(ICON_PROP, ThemeResource.class, null);
  163
+		data.addContainerProperty(OBJECT_PROP, Object.class, null);
  164
+		
  165
+		List<MPartDescriptor> descriptors = application.getDescriptors();
  166
+		Set<String> categoryTags = new HashSet<String>();
  167
+		
  168
+		for (MPartDescriptor descriptor : descriptors) 
  169
+		{
  170
+			List<String> tags = descriptor.getTags();
  171
+			String category = null;
  172
+			boolean isView = false;
  173
+			for (String tag : tags) {
  174
+				if (tag.equals("View"))
  175
+					isView = true;
  176
+				else if (tag.startsWith(CATEGORY_TAG)) {
  177
+					category = tag.substring(CATEGORY_TAG_LENGTH);
  178
+				}
  179
+			}
  180
+			if (isView) {
  181
+				Item descriptorItem = data.addItem(descriptor);
  182
+				setupDescriptorItem(descriptorItem, descriptor);
  183
+				
  184
+				if (category != null)
  185
+				{
  186
+					if (!categoryTags.contains(category))
  187
+					{
  188
+						categoryTags.add(category);
  189
+						Item categoryItem = data.addItem(category);
  190
+						setupCategoryItem(categoryItem, category);	
  191
+					}
  192
+					
  193
+					data.setParent(descriptor, category);
  194
+				}
  195
+			}
  196
+		}
  197
+		
  198
+		return data;
  199
+	}
  200
+}
52  org.semanticsoft.vaaclipse.additions/src/org/semanticsoft/vaaclipse/additions/view/ShowViewHandler.java
... ...
@@ -0,0 +1,52 @@
  1
+/**
  2
+ * 
  3
+ */
  4
+package org.semanticsoft.vaaclipse.additions.view;
  5
+
  6
+import javax.inject.Named;
  7
+
  8
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
  9
+import org.eclipse.e4.core.contexts.IEclipseContext;
  10
+import org.eclipse.e4.core.di.annotations.Execute;
  11
+import org.eclipse.e4.core.di.annotations.Optional;
  12
+import org.eclipse.e4.ui.model.application.MApplication;
  13
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
  14
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
  15
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
  16
+import org.semanticsoft.vaadin.optiondialog.OptionDialog;
  17
+
  18
+import com.vaadin.ui.Window;
  19
+
  20
+/**
  21
+ * @author rushan
  22
+ *
  23
+ */
  24
+public class ShowViewHandler
  25
+{
  26
+	public static final String VIEWS_SHOW_VIEW_PARM_ID = "org.eclipse.ui.views.showView.viewId"; //$NON-NLS-1$
  27
+
  28
+	@Execute
  29
+	public void execute(MWindow window,
  30
+			MApplication application, EPartService partService,
  31
+			IEclipseContext context,
  32
+			@Optional @Named(VIEWS_SHOW_VIEW_PARM_ID) String viewId) {
  33
+		if (viewId != null) {
  34
+			partService.showPart(viewId, PartState.ACTIVATE);
  35
+			return;
  36
+		}
  37
+		
  38
+		OptionDialog dlg = new OptionDialog();
  39
+		dlg.setWidth("350px");
  40
+		dlg.setHeight("500px");
  41
+		dlg.setModal(true);
  42
+		dlg.setCaption("Show View");
  43
+		ShowViewDialogContent componentProvider = ContextInjectionFactory.make(ShowViewDialogContent.class, context);
  44
+		dlg.setComponentProvider(componentProvider);
  45
+		
  46
+		dlg.addOption(0, "OK");
  47
+		dlg.addOption(1, "Cancel");
  48
+		
  49
+		final Window vaadinWindow = (Window) window.getWidget();
  50
+		vaadinWindow.addWindow(dlg);
  51
+	}
  52
+}
3  ...vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/engine/GenericPresentationEngine.java
@@ -545,8 +545,7 @@ public void stop() {
545 545
 			}
546 546
 		}
547 547
 	}
548  
-
549  
-	@PostConstruct
  548
+	
550 549
 	public void postConstruct(IEclipseContext context) {
551 550
 		// Add the presentation engine to the context
552 551
 		context.set(IPresentationEngine.class.getName(), this);
6  ....vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/engine/VaadinPresentationEngine.java
@@ -26,6 +26,12 @@
26 26
 @SuppressWarnings("restriction")
27 27
 public class VaadinPresentationEngine extends GenericPresentationEngine {
28 28
 	
  29
+	
  30
+	public VaadinPresentationEngine()
  31
+	{
  32
+		System.out.println("VPE");
  33
+	}
  34
+	
29 35
 	@Override
30 36
 	public Object run(final MApplicationElement uiRoot, IEclipseContext appContext) {
31 37
 		
2  ...aclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
@@ -541,7 +541,7 @@ private void openOpenPerspectiveWindow()
541 541
 			IndexedContainer container = new IndexedContainer();			
542 542
 			
543 543
 			@Override
544  
-			public Component getComponent()
  544
+			public Component getComponent(OptionDialog optionDialog)
545 545
 			{
546 546
 				if (panel == null)
547 547
 				{
BIN  ...icsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/NewApplicationWizardPage$4.class
Binary file not shown
BIN  ...nticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/NewApplicationWizardPage.class
Binary file not shown
BIN  org.semanticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/PluginContentPage.class
Binary file not shown
BIN  org.semanticsoft.vaaclipse.wizards/bin/org/semanticsoft/vaaclipse/wizards/project/TemplateOperation.class
Binary file not shown
28  org.semanticsoft.vaaclipsedemo.cassandra.app/Application.e4xmi
@@ -56,15 +56,18 @@
56 56
         <children xsi:type="menu:HandledMenuItem" xmi:id="_SeXUEe8EEd6FC9cDb6iV7g" elementId="_SeXUEe8EEd6FC9cDb6iV7g" label="Save All" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/save_all.png" command="_DGvDsOsiEeGZOI_suq-2CQ"/>
57 57
         <children xsi:type="menu:HandledMenuItem" xmi:id="_SeXUE-8EEd6FC9cDb6iV7g" elementId="_SeXUE-8EEd6FC9cDb6iV7g" label="Print" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/print.png" command="_FEAosOsiEeGZOI_suq-2CQ"/>
58 58
       </children>
  59
+      <children xsi:type="menu:Menu" xmi:id="_7fhxAFapEeK_Rb_dwjIffA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.menu.views" label="View">
  60
+        <children xsi:type="menu:DirectMenuItem" xmi:id="_Cr5REFaqEeK_Rb_dwjIffA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.directmenuitem.showView" label="Show View" tooltip="Show View" contributionURI="bundleclass://org.semanticsoft.vaaclipse.additions/org.semanticsoft.vaaclipse.additions.view.ShowViewHandler"/>
  61
+      </children>
59 62
     </mainMenu>
60  
-    <sharedElements xsi:type="basic:Part" xmi:id="__UYwEOr4EeGrI5NvCZeHUA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.packageexplorer" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.PackageExplorer" label="Package Explorer" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/package_explorer.png" closeable="true">
  63
+    <sharedElements xsi:type="basic:Part" xmi:id="__UYwEOr4EeGrI5NvCZeHUA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.packageexplorer" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.PackageExplorer" label="Package Explorer" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/package_explorer.png" tooltip="Package Explorer" closeable="true">
61 64
       <toolbar xmi:id="_tIHZQPSCEeGdUeu8GkJyQQ" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.toolbar.0">
62 65
         <children xsi:type="menu:DirectToolItem" xmi:id="_L8CcoPSHEeGeg4kVMj6Vtg" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.directtoolitem.collapseall" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/collapse_all.png" tooltip="Collapse All" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.handlers.CollapseAll"/>
63 66
         <children xsi:type="menu:DirectToolItem" xmi:id="_2sbBEPSCEeGdUeu8GkJyQQ" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.directtoolitem.linkwitheditor" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/link_to_editor.png" tooltip="Link with Editor" type="Check" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.handlers.LinkWithEditor"/>
64 67
       </toolbar>
65 68
     </sharedElements>
66  
-    <sharedElements xsi:type="basic:Part" xmi:id="_J7teoOr6EeGrI5NvCZeHUA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.outline" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.Outline" label="Outline" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/outline.png" closeable="true"/>
67  
-    <sharedElements xsi:type="basic:Part" xmi:id="_GWHCMOsAEeGrI5NvCZeHUA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.console" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.Console" label="Console" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/console.png" closeable="true"/>
  69
+    <sharedElements xsi:type="basic:Part" xmi:id="_J7teoOr6EeGrI5NvCZeHUA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.outline" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.Outline" label="Outline" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/outline.png" tooltip="Outline" closeable="true"/>
  70
+    <sharedElements xsi:type="basic:Part" xmi:id="_GWHCMOsAEeGrI5NvCZeHUA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.console" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.Console" label="Console" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/console.png" tooltip="Console" closeable="true"/>
68 71
     <sharedElements xsi:type="advanced:Area" xmi:id="_QWERMOsAEeGrI5NvCZeHUA" elementId="org.eclipse.ui.editorss" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/editor_area.png">
69 72
       <children xsi:type="basic:PartStack" xmi:id="_LDFJAMKLAJLAJZKZJZKAWJ" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.partstack.areadefaultstack"/>
70 73
     </sharedElements>
@@ -108,11 +111,22 @@
108 111
     <children xmi:id="_SeXUEO8EEd6FC9cDb6iV7w" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
109 112
     <children xmi:id="_SeXUEO8EEd6FC9cDb6iV7x" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
110 113
   </rootContext>
111  
-  <descriptors xmi:id="_7msNYPk9EeGeg4kVMj6Vtg" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.partdescriptor.0" label="PackageExplorer" tooltip="Package Explorer" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.PackageExplorer">
112  
-    <toolbar xmi:id="_De44sPk-EeGeg4kVMj6Vtg" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.toolbar.0"/>
  114
+  <descriptors xmi:id="_7msNYPk9EeGeg4kVMj6Vtg" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.packageexplorer" label="PackageExplorer" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/package_explorer.png" tooltip="Package Explorer" closeable="true" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.PackageExplorer">
  115
+    <tags>View</tags>
  116
+    <tags>categoryTag:Java</tags>
  117
+    <toolbar xmi:id="_bOr8UFaoEeK_Rb_dwjIffA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.toolbar.0">
  118
+      <children xsi:type="menu:DirectToolItem" xmi:id="_c91lwFaoEeK_Rb_dwjIffA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.directtoolitem.collapseall" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/collapse_all.png" tooltip="Collapse All" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.handlers.CollapseAll"/>
  119
+      <children xsi:type="menu:DirectToolItem" xmi:id="_dsFy4FaoEeK_Rb_dwjIffA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.directtoolitem.linkwitheditor" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/link_to_editor.png" tooltip="Link with Editor" type="Check" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.handlers.LinkWithEditor"/>
  120
+    </toolbar>
  121
+  </descriptors>
  122
+  <descriptors xmi:id="_VPArYPk-EeGeg4kVMj6Vtg" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.outline" label="Outline" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/outline.png" tooltip="Outline" closeable="true" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.Outline">
  123
+    <tags>View</tags>
  124
+    <tags>categoryTag:General</tags>
  125
+  </descriptors>
  126
+  <descriptors xmi:id="_lksfjlskdjflafdlkjlsdf" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.part.console" label="Console" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/console.png" tooltip="Console" closeable="true" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.views.Console">
  127
+    <tags>View</tags>
  128
+    <tags>categoryTag:General</tags>
113 129
   </descriptors>
114  
-  <descriptors xmi:id="_VPArYPk-EeGeg4kVMj6Vtg" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.partdescriptor.1"/>
115  
-  <descriptors xmi:id="_lksfjlskdjflafdlkjlsdf" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.partdescriptor.2"/>
116 130
   <toolBarContributions xmi:id="_Wn6DkBfgEeKmpbrEZ1tscA" elementId="org.semanticsoft.vaaclipsedemo.cassandra.app.toolbarcontribution.0" parentId="org.semanticsoft.vaaclipsedemo.cassandra.toolbar.main" positionInParent="after=org.semanticsoft.vaaclipsedemo.cassandra.toolbar.main.saveall">
117 131
     <children xsi:type="menu:DirectToolItem" xmi:id="_YkAj4BfgEeKmpbrEZ1tscA" elementId="org.semanticsoft.e4test.handledtoolitem.0" iconURI="platform:/plugin/org.semanticsoft.vaaclipsedemo.cassandra.app/img/collapse_all.png" tooltip="igogo" contributionURI="bundleclass://org.semanticsoft.vaaclipsedemo.cassandra.app/org.semanticsoft.vaaclipsedemo.cassandra.app.handlers.CollapseAll"/>
118 132
   </toolBarContributions>
3  org.semanticsoft.vaaclipsedemo.cassandra.app/META-INF/MANIFEST.MF
@@ -26,7 +26,8 @@ Require-Bundle: org.eclipse.core.runtime,
26 26
  org.semanticsoft.e4modelextension;bundle-version="1.0.0",
27 27
  org.eclipse.e4.ui.di;bundle-version="0.10.1",
28 28
  org.semanticsoft.vaaclipse.theme;bundle-version="1.0.0",
29  
- org.semanticsoft.vaaclipse.publicapi;bundle-version="1.0.0"
  29
+ org.semanticsoft.vaaclipse.publicapi;bundle-version="1.0.0",
  30
+ org.semanticsoft.vaaclipse.additions;bundle-version="1.0.0"
30 31
 Import-Package: javax.annotation;version="1.0.0"
31 32
 Bundle-ActivationPolicy: lazy
32 33
 Bundle-Vendor: Rushan R. Gilmullin
1  org.semanticsoft.vaaclipsedemo.cassandra.app/cassandra.product
@@ -84,6 +84,7 @@
84 84
       <plugin id="org.semanticsoft.e4.injector.objectsuppliers"/>
85 85
       <plugin id="org.semanticsoft.e4extension"/>
86 86
       <plugin id="org.semanticsoft.e4modelextension"/>
  87
+      <plugin id="org.semanticsoft.vaaclipse.additions"/>
87 88
       <plugin id="org.semanticsoft.vaaclipse.api"/>
88 89
       <plugin id="org.semanticsoft.vaaclipse.app"/>
89 90
       <plugin id="org.semanticsoft.vaaclipse.behaviour"/>
9  ....vaaclipsedemo.cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/views/PackageExplorer.java
@@ -252,9 +252,12 @@ public void setLinkWithEditor(boolean linkWithEditor)
252 252
 		
253 253
 		if (this.linkWithEditor)
254 254
 		{
255  
-			MInputPart inputPart = (MInputPart) partService.getActivePart();
256  
-			if (inputPart != null)
257  
-				selectTreeNode(inputPart);
  255
+			if (partService.getActivePart() instanceof MInputPart)
  256
+			{
  257
+				MInputPart inputPart = (MInputPart) partService.getActivePart();
  258
+				if (inputPart != null)
  259
+					selectTreeNode(inputPart);	
  260
+			}
258 261
 			
259 262
 			eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, activatePartHandler);
260 263
 		}
2  ...emo.mediaplayer/src/org/semanticsoft/vaaclipsedemo/mediaplayer/handlers/medialib/AddMediaEntryBasic.java
@@ -49,7 +49,7 @@ public void setMessage(String message)
49 49
 		}
50 50
 		
51 51
 		@Override
52  
-		public Component getComponent()
  52
+		public Component getComponent(OptionDialog optionDialog)
53 53
 		{
54 54
 			if (this.layout == null)
55 55
 			{
BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog$1.class
Binary file not shown
BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog$2.class
Binary file not shown
BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog$ComponentProvider.class
Binary file not shown
BIN  org.semanticsoft.vaadin/bin/org/semanticsoft/vaadin/optiondialog/OptionDialog.class
Binary file not shown
20  org.semanticsoft.vaadin/src/org/semanticsoft/vaadin/optiondialog/OptionDialog.java
@@ -22,7 +22,7 @@
22 22
 	
23 23
 	public static interface ComponentProvider extends OptionListener
24 24
 	{
25  
-		Component getComponent();
  25
+		Component getComponent(OptionDialog optionDialog);
26 26
 		void setMessage(String message);
27 27
 	}
28 28
 
@@ -40,7 +40,7 @@ public void setMessage(String message)
40 40
 		}
41 41
 		
42 42
 		@Override
43  
-		public Component getComponent()
  43
+		public Component getComponent(OptionDialog optionDialog)
44 44
 		{
45 45
 			return label;
46 46
 		}
@@ -55,6 +55,7 @@ public void optionSelected(OptionDialog optionDialog, int optionId)
55 55
 	private VerticalLayout content;
56 56
 	private HorizontalLayout buttons = new HorizontalLayout();
57 57
 	private Map<Button, Integer> button2option = new HashMap<Button, Integer>();
  58
+	private Map<Integer, Button> option2button = new HashMap<>();
58 59
 
59 60
 	public OptionDialog()
60 61
 	{
@@ -63,7 +64,7 @@ public OptionDialog()
63 64
 		content = new VerticalLayout();
64 65
 		content.setSizeFull();
65 66
 		this.setContent(content);
66  
-		Component component = componentProvider.getComponent();
  67
+		Component component = componentProvider.getComponent(this);
67 68
 		content.addComponent(component);
68 69
 		content.addComponent(buttons);
69 70
 		content.setComponentAlignment(component, Alignment.TOP_CENTER);
@@ -93,17 +94,17 @@ public ComponentProvider getComponentProvider()
93 94
 	
94 95
 	public Component getComponent()
95 96
 	{
96  
-		return this.componentProvider.getComponent();
  97
+		return this.componentProvider.getComponent(this);
97 98
 	}
98 99
 	
99 100
 	public void setComponentProvider(ComponentProvider componentProvider)
100 101
 	{
101 102
 		if (componentProvider == null)
102 103
 			return;
103  
-		Component newComponent = componentProvider.getComponent();
  104
+		Component newComponent = componentProvider.getComponent(this);
104 105
 		if (newComponent != null)
105 106
 		{
106  
-			Component oldComponent = this.componentProvider.getComponent();
  107
+			Component oldComponent = this.componentProvider.getComponent(this);
107 108
 			this.content.removeComponent(oldComponent);
108 109
 			newComponent.setSizeFull();
109 110
 			this.content.addComponent(newComponent, 0);
@@ -150,6 +151,7 @@ public void addOption(int optionId, String optionText)
150 151
 		button.setCaption(optionText);
151 152
 		buttons.addComponent(button);
152 153
 		button2option.put(button, optionId);
  154
+		option2button.put(optionId, button);
153 155
 		button.addListener(new Button.ClickListener() {
154 156
 
155 157
 			@Override
@@ -164,6 +166,12 @@ public void buttonClick(ClickEvent event)
164 166
 			}
165 167
 		});
166 168
 	}
  169
+	
  170
+	public void setOptionEnabled(int optionId, boolean enabled)
  171
+	{
  172
+		Button button = option2button.get(optionId);
  173
+		button.setEnabled(enabled);
  174
+	}
167 175
 
168 176
 	public static void show(Window parentWindow, String caption, String message, String[] options,
169 177
 			OptionListener optionListener, int w, int h, int units)

0 notes on commit 0bcc765

Please sign in to comment.
Something went wrong with that request. Please try again.