JBoss Tools SVN: r30053 - trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-03-26 10:18:09 -0400 (Sat, 26 Mar 2011)
New Revision: 30053
Modified:
trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java
Log:
JBIDE-7583 Add tests for org.jboss.tools.runtime plugin
Modified: trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java 2011-03-26 01:51:17 UTC (rev 30052)
+++ trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java 2011-03-26 14:18:09 UTC (rev 30053)
@@ -31,124 +31,195 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
*
* @author snjeza
- *
+ *
*/
public class RuntimeDetectionTest {
- @Test
- public void testRuntimeDetectors() {
- Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
- assertTrue("Runtime detectors don't exist.",detectors.size() > 0);
+ @BeforeClass
+ public static void create() {
+ addRuntimePaths();
+ createRuntimes();
}
-
- @Test
- public void testRuntimePaths() {
- List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
- assertTrue("There are initial runtime paths.", runtimePaths.size() == 0);
- }
-
- @Test
- public void addRuntimePaths() {
- List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
- String[] paths = { IRuntimeDetectionConstants.JBOSS_42_HOME, IRuntimeDetectionConstants.JBOSS_51_HOME,
- IRuntimeDetectionConstants.SEAM_20_HOME, IRuntimeDetectionConstants.SEAM_22_HOME,
- IRuntimeDetectionConstants.EAP_43_HOME};
-
+
+ private static void addRuntimePaths() {
+ List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault()
+ .getRuntimePaths();
+ String[] paths = { IRuntimeDetectionConstants.JBOSS_42_HOME,
+ IRuntimeDetectionConstants.JBOSS_51_HOME,
+ IRuntimeDetectionConstants.SEAM_20_HOME,
+ IRuntimeDetectionConstants.SEAM_22_HOME,
+ IRuntimeDetectionConstants.EAP_43_HOME };
+
for (String path : paths) {
assertTrue(path != null);
File file = new File(path);
- assertTrue("The '" + path + "' path isn't valid.", file.isDirectory());
+ assertTrue("The '" + path + "' path isn't valid.",
+ file.isDirectory());
RuntimePath runtimePath = new RuntimePath(path);
runtimePaths.add(runtimePath);
}
RuntimeUIActivator.getDefault().saveRuntimePaths();
runtimePaths = null;
- runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
- assertTrue("runtimePaths.size()\nExpected: 5\nWas: " + runtimePaths.size(), runtimePaths.size() == 5);
List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
- Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
- for( IRuntimeDetector detector:detectors) {
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+ .getRuntimeDetectors();
+ for (IRuntimeDetector detector : detectors) {
if (detector.isEnabled()) {
detector.initializeRuntimes(serverDefinitions);
}
}
- assertTrue("serverDefinitions.size()\nExpected: 0\nWas: " + serverDefinitions.size(), serverDefinitions.size() == 0);
+ assertTrue("serverDefinitions.size()\nExpected: 0\nWas: "
+ + serverDefinitions.size(), serverDefinitions.size() == 0);
}
-
- @Test
- public void createRuntimes() {
+
+ private static void createRuntimes() {
JBossRuntimeLocator locator = new JBossRuntimeLocator();
- List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault().getRuntimePaths();
+ List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault()
+ .getRuntimePaths();
for (RuntimePath runtimePath : runtimePaths) {
List<ServerDefinition> serverDefinitions = locator
- .searchForRuntimes(runtimePath.getPath(), new NullProgressMonitor());
+ .searchForRuntimes(runtimePath.getPath(),
+ new NullProgressMonitor());
runtimePath.getServerDefinitions().clear();
for (ServerDefinition serverDefinition : serverDefinitions) {
serverDefinition.setRuntimePath(runtimePath);
}
- runtimePath.getServerDefinitions()
- .addAll(serverDefinitions);
+ runtimePath.getServerDefinitions().addAll(serverDefinitions);
}
- List<ServerDefinition> serverDefinitions = RuntimeUIActivator.getDefault().getServerDefinitions();
- assertTrue("serverDefinitions.size()\nExpected: >0\nWas: " + serverDefinitions.size(), serverDefinitions.size() > 0);
- Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
- for( IRuntimeDetector detector:detectors) {
+ List<ServerDefinition> serverDefinitions = RuntimeUIActivator
+ .getDefault().getServerDefinitions();
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+ .getRuntimeDetectors();
+ for (IRuntimeDetector detector : detectors) {
if (detector.isEnabled()) {
detector.initializeRuntimes(serverDefinitions);
}
}
}
-
+
@Test
- public void testSeamRuntimes() {
- SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance().getRuntimes();
- assertTrue("seamRuntimes.length\nExpected: 4\nWas: " + seamRuntimes.length, seamRuntimes.length == 4);
- boolean seam20Exists = false;
- boolean seam22Exists = false;
- boolean seam12Exists = false;
- for(SeamRuntime seamRuntime:seamRuntimes) {
+ public void testRuntimeDetectors() {
+ Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+ .getRuntimeDetectors();
+ assertTrue("Runtime detectors don't exist.", detectors.size() > 0);
+ }
+
+ @Test
+ public void testRuntimePaths() {
+ List<RuntimePath> runtimePaths = RuntimeUIActivator.getDefault()
+ .getRuntimePaths();
+ assertTrue(
+ "runtimePaths.size()\nExpected: 5\nWas: " + runtimePaths.size(),
+ runtimePaths.size() == 5);
+ }
+
+ @Test
+ public void testServerDefinitions() {
+ List<ServerDefinition> serverDefinitions = RuntimeUIActivator
+ .getDefault().getServerDefinitions();
+ assertTrue("serverDefinitions.size()\nExpected: 5\nWas: "
+ + serverDefinitions.size(), serverDefinitions.size() == 5);
+ }
+
+ @Test
+ public void testSeam22() {
+ SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance()
+ .getRuntimes();
+ int count = 0;
+ for (SeamRuntime seamRuntime : seamRuntimes) {
SeamVersion version = seamRuntime.getVersion();
+ if (SeamVersion.SEAM_2_2.equals(version)) {
+ count++;
+ }
+ }
+ assertTrue("Seam 2.2\nExpected: 1\nWas: " + count, count == 1);
+ }
+
+ @Test
+ public void testSeam20() {
+ SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance()
+ .getRuntimes();
+ int count = 0;
+ for (SeamRuntime seamRuntime : seamRuntimes) {
+ SeamVersion version = seamRuntime.getVersion();
if (SeamVersion.SEAM_2_0.equals(version)) {
- seam20Exists = true;
+ count++;
}
- if (SeamVersion.SEAM_2_2.equals(version)) {
- seam22Exists = true;
- }
+ }
+ assertTrue("Seam 2.0\nExpected: 2\nWas: " + count, count == 2);
+ }
+
+ @Test
+ public void testSeam12() {
+ SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance()
+ .getRuntimes();
+ int count = 0;
+ for (SeamRuntime seamRuntime : seamRuntimes) {
+ SeamVersion version = seamRuntime.getVersion();
if (SeamVersion.SEAM_1_2.equals(version)) {
- seam12Exists = true;
+ count++;
}
}
- assertTrue("Seam 2.0 Runtime isn't created.", seam20Exists);
- assertTrue("Seam 2.2 Runtime isn't created.", seam22Exists);
- assertTrue("Seam 1.2 Runtime isn't created.", seam12Exists);
+ assertTrue("Seam 1.2\nExpected: 1\nWas: " + count, count == 1);
}
-
+
@Test
- public void testWtpRuntimes() {
+ public void testSeamRuntimes() {
+ SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance()
+ .getRuntimes();
+ assertTrue("seamRuntimes.length\nExpected: 4\nWas: "
+ + seamRuntimes.length, seamRuntimes.length == 4);
+ }
+
+ @Test
+ public void testJBossAs42() {
IRuntime[] runtimes = ServerCore.getRuntimes();
- assertTrue("runtimes.length\nExpected: 3\nWas: " + runtimes.length, runtimes.length == 3);
- boolean as42Exists = false;
- boolean as51Exists = false;
- boolean eap43Exists = false;
- for(IRuntime runtime:runtimes) {
+ int count = 0;
+ for (IRuntime runtime : runtimes) {
IRuntimeType runtimeType = runtime.getRuntimeType();
if (IJBossToolingConstants.AS_42.equals(runtimeType.getId())) {
- as42Exists = true;
+ count++;
}
+ }
+ assertTrue("JBoss AS 4.2\nExpected: 1\nWas: " + count, count == 1);
+ }
+
+ @Test
+ public void testJBossAs51() {
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ int count = 0;
+ for (IRuntime runtime : runtimes) {
+ IRuntimeType runtimeType = runtime.getRuntimeType();
if (IJBossToolingConstants.AS_51.equals(runtimeType.getId())) {
- as51Exists = true;
+ count++;
}
+ }
+ assertTrue("JBoss AS 5.1\nExpected: 1\nWas: " + count, count == 1);
+ }
+
+ @Test
+ public void testJBossEap43() {
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ int count = 0;
+ for (IRuntime runtime : runtimes) {
+ IRuntimeType runtimeType = runtime.getRuntimeType();
if (IJBossToolingConstants.EAP_43.equals(runtimeType.getId())) {
- eap43Exists = true;
+ count++;
}
}
- assertTrue("JBoss AS 4.2 Runtime isn't created.", as42Exists);
- assertTrue("JBoss AS 5.1 Runtime isn't created.", as51Exists);
- assertTrue("JBoss EAP 4.3 Runtime isn't created.", eap43Exists);
+ assertTrue("JBoss EAP 4.3\nExpected: 1\nWas: " + count, count == 1);
}
+
+ @Test
+ public void testWtpRuntimes() {
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ assertTrue("runtimes.length\nExpected: 3\nWas: " + runtimes.length,
+ runtimes.length == 3);
+ }
}
13 years, 10 months
JBoss Tools SVN: r30052 - in trunk/cdi/plugins/org.jboss.tools.cdi.core: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-25 21:51:17 -0400 (Fri, 25 Mar 2011)
New Revision: 30052
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/schema/
trunk/cdi/plugins/org.jboss.tools.cdi.core/schema/cdiextensions.exsd
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/ICDIExtension.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2011-03-26 00:13:47 UTC (rev 30051)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2011-03-26 01:51:17 UTC (rev 30052)
@@ -28,6 +28,7 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: JBoss by Red Hat
Export-Package: org.jboss.tools.cdi.core,
+ org.jboss.tools.cdi.core.extension,
org.jboss.tools.cdi.core.preferences,
org.jboss.tools.cdi.internal.core.ca,
org.jboss.tools.cdi.internal.core.el,
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2011-03-26 00:13:47 UTC (rev 30051)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2011-03-26 01:51:17 UTC (rev 30052)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
+ <extension-point id="cdiextensions" name="CDI Extensions" schema="schema/cdiextensions.exsd"/>
<extension
id="cdibuilder"
@@ -175,4 +176,4 @@
</exclude>
</validator>
</extension>
-</plugin>
\ No newline at end of file
+</plugin>
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/schema/cdiextensions.exsd
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/schema/cdiextensions.exsd (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/schema/cdiextensions.exsd 2011-03-26 01:51:17 UTC (rev 30052)
@@ -0,0 +1,116 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.cdi.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.cdi.core" id="cdiextensions" name="CDI Extensions"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="cdiextension" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="cdiextension">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Fully qualified name of implementation of CDIExtension interface representing in JBoss Tools CDI model an extension of CDI runtime model.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.cdi.core.extension.ICDIExtension"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="runtime" type="string" use="required">
+ <annotation>
+ <documentation>
+ Fully qualified name of implementation of CDI runtime extension. The names are listed in files /META-INF/services/javax.enterprise.inject.spi.Extension
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="features" type="string">
+ <annotation>
+ <documentation>
+ Comma separated list of ids of features supported by this cdi extension. This is an optimisation parameter that allows to access at a specific feature request only instances of extensions registered for that feature.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/schema/cdiextensions.exsd
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2011-03-26 00:13:47 UTC (rev 30051)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2011-03-26 01:51:17 UTC (rev 30052)
@@ -28,6 +28,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.extension.CDIExtensionManager;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.DefinitionContext;
import org.jboss.tools.cdi.internal.core.impl.definition.ParametedTypeFactory;
@@ -63,6 +64,8 @@
Set<CDICoreNature> dependsOn = new HashSet<CDICoreNature>();
Set<CDICoreNature> usedBy = new HashSet<CDICoreNature>();
+
+ private CDIExtensionManager extensions = new CDIExtensionManager(this);
public CDICoreNature() {
definitions.setProject(this);
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java 2011-03-26 01:51:17 UTC (rev 30052)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.extension;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.osgi.framework.Bundle;
+
+public class CDIExtensionFactory {
+ static CDIExtensionFactory factory = null;
+ public static String POINT_ID = "org.jboss.tools.cdi.core.cdiextensions";
+
+ public static CDIExtensionFactory getInstance() {
+ if(factory == null) {
+ factory = new CDIExtensionFactory();
+ }
+ return factory;
+ }
+
+ /**
+ * Maps CDI runtime fully qualified names of extension implementations to JBoss Tools CDI Model fully
+ * qualified names of implementations of ICDIExtention.
+ */
+ private Map<String, Set<String>> runtimeToDesign = new HashMap<String, Set<String>>();
+
+ /**
+ * Maps features to fully qualified names of implementations of ICDIExtention.
+ */
+ Map<String, Set<String>> featureToDesign = new HashMap<String, Set<String>>();
+
+ /**
+ * Maps fully qualified names of implementations of ICDIExtention to their Class objects.
+ */
+ Map<String, Class<? extends ICDIExtension>> designToClass = new HashMap<String, Class<? extends ICDIExtension>>();
+
+ private CDIExtensionFactory() {
+ load();
+ }
+
+ private void load() {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID);
+ IConfigurationElement[] cs = point.getConfigurationElements();
+ for (IConfigurationElement c: cs) {
+ String runtime = c.getAttribute("runtime");
+ String cls = c.getAttribute("class");
+ ICDIExtension extension = null;
+ try {
+ extension = (ICDIExtension)c.createExecutableExtension("class");
+ } catch (CoreException e) {
+ CDICorePlugin.getDefault().logError(e);
+ continue;
+ }
+ if(extension == null) continue;
+
+ designToClass.put(cls, extension.getClass());
+
+ Set<String> classes = runtimeToDesign.get(runtime);
+ if(classes == null) {
+ classes = new HashSet<String>();
+ runtimeToDesign.put(runtime, classes);
+ }
+ classes.add(cls);
+
+ String features = c.getAttribute("features");
+ StringTokenizer st = new StringTokenizer(features, ",");
+ while(st.hasMoreTokens()) {
+ String feature = st.nextToken();
+ classes = featureToDesign.get(feature);
+ if(classes == null) {
+ classes = new HashSet<String>();
+ featureToDesign.put(feature, classes);
+ }
+ classes.add(cls);
+ }
+ }
+ }
+
+ public Set<String> getExtensionClassesByRuntime(String qualifiedName) {
+ return runtimeToDesign.get(qualifiedName);
+ }
+
+ public ICDIExtension createExtensionInstance(String qualifiedName) {
+ Class<? extends ICDIExtension> cls = designToClass.get(qualifiedName);
+ if(cls != null) {
+ try {
+ return cls.newInstance();
+ } catch (InstantiationException e1) {
+ CDICorePlugin.getDefault().logError(e1);
+ } catch (IllegalAccessException e2) {
+ CDICorePlugin.getDefault().logError(e2);
+ }
+ }
+
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-03-26 01:51:17 UTC (rev 30052)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.extension;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDICoreNature;
+
+public class CDIExtensionManager {
+ CDICoreNature n;
+ Set<String> runtimes = new HashSet<String>();
+
+ Map<String, ICDIExtension> instances = new HashMap<String, ICDIExtension>();
+ Map<String, Set<ICDIExtension>> featureToExtensions = new HashMap<String, Set<ICDIExtension>>();
+
+ public CDIExtensionManager(CDICoreNature n) {
+ this.n = n;
+ }
+
+ public void setRuntimes(Set<String> runtimes) {
+ Set<String> addedRuntimes = new HashSet<String>();
+ Set<String> deletedRuntimes = new HashSet<String>();
+ for (String runtime: this.runtimes) {
+ if(!runtimes.contains(runtime)) {
+ deletedRuntimes.add(runtime);
+ }
+ }
+ for (String runtime: runtimes) {
+ if(!this.runtimes.contains(runtime)) {
+ addedRuntimes.add(runtime);
+ }
+ }
+
+ for (String runtime: deletedRuntimes) {
+ runtimes.remove(runtime);
+ Set<String> clss = CDIExtensionFactory.getInstance().getExtensionClassesByRuntime(runtime);
+ for (String cls: clss) {
+ ICDIExtension ext = instances.remove(cls);
+ if(ext != null) {
+ String[] is = featureToExtensions.keySet().toArray(new String[0]);
+ for (String feature: is) {
+ Set<ICDIExtension> es = featureToExtensions.get(feature);
+ if(es != null) {
+ es.remove(ext);
+ if(es.isEmpty()) featureToExtensions.remove(feature);
+ }
+ }
+ }
+ }
+ }
+
+ for (String runtime: addedRuntimes) {
+ runtimes.add(runtime);
+ Set<String> clss = CDIExtensionFactory.getInstance().getExtensionClassesByRuntime(runtime);
+ for (String cls: clss) {
+ ICDIExtension ext = CDIExtensionFactory.getInstance().createExtensionInstance(cls);
+ if(ext == null) continue;
+ //TODO initialize ext object.
+ instances.put(cls, ext);
+ Map<String, Set<String>> featureToDesign = CDIExtensionFactory.getInstance().featureToDesign;
+ for (String feature: featureToDesign.keySet()) {
+ if(featureToDesign.get(feature).contains(cls)) {
+ Set<ICDIExtension> es = featureToExtensions.get(feature);
+ if(es == null) {
+ es = new HashSet<ICDIExtension>();
+ featureToExtensions.put(feature, es);
+ }
+ es.add(ext);
+ }
+ }
+ }
+ }
+
+ }
+
+ static Set<ICDIExtension> EMPTY = new HashSet<ICDIExtension>();
+
+ public Set<ICDIExtension> getExtensions(String feature) {
+ return featureToExtensions.containsKey(feature) ? featureToExtensions.get(feature) : EMPTY;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/ICDIExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/ICDIExtension.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/ICDIExtension.java 2011-03-26 01:51:17 UTC (rev 30052)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.extension;
+
+/**
+ * This object represents CDI runtime extension in JBoss Tools CDI model.
+ * It is not necessarily one to one mapping between CDI runtime extension implementation classes
+ * and JBoss Tools CDI model extension implementation classes.
+ * Mapping is set by Eclipse extension point 'org.jboss.tools.cdi.core.cdiextensions'
+ * where attribute 'id' is assigned to a CDI runtime extension implementation class qualified name
+ * and attribute 'class' is assigned to a JBoss Tools CDI model extension implementation class
+ * qualified name.
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface ICDIExtension {
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/ICDIExtension.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 10 months
JBoss Tools SVN: r30051 - trunk/runtime/tests/org.jboss.tools.runtime.test.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-03-25 20:13:47 -0400 (Fri, 25 Mar 2011)
New Revision: 30051
Modified:
trunk/runtime/tests/org.jboss.tools.runtime.test/pom.xml
trunk/runtime/tests/org.jboss.tools.runtime.test/requirements.properties
Log:
JBIDE-7583 Add tests for org.jboss.tools.runtime plugin
Modified: trunk/runtime/tests/org.jboss.tools.runtime.test/pom.xml
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.test/pom.xml 2011-03-25 21:10:55 UTC (rev 30050)
+++ trunk/runtime/tests/org.jboss.tools.runtime.test/pom.xml 2011-03-26 00:13:47 UTC (rev 30051)
@@ -21,8 +21,6 @@
<artifactId>maven-osgi-test-plugin</artifactId>
<version>${tychoVersion}</version>
<configuration>
- <useUIThread>false</useUIThread>
- <useUIHarness>true</useUIHarness>
<testSuite>org.jboss.tools.runtime.test</testSuite>
<testClass>org.jboss.tools.runtime.test.RuntimeDetectionAllTests</testClass>
</configuration>
Modified: trunk/runtime/tests/org.jboss.tools.runtime.test/requirements.properties
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.test/requirements.properties 2011-03-25 21:10:55 UTC (rev 30050)
+++ trunk/runtime/tests/org.jboss.tools.runtime.test/requirements.properties 2011-03-26 00:13:47 UTC (rev 30051)
@@ -1 +1 @@
-requirements=jbossas,seam-2.0.1.GA,seam-2.2.0.GA,jbeap
\ No newline at end of file
+requirements=jbossas,seam-2.0.1.GA,seam-2.2.0.GA,jbeap,eapseamgen,seamfp
\ No newline at end of file
13 years, 10 months
JBoss Tools SVN: r30050 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/views/cloudelements and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-25 17:10:55 -0400 (Fri, 25 Mar 2011)
New Revision: 30050
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
Log:
[JBIDE-7551] implemented 3 sorting states and sorting arrows shown in the columns
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-25 19:56:53 UTC (rev 30049)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-25 21:10:55 UTC (rev 30050)
@@ -1,5 +1,12 @@
2011-03-25 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
+ (switchDirection):
+ (setSortIndicator):
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java (ColumnListener.widgetSelected):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java (ColumnListener.widgetSelected):
+ [JBIDE-7551] implemented 3 sorting states and sorting arrows shown in the columns
+
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
(NewInstanceWizard):
(addPages):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-25 19:56:53 UTC (rev 30049)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-25 21:10:55 UTC (rev 30050)
@@ -140,12 +140,12 @@
TableViewerColumnComparator comparator = (TableViewerColumnComparator) viewer.getComparator();
Table t = viewer.getTable();
if (comparator.getColumn() == column) {
- comparator.reverseDirection();
+ comparator.switchDirection();
}
comparator.setColumn(column);
+ comparator.setSortIndicator(viewer);
TableColumn tc = (TableColumn) e.getSource();
t.setSortColumn(tc);
- t.setSortDirection(SWT.NONE);
viewer.refresh();
}
};
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java 2011-03-25 19:56:53 UTC (rev 30049)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java 2011-03-25 21:10:55 UTC (rev 30050)
@@ -15,6 +15,8 @@
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Table;
/**
* A viewer comparator that compares labels in a column of a table.<br>
@@ -52,10 +54,31 @@
return column;
}
- public void reverseDirection() {
- direction *= -1;
+ public void switchDirection() {
+ if (direction == -1) {
+ direction = 0;
+ } else if (direction == 1) {
+ direction = -1;
+ } else if (direction == 0) {
+ direction = 1;
+ }
}
+ public void setSortIndicator(TableViewer tableViewer) {
+ Table table = tableViewer.getTable();
+ switch(direction) {
+ case -1:
+ table.setSortDirection(SWT.UP);
+ break;
+ case 0:
+ table.setSortDirection(SWT.NONE);
+ break;
+ case 1:
+ table.setSortDirection(SWT.DOWN);
+ break;
+ }
+ }
+
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
int tmp = compareByColumn(viewer, e1, e2);
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2011-03-25 19:56:53 UTC (rev 30049)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2011-03-25 21:10:55 UTC (rev 30050)
@@ -104,15 +104,14 @@
TableViewerColumnComparator comparator = (TableViewerColumnComparator) viewer.getComparator();
Table t = viewer.getTable();
if (comparator.getColumn() == column) {
- comparator.reverseDirection();
+ comparator.switchDirection();
}
comparator.setColumn(column);
+ comparator.setSortIndicator(viewer);
TableColumn tc = (TableColumn) e.getSource();
t.setSortColumn(tc);
- t.setSortDirection(SWT.NONE);
viewer.refresh();
}
-
};
public FindImagePage(DeltaCloud cloud) {
13 years, 10 months
JBoss Tools SVN: r30049 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-25 15:56:53 -0400 (Fri, 25 Mar 2011)
New Revision: 30049
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java
Log:
[JBIDE-7772] renamed internal method to reflect its purpose
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java 2011-03-25 19:46:49 UTC (rev 30048)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java 2011-03-25 19:56:53 UTC (rev 30049)
@@ -35,13 +35,13 @@
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
- createImagesFilter(cloud, HandlerUtil.getActiveShell(event));
+ openManageKeysWizard(cloud, HandlerUtil.getActiveShell(event));
}
return Status.OK_STATUS;
}
- private void createImagesFilter(final DeltaCloud cloud, final Shell shell) {
+ private void openManageKeysWizard(final DeltaCloud cloud, final Shell shell) {
if (cloud != null) {
Display.getDefault().asyncExec(new Runnable() {
@Override
13 years, 10 months
JBoss Tools SVN: r30048 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-25 15:46:49 -0400 (Fri, 25 Mar 2011)
New Revision: 30048
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromSpecificImageHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/cnf/CloudViewActionUtil.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
Log:
[JBIDE-8633] loading images and querying a particular image in the background now
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-25 18:46:38 UTC (rev 30047)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-25 19:46:49 UTC (rev 30048)
@@ -1,3 +1,20 @@
+2011-03-25 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
+ (NewInstanceWizard):
+ (addPages):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java
+ (PROPERTY_IMAGE_ID):
+ (NewInstancePageModel):
+ (initImageId):
+ (setImageId):
+ (setImage):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
+ (NewInstancePage):
+ (bindImage):
+ * src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromSpecificImageHandler.java (createInstance):
+ [JBIDE-8633] loading images and querying a particular image in the background now
+
2011-03-23 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromSpecificImageHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromSpecificImageHandler.java 2011-03-25 18:46:38 UTC (rev 30047)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromSpecificImageHandler.java 2011-03-25 19:46:49 UTC (rev 30048)
@@ -45,7 +45,7 @@
private void createInstance(DeltaCloudImage deltaCloudImage, Shell shell) {
if (deltaCloudImage != null) {
DeltaCloud deltaCloud = deltaCloudImage.getDeltaCloud();
- IWizard wizard = new NewInstanceWizard(deltaCloud, deltaCloudImage);
+ IWizard wizard = new NewInstanceWizard(deltaCloud, deltaCloudImage.getId());
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/cnf/CloudViewActionUtil.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/cnf/CloudViewActionUtil.java 2011-03-25 18:46:38 UTC (rev 30047)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/cnf/CloudViewActionUtil.java 2011-03-25 19:46:49 UTC (rev 30048)
@@ -161,7 +161,7 @@
public static void showCreateInstanceWizard(Shell shell, ISelection selection) {
DeltaCloudImage deltaCloudImage = WorkbenchUtils.getFirstAdaptedElement(selection, DeltaCloudImage.class);
DeltaCloud deltaCloud = WorkbenchUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
- IWizard wizard = new NewInstanceWizard(deltaCloud, deltaCloudImage);
+ IWizard wizard = new NewInstanceWizard(deltaCloud, deltaCloudImage.getId());
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-03-25 18:46:38 UTC (rev 30047)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-03-25 19:46:49 UTC (rev 30048)
@@ -31,7 +31,6 @@
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.Assert;
@@ -106,7 +105,6 @@
private static final String PROPERTIES_LABEL = "Properties.label"; //$NON-NLS-1$
private static final String MUST_ENTER_A_NAME = "ErrorMustProvideName.text"; //$NON-NLS-1$
private static final String MUST_ENTER_A_KEYNAME = "ErrorMustProvideKeyName.text"; //$NON-NLS-1$
- private static final String MUST_ENTER_IMAGE_ID = "ErrorMustProvideImageId.text"; //$NON-NLS-1$
private static final String LOADING_VALUE = "Loading.value"; //$NON-NLS-1$
private static final String IMAGE_ID_NOT_FOUND = "ErrorImageIdNotFound.text"; //$NON-NLS-1$
private static final String SHOW_SSH2_PREFS = "ShowSSH2Preferences.label"; //$NON-NLS-1$
@@ -122,7 +120,6 @@
private Combo hardwareCombo;
private Map<String, ProfilePage> profilePages = new HashMap<String, ProfilePage>();
private StackLayout groupContainerStackLayout;
-
private Group groupContainer;
private SelectionListener manageListener = new SelectionAdapter() {
@@ -156,11 +153,11 @@
}
};
- public NewInstancePage(DeltaCloud cloud, DeltaCloudImage image) {
+ public NewInstancePage(DeltaCloud cloud, String imageId) {
super(WizardMessages.getString(NAME));
this.cloud = cloud;
String defaultKeyname = cloud.getLastKeyname();
- model = new NewInstancePageModel(defaultKeyname, image, cloud); //$NON-NLS-1$
+ model = new NewInstancePageModel(defaultKeyname, imageId, cloud); //$NON-NLS-1$
setDescription(WizardMessages.getString(DESCRIPTION));
setTitle(WizardMessages.getString(TITLE));
setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
@@ -495,56 +492,26 @@
}
private IObservableValue bindImage(Text imageText, DataBindingContext dbc) {
- UpdateValueStrategy widgetToModelUpdateStrategy = new UpdateValueStrategy();
- ImageLabel2DeltaCloudImageConverter imageConverter = new ImageLabel2DeltaCloudImageConverter();
- widgetToModelUpdateStrategy.setConverter(imageConverter);
- widgetToModelUpdateStrategy.setAfterGetValidator(
- new MandatoryStringValidator(WizardMessages.getString(MUST_ENTER_IMAGE_ID)));
- widgetToModelUpdateStrategy.setAfterConvertValidator(new DeltaCloudImageValidator());
+ IObservableValue imageTextObservable = WidgetProperties.text(SWT.Modify).observeDelayed(IMAGE_CHECK_DELAY,
+ imageText);
- UpdateValueStrategy modelToTextUpdateStrategy = new UpdateValueStrategy();
- modelToTextUpdateStrategy.setConverter(new DeltaCloudImage2LabelConverter());
+ dbc.bindValue(
+ imageTextObservable,
+ BeanProperties.value(
+ NewInstancePageModel.class, NewInstancePageModel.PROPERTY_IMAGE_ID).observe(model));
- Binding imageBinding = dbc.bindValue(
- WidgetProperties.text(SWT.Modify).observeDelayed(IMAGE_CHECK_DELAY, imageText),
- BeanProperties.value(NewInstancePageModel.class, NewInstancePageModel.PROPERTY_IMAGE).observe(model),
- widgetToModelUpdateStrategy,
- modelToTextUpdateStrategy);
- ControlDecorationSupport.create(imageBinding, SWT.LEFT | SWT.TOP);
- return imageConverter.getImageObservable();
- }
+ IObservableValue modelImageObservable =
+ BeanProperties.value(NewInstancePageModel.PROPERTY_IMAGE).observe(model);
+ Binding modelImageBinding = dbc.bindValue(
+ imageTextObservable,
+ modelImageObservable,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy()
+ .setAfterGetValidator(new DeltaCloudImageValidator())
+ .setConverter(new DeltaCloudImage2LabelConverter()));
- private class ImageLabel2DeltaCloudImageConverter extends Converter {
-
- private WritableValue imageObservable = new WritableValue();
-
- public ImageLabel2DeltaCloudImageConverter() {
- super(String.class, DeltaCloudImage.class);
- }
-
- @Override
- public Object convert(Object fromObject) {
- Assert.isLegal(fromObject instanceof String);
- String id = (String) fromObject;
- DeltaCloudImage image = null;
- if (id != null) {
- image = getImage(id);
- }
- imageObservable.setValue(image);
- return image;
- }
-
- private DeltaCloudImage getImage(String id) {
- try {
- return cloud.getImage(id);
- } catch (DeltaCloudException e) {
- return null;
- }
- }
-
- public IObservableValue getImageObservable() {
- return imageObservable;
- }
+ ControlDecorationSupport.create(modelImageBinding, SWT.LEFT | SWT.TOP);
+ return modelImageObservable;
}
private class DeltaCloudImage2LabelConverter extends Converter {
@@ -581,7 +548,6 @@
}
private void asyncGetProfiles(final NewInstancePageModel model, final DeltaCloud cloud) {
- // TODO: internationalize strings
new AbstractCloudElementJob("Get profiles", cloud, CLOUDELEMENT.PROFILES) {
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
try {
@@ -589,7 +555,6 @@
model.setAllProfiles(profiles);
return Status.OK_STATUS;
} catch (DeltaCloudException e) {
- // TODO: internationalize strings
return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
MessageFormat.format("Could not get profiles from cloud {0}", cloud.getName()));
}
@@ -598,7 +563,6 @@
}
private void asyncGetRealms(final NewInstancePageModel model, final DeltaCloud cloud) {
- // TODO: internationalize strings
new AbstractCloudElementJob("Get realms", cloud, CLOUDELEMENT.REALMS) {
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
try {
@@ -614,5 +578,4 @@
}
}.schedule();
}
-
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java 2011-03-25 18:46:38 UTC (rev 30047)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java 2011-03-25 19:46:49 UTC (rev 30048)
@@ -10,14 +10,21 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.widgets.Display;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.ObservableUIPojo;
/**
@@ -29,6 +36,7 @@
public static final String PROPERTY_URL = "url"; //$NON-NLS-1$
public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
public static final String PROPERTY_IMAGE = "image"; //$NON-NLS-1$
+ public static final String PROPERTY_IMAGE_ID = "imageId"; //$NON-NLS-1$
public static final String PROPERTY_ARCH = "arch"; //$NON-NLS-1$
public static final String PROPERTY_REALMS = "realms"; //$NON-NLS-1$
public static final String PROPERTY_SELECTED_REALM_INDEX = "selectedRealmIndex"; //$NON-NLS-1$
@@ -51,13 +59,21 @@
private String storage;
private String memory;
private DeltaCloud cloud;
+ private String imageId;
- protected NewInstancePageModel(String keyId, DeltaCloudImage image, DeltaCloud cloud) {
+ protected NewInstancePageModel(String keyId, String imageId, DeltaCloud cloud) {
this.cloud = cloud;
this.keyId = keyId;
- this.image = image;
+ initImageId(imageId, cloud);
}
+ private void initImageId(String imageId, DeltaCloud cloud) {
+ if (imageId == null) {
+ imageId = cloud.getLastImageId();
+ }
+ setImageId(imageId);
+ }
+
public String getName() {
return name;
}
@@ -74,9 +90,47 @@
firePropertyChange(PROPERTY_IMAGE, this.image, this.image = image);
List<DeltaCloudHardwareProfile> filteredProfiles = filterProfiles(image, allProfiles);
setFilteredProfiles(filteredProfiles);
- setArch(image.getArchitecture());
+ if (image != null) {
+ setArch(image.getArchitecture());
+ }
}
+ public String getImageId() {
+ return imageId;
+ }
+
+ public void setImageId(final String imageId) {
+ firePropertyChange(PROPERTY_IMAGE_ID, this.imageId, this.imageId = imageId);
+ if (imageId == null || imageId.length() == 0) {
+ return;
+ }
+
+ new AbstractCloudElementJob(
+ MessageFormat.format("Getting image {0} from cloud {1}", imageId, cloud.getName()),
+ cloud, CLOUDELEMENT.IMAGES) {
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) throws Exception {
+ try {
+ final DeltaCloudImage image = cloud.getImage(imageId);
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ setImage(image);
+ }
+ });
+ } catch (Exception e) {
+ setImage(null);
+ // do not re-throw exception. DC server 0.1.2 return internal
+ // error 500 when requesting unknown image
+ }
+ return Status.OK_STATUS;
+ }
+
+ }.schedule();
+ }
+
public int getSelectedRealmIndex() {
return realms.indexOf(selectedRealm);
}
@@ -173,7 +227,7 @@
private int getProfileIndex(String selectedProfileId) {
int index = 0;
- if (selectedProfileId != null
+ if (selectedProfileId != null
&& filteredProfiles != null && filteredProfiles.size() > 0) {
for (int i = 0; i < filteredProfiles.size(); i++) {
if (selectedProfileId.equals(filteredProfiles.get(i).getId())) {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2011-03-25 18:46:38 UTC (rev 30047)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2011-03-25 19:46:49 UTC (rev 30048)
@@ -43,26 +43,21 @@
/**
* Initial image, may be null
*/
- private DeltaCloudImage image;
+ private String imageId;
public NewInstanceWizard(DeltaCloud cloud) {
super(cloud);
- try {
- this.image = cloud.getLastImage();
- } catch (DeltaCloudException e) {
- // ignore
- }
}
- public NewInstanceWizard(DeltaCloud cloud, DeltaCloudImage image) {
+ public NewInstanceWizard(DeltaCloud cloud, String imageId) {
this(cloud);
- this.image = image;
+ this.imageId = imageId;
}
@Override
public void addPages() {
setWindowTitle(WizardMessages.getString("NewInstance.title"));
- mainPage = new NewInstancePage(getDeltaCloud(), image);
+ mainPage = new NewInstancePage(getDeltaCloud(), imageId);
addPage(mainPage);
additionalPages = DeltacloudUIExtensionManager.getDefault().loadNewInstanceWizardPages();
for (int i = 0; i < additionalPages.length; i++) {
@@ -70,12 +65,6 @@
}
}
- // @Override
- // public boolean canFinish() {
- // //return mainPage.isPageComplete();
- // return super.canFinish();
- // }
-
@Override
public boolean performFinish() {
NewInstancePageModel model = mainPage.getModel();
13 years, 10 months
JBoss Tools SVN: r30047 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-25 14:46:38 -0400 (Fri, 25 Mar 2011)
New Revision: 30047
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
[JBIDE-8102] now loading all images before querying server for a single image
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-25 18:41:07 UTC (rev 30046)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-25 18:46:38 UTC (rev 30047)
@@ -1,5 +1,13 @@
2011-03-24 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (areImagesLoaded):
+ (imagesRepo):
+ (getImages):
+ (getInstances):
+ (instancesLoaded):
+ (getImage):
+ [JBIDE-8102] now loading all images before querying server for a single image
* src/org/jboss/tools/deltacloud/core/DeltaCloudResourceAction.java (getByName):
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getActions):
[JBIDE-8622] corrected retrieval of available actions for instances
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-03-25 18:41:07 UTC (rev 30046)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-03-25 18:46:38 UTC (rev 30047)
@@ -57,9 +57,11 @@
private DeltaCloudClient client;
- private DeltaCloudImagesRepository imagesRepo;
- private DeltaCloudInstancesRepository instanceRepo;
-
+ private DeltaCloudImagesRepository imagesRepo = new DeltaCloudImagesRepository();
+ private boolean areImagesLoaded = false;
+ private DeltaCloudInstancesRepository instancesRepo = new DeltaCloudInstancesRepository();
+ private boolean areInstancesLoaded = false;
+
private IImageFilter imageFilter;
private IInstanceFilter instanceFilter;
@@ -242,7 +244,7 @@
new InstanceFilter(nameRule, idRule, aliasRule, imageIdRule, ownerIdRule, keyNameRule, realmRule,
profileRule, this);
firePropertyChange(
- PROP_INSTANCES, getInstancesRepository().get(), getInstancesRepository().get());
+ PROP_INSTANCES, instancesRepo.get(), instancesRepo.get());
DeltaCloudManager.getDefault().saveClouds();
}
@@ -254,7 +256,7 @@
this.imageFilter = new ImageFilter(nameRule, idRule, archRule, descRule, this);
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_IMAGES, getImagesRepository().get(), getImagesRepository().get());
+ firePropertyChange(PROP_IMAGES, imagesRepo.get(), imagesRepo.get());
// TODO: move to notification based approach
DeltaCloudManager.getDefault().saveClouds();
}
@@ -290,7 +292,7 @@
public DeltaCloudInstance waitForState(String instanceId, DeltaCloudInstance.State expectedState,
IProgressMonitor pm)
throws InterruptedException, DeltaCloudException {
- DeltaCloudInstance instance = getInstancesRepository().getById(instanceId);
+ DeltaCloudInstance instance = instancesRepo.getById(instanceId);
if (instance != null) {
while (!pm.isCanceled()) {
State state = instance.getState();
@@ -317,15 +319,15 @@
public void loadInstances() throws DeltaCloudException {
try {
clearInstances();
- DeltaCloudInstancesRepository repo = getInstancesRepository();
- DeltaCloudInstance[] oldInstances = repo.get();
+ DeltaCloudInstance[] oldInstances = instancesRepo.get();
List<Instance> instances = client.listInstances();
Collection<DeltaCloudInstance> deltaCloudInstances =
DeltaCloudInstanceFactory.create(instances, this, instanceAliasMappings);
- repo.add(deltaCloudInstances);
+ instancesRepo.add(deltaCloudInstances);
+ areInstancesLoaded = true;
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_INSTANCES, oldInstances, repo.get());
+ firePropertyChange(PROP_INSTANCES, oldInstances, instancesRepo.get());
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(MessageFormat.format(
"Could not load instances of cloud {0}: {1}", getName(), e.getMessage()), e);
@@ -333,6 +335,7 @@
}
private void clearImages() {
+ areImagesLoaded = false;
if (imagesRepo != null) {
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
@@ -345,22 +348,16 @@
}
public boolean instancesLoaded() {
- return instanceRepo == null ? false : true;
+ return areInstancesLoaded;
}
private void clearInstances() {
+ areInstancesLoaded = false;
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_INSTANCES, getInstancesRepository().get(), getInstancesRepository().clear());
+ firePropertyChange(PROP_INSTANCES, instancesRepo.get(), instancesRepo.clear());
}
- private DeltaCloudInstancesRepository getInstancesRepository() {
- if (instanceRepo == null) {
- instanceRepo = new DeltaCloudInstancesRepository();
- }
- return instanceRepo;
- }
-
/**
* Gets the instanceRepo in async manner. The method does not return the
* instanceRepo but notifies observers of the instanceRepo.
@@ -368,21 +365,14 @@
* @throws DeltaCloudException
*/
public DeltaCloudInstance[] getInstances() throws DeltaCloudException {
- if (instanceRepo == null) {
+ if (!areInstancesLoaded) {
loadInstances();
}
- return instanceRepo.get();
+ return instancesRepo.get();
}
- private DeltaCloudImagesRepository getImagesRepository() {
- if (imagesRepo == null) {
- imagesRepo = new DeltaCloudImagesRepository();
- }
- return imagesRepo;
- }
-
public DeltaCloudImage[] getImages() throws DeltaCloudException {
- if (imagesRepo == null) {
+ if (!areImagesLoaded) {
loadImages();
}
return imagesRepo.get();
@@ -398,7 +388,8 @@
* @throws DeltaCloudException
*/
public DeltaCloudImage getImage(String id) throws DeltaCloudException {
- DeltaCloudImage deltaCloudImage = getImagesRepository().getById(id);
+ getImages(); // ensure images are loaded
+ DeltaCloudImage deltaCloudImage = imagesRepo.getById(id);
if (deltaCloudImage == null) {
try {
Image image = client.listImages(id);
@@ -459,10 +450,10 @@
private DeltaCloudInstance refreshInstance(DeltaCloudInstance deltaCloudInstance) throws DeltaCloudException {
try {
- DeltaCloudInstance[] instances = getInstancesRepository().get();
+ DeltaCloudInstance[] instances = instancesRepo.get();
Instance newInstance = client.listInstances(deltaCloudInstance.getId());
deltaCloudInstance.setInstance(newInstance);
- firePropertyChange(PROP_INSTANCES, instances, getInstancesRepository().get());
+ firePropertyChange(PROP_INSTANCES, instances, instancesRepo.get());
return deltaCloudInstance;
} catch (DeltaCloudClientException e) {
// TODO : internationalize strings
@@ -473,7 +464,7 @@
public boolean performInstanceAction(String instanceId, DeltaCloudResourceAction action)
throws DeltaCloudException {
- return performAction(getInstancesRepository().getById(instanceId), action);
+ return performAction(instancesRepo.getById(instanceId), action);
}
protected boolean performAction(DeltaCloudInstance instance, DeltaCloudResourceAction action)
@@ -482,7 +473,7 @@
if (instance == null) {
return false;
}
- DeltaCloudInstancesRepository repo = getInstancesRepository();
+ DeltaCloudInstancesRepository repo = instancesRepo;
DeltaCloudInstance[] instances = repo.get();
boolean result = instance.performAction(action, client);
if (result) {
@@ -528,13 +519,13 @@
public void loadImages() throws DeltaCloudException {
try {
clearImages();
- DeltaCloudImagesRepository repo = getImagesRepository();
- DeltaCloudImage[] oldImages = repo.get();
+ DeltaCloudImage[] oldImages = imagesRepo.get();
Collection<DeltaCloudImage> deltaCloudImages = DeltaCloudImageFactory.create(client.listImages(), this);
- repo.add(deltaCloudImages);
+ imagesRepo.add(deltaCloudImages);
+ areImagesLoaded = true;
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_IMAGES, oldImages, repo.get());
+ firePropertyChange(PROP_IMAGES, oldImages, imagesRepo.get());
} catch (DeltaCloudClientException e) {
clearImages();
throw new DeltaCloudException(
@@ -567,14 +558,13 @@
instance = client.createInstance(name, imageId, profileId, realmId, memory, storage);
}
if (instance != null) {
- DeltaCloudInstancesRepository repo = getInstancesRepository();
- DeltaCloudInstance[] instances = repo.get();
+ DeltaCloudInstance[] instances = instancesRepo.get();
DeltaCloudInstance deltaCloudInstance = DeltaCloudInstanceFactory.create(instance, this, name);
instanceAliasMappings.add(new InstanceAliasMapping(instance.getId(), name));
- repo.add(deltaCloudInstance);
+ instancesRepo.add(deltaCloudInstance);
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_INSTANCES, instances, repo.get());
+ firePropertyChange(PROP_INSTANCES, instances, instancesRepo.get());
// TODO: move to notification based approach
DeltaCloudManager.getDefault().saveClouds();
return deltaCloudInstance;
13 years, 10 months
JBoss Tools SVN: r30046 - in trunk/jst/plugins/org.jboss.tools.jst.web.ui: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-25 14:41:07 -0400 (Fri, 25 Mar 2011)
New Revision: 30046
Removed:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/palette/
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
Log:
JBIDE-8629
https://issues.jboss.org/browse/JBIDE-8629
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2011-03-25 18:39:58 UTC (rev 30045)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2011-03-25 18:41:07 UTC (rev 30046)
@@ -21,7 +21,6 @@
org.jboss.tools.jst.web.ui.wizards.appregister,
org.jboss.tools.jst.web.ui.wizards.links,
org.jboss.tools.jst.web.ui.wizards.newfile,
- org.jboss.tools.jst.web.ui.wizards.palette,
org.jboss.tools.jst.web.ui.wizards.process,
org.jboss.tools.jst.web.ui.wizards.project
Require-Bundle: org.eclipse.ui.ide,
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2011-03-25 18:39:58 UTC (rev 30045)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2011-03-25 18:41:07 UTC (rev 30046)
@@ -508,8 +508,6 @@
class="org.jboss.tools.jst.web.ui.wizards.appregister.AppRegisterWizard"/>
<xclass id="org.jboss.tools.jst.web.ui.wizards.links.HiddenLinksWizard"
class="org.jboss.tools.jst.web.ui.wizards.links.HiddenLinksWizard"/>
- <xclass id="org.jboss.tools.jst.web.ui.wizards.palette.ImportTLDPage"
- class="org.jboss.tools.jst.web.ui.wizards.palette.ImportTLDPage"/>
<xclass id="org.jboss.tools.jst.web.ui.wizards.project.AddProjectTemplateNameView"
class="org.jboss.tools.jst.web.ui.wizards.project.AddProjectTemplateNameView"/>
<xclass id="org.jboss.tools.jst.web.ui.wizards.project.AddProjectTemplatePropertiesView"
13 years, 10 months
JBoss Tools SVN: r30045 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-25 14:39:58 -0400 (Fri, 25 Mar 2011)
New Revision: 30045
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java
Log:
JBIDE-8629
https://issues.jboss.org/browse/JBIDE-8629
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java 2011-03-25 18:39:23 UTC (rev 30044)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java 2011-03-25 18:39:58 UTC (rev 30045)
@@ -184,7 +184,7 @@
}
public String getStepImplementingClass(int stepId) {
- return "org.jboss.tools.jst.web.ui.wizards.palette.ImportTLDPage"; //$NON-NLS-1$
+ return "org.jboss.tools.vpe.ui.palette.wizard.ImportTLDPage"; //$NON-NLS-1$
}
}
13 years, 10 months
JBoss Tools SVN: r30044 - in trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-25 14:39:23 -0400 (Fri, 25 Mar 2011)
New Revision: 30044
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF
Log:
JBIDE-8629
https://issues.jboss.org/browse/JBIDE-8629
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF 2011-03-25 18:38:12 UTC (rev 30043)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF 2011-03-25 18:39:23 UTC (rev 30044)
@@ -4,14 +4,17 @@
Bundle-Name: %pluginName
Bundle-Activator: org.jboss.tools.vpe.ui.palette.PalettePlugin
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.jboss.tools.vpe.ui.palette
+Bundle-SymbolicName: org.jboss.tools.vpe.ui.palette;singleton:=true
Bundle-Localization: plugin
-Export-Package: org.jboss.tools.vpe.ui.palette,org.jboss.tools.vpe.ui.palette.model
+Export-Package: org.jboss.tools.vpe.ui.palette,
+ org.jboss.tools.vpe.ui.palette.model,
+ org.jboss.tools.vpe.ui.palette.wizard
Require-Bundle: org.eclipse.ui.ide,
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.gef,
org.jboss.tools.common.model.ui,
- org.jboss.tools.jst.jsp
+ org.jboss.tools.jst.web,
+ org.jboss.tools.jst.jsp
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Added: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml 2011-03-25 18:39:23 UTC (rev 30044)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension point="org.jboss.tools.common.model.classes">
+ <xclass id="org.jboss.tools.vpe.ui.palette.wizard.ImportTLDPage"
+ class="org.jboss.tools.vpe.ui.palette.wizard.ImportTLDPage"/>
+ </extension>
+</plugin>
+
\ No newline at end of file
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java 2011-03-25 18:39:23 UTC (rev 30044)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.palette.wizard;
+
+import java.beans.PropertyChangeEvent;
+
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
+import org.jboss.tools.common.model.ui.wizards.special.SpecialWizardStep;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.jst.web.tld.URIConstants;
+import org.jboss.tools.jst.web.tld.model.handlers.ImportTLDToPaletteSupport;
+
+public class ImportTLDPage extends SpecialWizardStep {
+ protected ParentGroupComponent parentGroupComponent = new ParentGroupComponent();
+ protected Composite stepControl2;
+ ImportTLDToPaletteSupport importSupport;
+
+ public ImportTLDPage() {
+ parentGroupComponent.setListener(this);
+ }
+
+ public void setSupport(SpecialWizardSupport support, int i) {
+ super.setSupport(support, i);
+ importSupport = (ImportTLDToPaletteSupport)support;
+ parentGroupComponent.setItems((String[])support.getProperties().get("groups")); //$NON-NLS-1$
+ parentGroupComponent.setInitialItem(support.getProperties().getProperty("parent group")); //$NON-NLS-1$
+ }
+
+ public Control createControl(Composite parent) {
+ stepControl2 = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ stepControl2.setLayout(layout);
+ stepControl2.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ stepControl = attributes.createControl(stepControl2);
+ stepControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ String focusAttr = support.getFocusAttribute(id);
+ if(focusAttr != null && attributes.getFieldEditorByName(focusAttr) != null) {
+ attributes.getFieldEditorByName(focusAttr).setFocus();
+ }
+
+ Control pgc = parentGroupComponent.createControl(stepControl2);
+ pgc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ updateFieldEnablement();
+
+ return stepControl2;
+ }
+
+ public void updateFieldEnablement() {
+ super.updateFieldEnablement();
+ parentGroupComponent.updateFieldEnablement();
+ }
+
+ boolean isAdjusting = false;
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if(isAdjusting) return;
+ isAdjusting = true;
+ isDataChanged = true;
+ attributes.store();
+ parentGroupComponent.store(support.getProperties());
+ validate();
+ if(event != null && event.getSource() == attributes.getPropertyEditorAdapterByName("tld")) { //$NON-NLS-1$
+// String path = (String)event.getNewValue();
+ boolean locked = ((DefaultValueAdapter)attributes.getPropertyEditorAdapterByName("tld")).isStoreLocked(); //$NON-NLS-1$
+ if(!locked) {
+ importSupport.onPathModified();
+ String[] as = {"name", URIConstants.DEFAULT_PREFIX, URIConstants.LIBRARY_URI}; //$NON-NLS-1$
+ for (int i = 0; i < as.length; i++)
+ attributes.getPropertyEditorAdapterByName(as[i]).setValue(support.getAttributeValue(0, as[i]));
+ validate();
+ }
+ }
+ updateFieldEnablement();
+ isAdjusting = false;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java 2011-03-25 18:39:23 UTC (rev 30044)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.palette.wizard;
+
+import java.util.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
+
+public class ParentGroupComponent {
+ Composite composite;
+ Button addToExisting;
+ CCombo existingGroup;
+ Button createNewGroup;
+ Text newGroup;
+ ImportTLDPage listener;
+ String[] items = new String[0];
+ String initialItem = null;
+ boolean isAdjusting = false;
+
+ public void setListener(ImportTLDPage listener) {
+ this.listener = listener;
+ }
+
+ public void setItems(String[] items) {
+ this.items = items;
+ if(existingGroup != null && !existingGroup.isDisposed()) {
+ existingGroup.setItems(items);
+ }
+ }
+
+ public void setInitialItem(String item) {
+ initialItem = item;
+ if(initialItem != null && existingGroup != null && !existingGroup.isDisposed()) {
+ existingGroup.setText(item);
+ }
+ }
+
+ public Control createControl(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 5;
+ group.setLayout(layout);
+ Composite c = new Composite(group, SWT.NONE);
+ layout = new GridLayout(2, false);
+ c.setLayout(layout);
+ c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ addToExisting = new Button(c, SWT.RADIO);
+ GridData gd = new GridData();
+ addToExisting.setText(WebUIMessages.ADD_TO_EXISTING_GROUP);
+ addToExisting.setLayoutData(gd);
+ addToExisting.setSelection(true);
+ addToExisting.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ isAdjusting = true;
+ createNewGroup.setSelection(!addToExisting.getSelection());
+ isAdjusting = false;
+ fire();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ existingGroup = new CCombo(c, SWT.READ_ONLY | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ existingGroup.setLayoutData(gd);
+ existingGroup.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
+ existingGroup.setItems(items);
+ if(initialItem != null) existingGroup.setText(initialItem);
+ existingGroup.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ fire();
+ }
+ });
+
+ createNewGroup = new Button(c, SWT.RADIO);
+ createNewGroup.setText(WebUIMessages.CREATE_NEW_GROUP);
+ gd = new GridData();
+ createNewGroup.setLayoutData(gd);
+ createNewGroup.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ isAdjusting = true;
+ addToExisting.setSelection(!createNewGroup.getSelection());
+ isAdjusting = false;
+ fire();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ newGroup = new Text(c, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ newGroup.setLayoutData(gd);
+ newGroup.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ fire();
+ }
+ });
+ composite = group;
+ return composite;
+ }
+
+ protected void fire() {
+ if(!isAdjusting && listener != null) listener.propertyChange(null);
+ }
+
+ public void updateFieldEnablement() {
+ if(addToExisting == null || addToExisting.isDisposed()) return;
+ boolean existing = addToExisting.getSelection();
+ newGroup.setEnabled(!existing);
+ existingGroup.setEnabled(existing);
+ }
+
+ public void store(Properties p) {
+ p.setProperty("parent group", getValue()); //$NON-NLS-1$
+ }
+
+ public String getValue() {
+ if(addToExisting == null || addToExisting.isDisposed()) return ""; //$NON-NLS-1$
+ boolean existing = addToExisting.getSelection();
+ String s = (existing) ? existingGroup.getText() : newGroup.getText();
+ return (s == null) ? "" : s; //$NON-NLS-1$
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 10 months