JBoss Tools SVN: r27217 - trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-12-08 03:41:18 -0500 (Wed, 08 Dec 2010)
New Revision: 27217
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
Log:
JBIDE-7832?\239?\188?\154ignore the error for compiling error of ws topdown generation
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-12-07 23:48:00 UTC (rev 27216)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-12-08 08:41:18 UTC (rev 27217)
@@ -43,7 +43,6 @@
this.model = model;
cmdFileName_linux = getCommandLineFileName_linux();
cmdFileName_win = getCommandLineFileName_win();
-
}
@Override
@@ -54,24 +53,16 @@
}
try {
monitor.beginTask("", 100); //$NON-NLS-1$
- monitor
- .subTask(JBossWSCreationCoreMessages.Progress_Message_Generating);
-
+ monitor.subTask(JBossWSCreationCoreMessages.Progress_Message_Generating);
IStatus status = Status.OK_STATUS;
- IProject project = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(model.getWebProjectName());
-
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(model.getWebProjectName());
try {
- String runtimeLocation = JBossWSCreationUtils
- .getJBossWSRuntimeLocation(project);
- String commandLocation = runtimeLocation + Path.SEPARATOR
- + "bin"; //$NON-NLS-1$
+ String runtimeLocation = JBossWSCreationUtils.getJBossWSRuntimeLocation(project);
+ String commandLocation = runtimeLocation + Path.SEPARATOR+ "bin"; //$NON-NLS-1$
IPath path = new Path(commandLocation);
-
List<String> command = new ArrayList<String>();
String[] env = getEnvironmentVariables(project);
-
if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
command.add("cmd.exe"); //$NON-NLS-1$
command.add("/c"); //$NON-NLS-1$
@@ -82,77 +73,44 @@
command.add(cmdFileName_linux);
path = path.append(cmdFileName_linux);
}
-
if (!path.toFile().getAbsoluteFile().exists()) {
- return StatusUtils
- .errorStatus(NLS
- .bind(
- JBossWSCreationCoreMessages.Error_Message_Command_File_Not_Found,
- new String[] { path.toOSString() }));
+ return StatusUtils.errorStatus(NLS.bind(JBossWSCreationCoreMessages.Error_Message_Command_File_Not_Found, new String[] { path.toOSString() }));
}
-
addCommandlineArgs(command);
addCommonArgs(command, project);
- Process proc = DebugPlugin.exec(command
- .toArray(new String[command.size()]), new File(
- commandLocation), env);
+ Process proc = DebugPlugin.exec(command.toArray(new String[command.size()]), new File(commandLocation), env);
StringBuffer errorResult = new StringBuffer();
StringBuffer inputResult = new StringBuffer();
-
convertInputStreamToString(errorResult, proc.getErrorStream());
convertInputStreamToString(inputResult, proc.getInputStream());
-
int exitValue = proc.waitFor();
-
String resultInput = inputResult.toString();
-
if (exitValue != 0) {
-
- JBossWSCreationCorePlugin.getDefault().logError(
- errorResult.toString());
- JBossWSCreationCorePlugin.getDefault().logError(
- inputResult.toString());
-
- // there is no way to know if the failure of invoking is
- // because of failure of
- // compiling or because of failure of generating java code,
- // so try to analyze the
- // output string of the command, if the string contains
- // "javac -d", means the java
- // java code generating is complete.
-
- if (resultInput != null
- && resultInput.indexOf("javac -d") >= 0) {//$NON-NLS-1$
- return StatusUtils
- .warningStatus(errorResult.toString());
+ JBossWSCreationCorePlugin.getDefault().logError(errorResult.toString());
+ JBossWSCreationCorePlugin.getDefault().logError(inputResult.toString());
+ // the resultInput containing "javac -d", means the java
+ // code generating is complete and there is only a javac error.
+ if (resultInput != null && resultInput.indexOf("javac -d") >= 0) {//$NON-NLS-1$
+ return StatusUtils.warningStatus(errorResult.toString());
}
return StatusUtils.errorStatus(errorResult.toString());
} else {
if (resultInput != null) {
+ // there are errors, but not complication error.
+ if (resultInput.indexOf("error") >= 0 && !(resultInput.indexOf("compilation failed") >= 0)) { //$NON-NLS-1$ //$NON-NLS-2$
+ JBossWSCreationCorePlugin.getDefault().logError(resultInput);
+ IStatus errorStatus = StatusUtils.errorStatus(resultInput);
+ status = StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,new CoreException(errorStatus));
+ return status;
+ }
if (resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
- JBossWSCreationCorePlugin.getDefault().logWarning(
- resultInput);
- IStatus errorStatus = StatusUtils
- .warningStatus(resultInput);
- status = StatusUtils
- .warningStatus(
- JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
- new CoreException(errorStatus));
+ JBossWSCreationCorePlugin.getDefault().logWarning(resultInput);
+ IStatus errorStatus = StatusUtils.warningStatus(resultInput);
+ status = StatusUtils.warningStatus(JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code, new CoreException(errorStatus));
}
- if (resultInput.indexOf("error") >= 0) { //$NON-NLS-1$
- JBossWSCreationCorePlugin.getDefault().logError(
- resultInput);
- IStatus errorStatus = StatusUtils
- .errorStatus(resultInput);
- status = StatusUtils
- .errorStatus(
- JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
- new CoreException(errorStatus));
- }
}
}
-
} catch (InterruptedException e) {
JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e);
@@ -164,7 +122,6 @@
JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e);
}
-
return status;
} finally {
refreshProject(model.getWebProjectName(), monitor);
@@ -183,53 +140,39 @@
IJavaProject javaProject = JavaCore.create(project);
if (javaProject == null || !javaProject.exists())
return null;
-
try {
if (!javaProject.isOpen()) {
javaProject.open(null);
}
-
IVMInstall vm = JavaRuntime.getVMInstall(javaProject);
String javaLocation = vm.getInstallLocation().toString();
env = new String[] { JAVA_HOME + "=" + javaLocation }; //$NON-NLS-1$
-
} catch (CoreException e1) {
e1.printStackTrace();
}
}
-
return env;
}
- private void addCommonArgs(List<String> command, IProject project)
- throws Exception {
- String projectRoot = JBossWSCreationUtils.getProjectRoot(
- model.getWebProjectName()).toOSString();
+ private void addCommonArgs(List<String> command, IProject project) throws Exception {
+ String projectRoot = JBossWSCreationUtils.getProjectRoot(model.getWebProjectName()).toOSString();
IJavaProject javaProject = JavaCore.create(project);
-
command.add("-k"); //$NON-NLS-1$
-
command.add("-s"); //$NON-NLS-1$
command.add(JBossWSCreationUtils.getJavaProjectSrcLocation(project));
-
command.add("-o"); //$NON-NLS-1$
StringBuffer opDir = new StringBuffer();
- opDir.append(projectRoot).append(Path.SEPARATOR).append(
- javaProject.getOutputLocation().removeFirstSegments(1)
- .toOSString());
+ opDir.append(projectRoot).append(Path.SEPARATOR).append(javaProject.getOutputLocation().removeFirstSegments(1).toOSString());
command.add(opDir.toString());
if (model.getWsdlURI() != null) {
command.add(model.getWsdlURI());
}
-
}
private void convertInputStreamToString(final StringBuffer result,
final InputStream input) {
-
Thread thread = new Thread() {
public void run() {
-
try {
InputStreamReader ir = new InputStreamReader(input);
LineNumberReader reader = new LineNumberReader(ir);
@@ -238,7 +181,6 @@
while (str != null) {
result.append(str).append("\t\r"); //$NON-NLS-1$
str = reader.readLine();
-
}
} catch (IOException e) {
e.printStackTrace();
@@ -246,23 +188,19 @@
}
};
-
thread.start();
-
}
private void refreshProject(String project, IProgressMonitor monitor) {
try {
- JBossWSCreationUtils.getProjectByName(project).refreshLocal(2,
- monitor);
+ JBossWSCreationUtils.getProjectByName(project).refreshLocal(2,monitor);
} catch (CoreException e) {
e.printStackTrace();
JBossWSCreationCorePlugin.getDefault().logError(e);
}
}
- abstract protected void addCommandlineArgs(List<String> command)
- throws Exception;
+ abstract protected void addCommandlineArgs(List<String> command) throws Exception;
abstract protected String getCommandLineFileName_linux();
14 years
JBoss Tools SVN: r27216 - trunk/jsf/features/org.jboss.tools.richfaces.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-12-07 18:48:00 -0500 (Tue, 07 Dec 2010)
New Revision: 27216
Modified:
trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
Log:
https://jira.jboss.org/browse/JBDS-1318 Clarify MacOSX 10.5 support
to add support for macosx,cocoa,x86_64 in PDE p2 product build there should be no reference to xulrunner feature or p2 build failed to recognize macosx.carbon platform. What we loose is child Xulrunner item for Richfaces Feature in Help->About->Installation Details. What we get is ability to build p2 enabled product for any platform.
Modified: trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
===================================================================
--- trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2010-12-07 18:36:27 UTC (rev 27215)
+++ trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2010-12-07 23:48:00 UTC (rev 27216)
@@ -18,10 +18,6 @@
Red Hat, Inc. licenses these features and plugins to you under certain open source licenses (or aggregations of such licenses), which in a particular case may include the Eclipse Public License, the GNU Lesser General Public License, and/or certain other open source licenses. For precise licensing details, consult the corresponding source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive, Raleigh NC 27606 USA.
</license>
- <requires>
- <import feature="org.jboss.tools.xulrunner.feature" version="1.8.1.3-20070904"/>
- </requires>
-
<plugin
id="org.jboss.tools.common"
download-size="0"
14 years
JBoss Tools SVN: r27215 - trunk/requirements/soap.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-12-07 13:36:27 -0500 (Tue, 07 Dec 2010)
New Revision: 27215
Modified:
trunk/requirements/soap/build.properties
Log:
move up to SOA-5.1-ER5
Modified: trunk/requirements/soap/build.properties
===================================================================
--- trunk/requirements/soap/build.properties 2010-12-07 17:55:38 UTC (rev 27214)
+++ trunk/requirements/soap/build.properties 2010-12-07 18:36:27 UTC (rev 27215)
@@ -10,9 +10,9 @@
soap50.build.archive.md5=b9088f7884c7464419623c596dafe25f
soap50.build.archive.root=jboss-soa-p.5.0.0
-# JBDS-1374 add SOA-P 5.1 - http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER4/unsigned/soa-5....
-soap51.build.uri=http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER4/unsigned/
-soap51.build.name=soa-5.1.0.ER4
+# JBDS-1374 add SOA-P 5.1 - http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER5/unsigned/soa-5....
+soap51.build.uri=http://jawa05.englab.brq.redhat.com/candidate/SOA-5.1-ER5/unsigned/
+soap51.build.name=soa-5.1.0.ER5
soap51.build.archive=${soap51.build.name}.zip
-soap51.build.archive.md5=7e77e933f65d273c409d4cb7d5bf9e38
+soap51.build.archive.md5=2d8950b67c8143227e6fc2c5aefc91cd
soap51.build.archive.root=jboss-soa-p.5.1.0
14 years
JBoss Tools SVN: r27214 - trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-07 12:55:38 -0500 (Tue, 07 Dec 2010)
New Revision: 27214
Modified:
trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF
Log:
[JBIDE-7828] updated dependency to latest gwt sdk
Modified: trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF 2010-12-07 17:52:38 UTC (rev 27213)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF 2010-12-07 17:55:38 UTC (rev 27214)
@@ -8,7 +8,7 @@
Require-Bundle:
org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
com.google.gwt.eclipse.core;bundle-version="[1.3.3,2.0.0)",
- com.google.gwt.eclipse.sdkbundle.2.1.0;bundle-version="[2.0.0,3.0.0)",
+ com.google.gwt.eclipse.sdkbundle.2.1.0;bundle-version="[2.1.0,3.0.0)",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
14 years
JBoss Tools SVN: r27213 - trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-12-07 12:52:38 -0500 (Tue, 07 Dec 2010)
New Revision: 27213
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/EditedTemplateForUnknownTag.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/SetTemplateForUnknownTag.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml
Log:
Fixes for JBDS 4.0.0.Beta2
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/EditedTemplateForUnknownTag.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/EditedTemplateForUnknownTag.xml 2010-12-07 15:27:14 UTC (rev 27212)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/EditedTemplateForUnknownTag.xml 2010-12-07 17:52:38 UTC (rev 27213)
@@ -12,8 +12,10 @@
Hello Demo Application
</SPAN>
</H1>
-<B class="__any__tag__caption" style="border: 1px solid green; -moz-user-modify: read-only;" title="h:unknowntag" >
+<B style="border: 1px solid green; -moz-user-modify: read-only;" title="h:unknowntag" >
+<B class="__any__tag__caption" style="" title="h:unknowntag" >
</B>
+</B>
<UL style="color: red; -moz-user-modify: read-only;" title="h:messages style: color: red" >
<LI title="h:messages style: color: red" >
Error Messages
@@ -38,4 +40,6 @@
</TABLE>
</DIV>
</DIV>
+<IMG vpetemporarydndelement="true" id="dragIcon" src="file:////opt/jbdevstudio4.0.0.Beta2/studio/eclipse/plugins/org.jboss.tools.vpe_3.2.0.v201012050623R-H30-Beta2/ve/dragIcon.gif" style="position: absolute; cursor: move; left: 16px ! important; top: 77px ! important;" >
+</IMG>
</BODY>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/SetTemplateForUnknownTag.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/SetTemplateForUnknownTag.xml 2010-12-07 15:27:14 UTC (rev 27212)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/SetTemplateForUnknownTag.xml 2010-12-07 17:52:38 UTC (rev 27213)
@@ -12,9 +12,11 @@
Hello Demo Application
</SPAN>
</H1>
-<B class="__any__tag__caption" style="border: 1px solid green; color: black; font-family: Arial; -moz-user-modify: read-only;" title="h:unknowntag" >
+<B style="border: 1px solid green; -moz-user-modify: read-only;" title="h:unknowntag" >
+<B class="__any__tag__caption" style="color: black; font-family: Arial;" title="h:unknowntag" >
myValue
-<BR style="font-style: italic; color: green; -moz-user-modify: read-only;" >
+</B>
+<BR vpe:pseudo-element="yes" style="font-style: italic; color: green; -moz-user-modify: read-only;" >
</BR>
</B>
<UL style="color: red; -moz-user-modify: read-only;" title="h:messages style: color: red" >
@@ -41,4 +43,6 @@
</TABLE>
</DIV>
</DIV>
+<IMG vpetemporarydndelement="true" id="dragIcon" src="file:////opt/jbdevstudio4.0.0.Beta2/studio/eclipse/plugins/org.jboss.tools.vpe_3.2.0.v201012050623R-H30-Beta2/ve/dragIcon.gif" style="position: absolute; cursor: move; left: 16px ! important; top: 77px ! important;" >
+</IMG>
</BODY>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml 2010-12-07 15:27:14 UTC (rev 27212)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml 2010-12-07 17:52:38 UTC (rev 27213)
@@ -13,27 +13,29 @@
Hello Demo Application
</SPAN>
</H1>
-<DIV class="__any__tag__caption" style="border: 1px solid green; -moz-user-modify: read-only;" title="h:unknowntag">
+<DIV style="border: 1px solid green; -moz-user-modify: read-only;" title="h:unknowntag" >
+<DIV class="__any__tag__caption" style="" title="h:unknowntag" >
h:unknowntag
-<BR style="font-style: italic; color: green; -moz-user-modify: read-only;">
+</DIV>
+<BR vpe:pseudo-element="yes" style="font-style: italic; color: green; -moz-user-modify: read-only;" >
</BR>
</DIV>
-<UL style="color: red; -moz-user-modify: read-only;" title="h:messages style: color: red">
-<LI title="h:messages style: color: red">
+<UL style="color: red; -moz-user-modify: read-only;" title="h:messages style: color: red" >
+<LI title="h:messages style: color: red" >
Error Messages
</LI>
</UL>
-<FORM style="border: 1px dotted rgb(255, 102, 0); padding: 5px;" title="h:form id: greetingForm">
-<SPAN class="vpe-text" title="h:outputText value: #{Message.prompt_message}">
+<FORM style="border: 1px dotted rgb(255, 102, 0); padding: 5px;" title="h:form id: greetingForm" >
+<SPAN class="vpe-text" title="h:outputText value: #{Message.prompt_message}" >
Name:
</SPAN>
-<SPAN class="vpe-text" title="h:inputText value: #{user.name} required: true">
-<SPAN class="vpe-text" title="h:inputText value: #{user.name} required: true">
+<SPAN class="vpe-text" title="h:inputText value: #{user.name} required: true" >
+<SPAN class="vpe-text" title="h:inputText value: #{user.name} required: true" >
</SPAN>
-<INPUT value="#{user.name}" title="h:inputText value: #{user.name} required: true">
+<INPUT value="#{user.name}" title="h:inputText value: #{user.name} required: true" >
</INPUT>
</SPAN>
-<INPUT type="button" title="h:commandButton action: hello value: Say Hello!" value="Say Hello!" style="-moz-user-modify: read-only;">
+<INPUT type="button" title="h:commandButton action: hello value: Say Hello!" value="Say Hello!" style="-moz-user-modify: read-only;" >
</INPUT>
</FORM>
</DIV>
@@ -42,4 +44,6 @@
</TABLE>
</DIV>
</DIV>
+<IMG vpetemporarydndelement="true" id="dragIcon" src="file:////opt/jbdevstudio4.0.0.Beta2/studio/eclipse/plugins/org.jboss.tools.vpe_3.2.0.v201012050623R-H30-Beta2/ve/dragIcon.gif" style="position: absolute; cursor: move; left: 16px ! important; top: 17px ! important;" >
+</IMG>
</BODY>
\ No newline at end of file
14 years
JBoss Tools SVN: r27212 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-07 10:27:14 -0500 (Tue, 07 Dec 2010)
New Revision: 27212
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
JBIDE-7829
https://jira.jboss.org/browse/JBIDE-7829
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2010-12-07 12:57:36 UTC (rev 27211)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2010-12-07 15:27:14 UTC (rev 27212)
@@ -736,13 +736,8 @@
public void runDropCommand(final String flavor, final String data) {
XModelBuffer b = XModelTransferBuffer.getInstance().getBuffer();
final XModelObject o = b == null ? null : b.source();
- /*
- * Fixes https://jira.jboss.org/jira/browse/JBIDE-5874
- * Display.getDefault() should always be replaced by
- * PlatformUI.getWorkbench().getDisplay().
- * syncExec() can hang the JBDS thus asyncExec is used.
- */
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+
+ Runnable runnable = new Runnable() {
public void run() {
if (o != null
&& !XModelTransferBuffer.getInstance().isEnabled()) {
@@ -771,7 +766,18 @@
XModelTransferBuffer.getInstance().disable();
}
}
- });
+ };
+// if(Display.getCurrent() != null) {
+// runnable.run();
+// } else {
+ /*
+ * Fixes https://jira.jboss.org/jira/browse/JBIDE-5874
+ * Display.getDefault() should always be replaced by
+ * PlatformUI.getWorkbench().getDisplay().
+ * syncExec() can hang the JBDS thus asyncExec is used.
+ */
+ PlatformUI.getWorkbench().getDisplay().asyncExec(runnable);
+// }
}
public AttributeDescriptorValueProvider createAttributeDescriptorValueProvider() {
@@ -787,13 +793,22 @@
public void setProposal(ITagProposal proposal) {
if(this.proposal == proposal) return;
this.proposal = (TagProposal)proposal;
- query = createQuery(this.proposal);
+
+ String prefix = proposal.getPrefix();
+ int offset = JSPTextEditor.this.getTextViewer().getTextWidget().getCaretOffset();
+
ValueHelper valueHelper = new ValueHelper();
processor = valueHelper.createContentAssistProcessor();
- pageContext = valueHelper.createPageContext(processor, query.getOffset());
+ pageContext = valueHelper.createPageContext(processor, offset);
- Map<String, List<INameSpace>> ns = pageContext.getNameSpaces(query.getOffset());
- List<INameSpace> n = ns.get(query.getUri());
+ Map<String, List<INameSpace>> ns = pageContext.getNameSpaces(offset);
+ List<INameSpace> n = ns.get(this.proposal.getUri());
+ if(n != null && !n.isEmpty()) {
+ prefix = n.get(0).getPrefix();
+ }
+
+ query = createQuery(this.proposal, prefix);
+
if(n == null && pageContext instanceof JspContextImpl) {
IRegion r = new Region(query.getOffset(), 0);
((JspContextImpl)pageContext).addNameSpace(r, new NameSpace(query.getUri(), query.getPrefix(),
@@ -832,10 +847,10 @@
return createDescriptors(query);
}
- KbQuery createQuery(TagProposal proposal) {
+ KbQuery createQuery(TagProposal proposal, String prefix) {
KbQuery kbQuery = new KbQuery();
- String name = proposal.getPrefix().length() == 0 ? proposal.getName() : proposal.getPrefix() + ":" + proposal.getName(); //$NON-NLS-1$
- kbQuery.setPrefix(proposal.getPrefix());
+ String name = (prefix == null | prefix.length() == 0) ? proposal.getName() : prefix + ":" + proposal.getName(); //$NON-NLS-1$
+ kbQuery.setPrefix(prefix);
kbQuery.setUri(proposal.getUri());
kbQuery.setParentTags(new String[]{name});
kbQuery.setParent(name);
14 years
JBoss Tools SVN: r27211 - in trunk/vpe/plugins: org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-12-07 07:57:36 -0500 (Tue, 07 Dec 2010)
New Revision: 27211
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
fixed updating of <![CDATA[...]]> section inside <programlisting> in Docbook editor during editing (https://jira.jboss.org/browse/JBIDE-7785)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -657,7 +657,9 @@
int type = ((Node) notifier).getNodeType();
visualEditor.hideResizer();
visualBuilder.setSelectionRectangle(null);
- if (type == Node.TEXT_NODE) {
+ if (type == Node.CDATA_SECTION_NODE) {
+ visualBuilder.setCdataText((Node) notifier);
+ } else if (type == Node.TEXT_NODE) {
boolean update = visualBuilder.setText((Node) notifier);
visualEditor.showResizer();
// Added by Max Areshkau JBIDE-1554
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -55,6 +55,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
+import org.jboss.tools.vpe.editor.util.Docbook;
import org.jboss.tools.vpe.editor.util.ElService;
import org.jboss.tools.vpe.editor.util.FaceletUtil;
import org.jboss.tools.vpe.editor.util.HTML;
@@ -340,8 +341,9 @@
// we shouldn't process this node
if (sourceNode == null
|| (sourceNode.getNodeType() != Node.TEXT_NODE
- && sourceNode.getNodeType() != Node.ELEMENT_NODE && sourceNode
- .getNodeType() != Node.COMMENT_NODE)) {
+ && sourceNode.getNodeType() != Node.ELEMENT_NODE
+ && sourceNode.getNodeType() != Node.COMMENT_NODE
+ && sourceNode.getNodeType() != Node.CDATA_SECTION_NODE)) {
return null;
}
@@ -872,6 +874,16 @@
}
return null;
}
+
+ public void setCdataText(Node sourceNode) {
+ Node sourceParent = sourceNode.getParentNode();
+ if (sourceParent != null && sourceParent.getLocalName() != null) {
+ String sourceParentName = sourceParent.getLocalName();
+ if (Docbook.ELEMENT_PROGRAMLISTING.equalsIgnoreCase(sourceParentName)) {
+ updateNode(sourceParent);
+ }
+ }
+ }
public boolean setText(Node sourceText) {
Node sourceParent = sourceText.getParentNode();
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java (from rev 27181, trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/Docbook.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.vpe.editor.util;
+
+/**
+ * @author Denis Vinnichek (dvinnichek)
+ *
+ */
+public class Docbook {
+
+ public static final String ATTR_XREFLABEL = "xreflabel"; //$NON-NLS-1$
+ public static final String ATTR_LINKEND = "linkend"; //$NON-NLS-1$
+ public static final String ATTR_ENDTERM = "endterm"; //$NON-NLS-1$
+
+ public static final String ELEMENT_TITLE = "title"; //$NON-NLS-1$
+ public static final String ELEMENT_TIP = "tip"; //$NON-NLS-1$
+ public static final String ELEMENT_NOTE = "note"; //$NON-NLS-1$
+ public static final String ELEMENT_WARNING = "warning"; //$NON-NLS-1$
+ public static final String ELEMENT_CAUTION = "caution"; //$NON-NLS-1$
+ public static final String ELEMENT_IMPORTANT = "important"; //$NON-NLS-1$
+ public static final String ELEMENT_PROGRAMLISTING = "programlisting"; //$NON-NLS-1$
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <caution>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <important>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <note>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -13,11 +13,12 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.TextUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -40,14 +41,12 @@
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.CDATA_SECTION_NODE) {
- String cdataText = childNode.getNodeValue();
- newElement.appendChild(visualDocument.createTextNode(cdataText));
+ String cdataText = TextUtil.visualText(childNode.getNodeValue());
+ nsIDOMText textElement = visualDocument.createTextNode(cdataText);
+ newElement.appendChild(textElement);
} else {
nsIDOMElement spanElement = visualDocument.createElement(HTML.TAG_SPAN);
newElement.appendChild(spanElement);
- VpeChildrenInfo info = new VpeChildrenInfo(spanElement);
- info.addSourceChild(childNode);
- creationData.addChildrenInfo(info);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <tip>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <warning>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -13,10 +13,10 @@
import java.text.MessageFormat;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Docbook;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java 2010-12-07 12:40:13 UTC (rev 27210)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java 2010-12-07 12:57:36 UTC (rev 27211)
@@ -11,10 +11,10 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Docbook;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
14 years
JBoss Tools SVN: r27210 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.ui and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-07 07:40:13 -0500 (Tue, 07 Dec 2010)
New Revision: 27210
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudElementCategoryViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElementTypeMapper.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImageViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstanceViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudElementViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/NumericFoldingViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/RootViewElement.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
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/GetImagesCommand.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetInstancesCommand.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java
Log:
[JBIDE-7819] loading imges and instances is now asyncronous.
[JBIDE-7569] displaying "Loading..." now when images or instances are being loaded
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 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -160,7 +160,7 @@
if (!rules.equals(ruleString)) {
// TODO: remove notification with all instances, replace by
// notifying the changed instance
- notifyInstanceListListeners(instances.get());
+ notifyInstanceListListeners(getInstancesRepository().get());
}
}
@@ -187,7 +187,7 @@
String rules = getImageFilter().toString();
this.imageFilter = createImageFilter(ruleString);
if (!rules.equals(ruleString)) {
- notifyImageListListeners(images.get());
+ notifyImageListListeners(getImagesRepository().get());
}
}
@@ -342,11 +342,7 @@
*/
private void loadInstances() throws DeltaCloudException {
try {
- clearInstances();
- if (instances == null) {
- instances = new DeltaCloudInstancesRepository();
- }
- instances.add(client.listInstances(), this);
+ getInstancesRepository().add(client.listInstances(), this);
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(MessageFormat.format("Could not load instances of cloud {0}: {1}",
getName(), e.getMessage()), e);
@@ -367,13 +363,19 @@
}
}
- protected DeltaCloudInstance[] getInstances() throws DeltaCloudException {
+ private DeltaCloudInstancesRepository getInstancesRepository() {
if (instances == null) {
- loadInstances();
+ instances = new DeltaCloudInstancesRepository();
}
- return instances.get();
+ return instances;
}
+ /**
+ * Gets the instances in async manner. The method does not return the
+ * instances but notifies observers of the instances.
+ *
+ * @throws DeltaCloudException
+ */
protected void asyncGetInstances() throws DeltaCloudException {
if (instances == null) {
loadInstances();
@@ -381,11 +383,11 @@
notifyInstanceListListeners(instances.get());
}
- protected DeltaCloudImage[] getImages() throws DeltaCloudException {
+ private DeltaCloudImagesRepository getImagesRepository() {
if (images == null) {
- loadImages();
+ images = new DeltaCloudImagesRepository();
}
- return images.get();
+ return images;
}
protected void asyncGetImages() throws DeltaCloudException {
@@ -394,12 +396,12 @@
}
// TODO: remove notification with all instances, replace by
// notifying the changed instance
- notifyImageListListeners(images.get());
+ notifyImageListListeners(getImagesRepository().get());
}
public DeltaCloudImage getImage(String id) throws DeltaCloudException {
DeltaCloudImage matchingImage = null;
- for (DeltaCloudImage image : getImages()) {
+ for (DeltaCloudImage image : getImagesRepository().get()) {
if (id.equals(image.getId())) {
matchingImage = image;
break;
@@ -438,12 +440,12 @@
replaceInstance(instance, instanceToReplace);
// TODO: remove notification with all instances, replace by
// notifying the changed instance
- notifyInstanceListListeners(instances.get());
+ notifyInstanceListListeners(getInstancesRepository().get());
}
}
private DeltaCloudInstance findInstanceById(String instanceId) {
- return instances.getById(instanceId);
+ return getInstancesRepository().getById(instanceId);
}
// TODO: remove duplicate code with #replaceInstance
@@ -458,7 +460,7 @@
if (!(deltaCloudInstance.getState().equals(DeltaCloudInstance.BOGUS))
&& !(currentInstance.getState().equals(deltaCloudInstance.getState()))) {
replaceInstance(deltaCloudInstance, currentInstance);
- notifyInstanceListListeners(instances.get());
+ notifyInstanceListListeners(getInstancesRepository().get());
}
} catch (DeltaCloudClientException e) {
// TODO: is this correct?
@@ -469,8 +471,8 @@
}
private void replaceInstance(DeltaCloudInstance deltaCloudInstance, DeltaCloudInstance currentInstance) {
- instances.remove(currentInstance);
- instances.add(deltaCloudInstance);
+ getInstancesRepository().remove(currentInstance);
+ getInstancesRepository().add(deltaCloudInstance);
}
public boolean performInstanceAction(String instanceId, String actionId) throws DeltaCloudException {
@@ -487,7 +489,7 @@
if (result) {
// TODO: remove notification with all instances, replace by
// notifying the changed instance
- notifyInstanceListListeners(instances.get());
+ notifyInstanceListListeners(getInstancesRepository().get());
}
return result;
} catch (DeltaCloudClientException e) {
@@ -522,12 +524,9 @@
*/
private void loadImages() throws DeltaCloudException {
try {
- clearImages();
- if (images == null) {
- images = new DeltaCloudImagesRepository();
- }
- images.add(client.listImages(), this);
+ getImagesRepository().add(client.listImages(), this);
} catch (DeltaCloudClientException e) {
+ clearImages();
throw new DeltaCloudException(MessageFormat.format("Could not load images of cloud {0}: {1}",
getName(), e.getMessage()), e);
}
@@ -537,7 +536,7 @@
public DeltaCloudImage loadImage(String imageId) throws DeltaCloudException {
try {
Image image = client.listImages(imageId);
- return images.add(image, this);
+ return getImagesRepository().add(image, this);
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(e);
}
@@ -581,10 +580,9 @@
instance = client.createInstance(imageId, profileId, realmId, name, memory, storage);
}
if (instance != null) {
- getInstances(); // make sure instances are initialized
- DeltaCloudInstance deltaCloudInstance = instances.add(instance, this);
+ DeltaCloudInstance deltaCloudInstance = getInstancesRepository().add(instance, this);
deltaCloudInstance.setGivenName(name);
- notifyInstanceListListeners(instances.get());
+ notifyInstanceListListeners(getInstancesRepository().get());
return deltaCloudInstance;
}
} catch (DeltaCloudClientException e) {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetImagesCommand.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetImagesCommand.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetImagesCommand.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -32,10 +32,15 @@
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
- getCloud().asyncGetImages();
+ asyncGetImages();
return Status.OK_STATUS;
}
+
}.schedule();
}
+
+ protected void asyncGetImages() throws DeltaCloudException {
+ getCloud().asyncGetImages();
+ }
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetInstancesCommand.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetInstancesCommand.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/GetInstancesCommand.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -32,10 +32,15 @@
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
- getCloud().asyncGetInstances();
+ asyncGetInstances();
return Status.OK_STATUS;
}
+
}.schedule();
}
+
+ protected void asyncGetInstances() throws DeltaCloudException {
+ getCloud().asyncGetInstances();
+ }
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-07 12:40:13 UTC (rev 27210)
@@ -2,7 +2,7 @@
* src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java (setLoadingIndicator):
* src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java:
- [JBIDE-7819] I now show the user that things are being loaded ("Loading..." node)
+ [JBIDE-7569] I now show the user that things are being loaded ("Loading..." node)
* src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java (listChanged):
* src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java (listChanged):
* src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-07 12:40:13 UTC (rev 27210)
@@ -40,7 +40,7 @@
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
<propertyContributor
contributorId="org.jboss.tools.deltacloud.ui.views.CloudView"
- typeMapper="org.jboss.tools.deltacloud.ui.views.cloud.CVTypeMapper">
+ typeMapper="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElementTypeMapper">
<propertyCategory
category="main"></propertyCategory>
</propertyContributor>
@@ -65,7 +65,7 @@
id="org.jboss.tools.deltacloud.ui.propertySection.advanced"
tab="cloudview.advancedTab">
<input
- type="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
+ type="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement">
</input>
</propertySection>
</propertySections>
@@ -116,7 +116,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement">
</instanceof>
</iterate>
</with>
@@ -136,7 +136,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement">
</instanceof>
</iterate>
</with>
@@ -158,7 +158,7 @@
<count value="+" />
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement">
</instanceof>
</iterate>
</and>
@@ -299,7 +299,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement">
</instanceof>
</iterate>
</with>
@@ -675,7 +675,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.ImageViewElement">
</instanceof>
</iterate>
</with>
@@ -699,11 +699,11 @@
<iterate>
<and>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement">
</instanceof>
<not>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.ImageViewElement">
</instanceof>
</not>
</and>
@@ -870,7 +870,7 @@
<extension
point="org.eclipse.core.runtime.adapters">
<factory
- adaptableType="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement"
+ adaptableType="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement"
class="org.jboss.tools.deltacloud.ui.adapter.CloudViewElementAdapterFactory">
<adapter
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -16,9 +16,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVInstanceElement;
-import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.ImageViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.InstanceViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
public class CloudViewElementAdapterFactory implements IAdapterFactory {
@@ -33,8 +33,8 @@
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
- Assert.isLegal(adaptableObject instanceof CloudViewElement);
- CloudViewElement element = (CloudViewElement) adaptableObject;
+ Assert.isLegal(adaptableObject instanceof DeltaCloudViewElement);
+ DeltaCloudViewElement element = (DeltaCloudViewElement) adaptableObject;
if (adapterType == IPropertySource.class) {
return element.getPropertySource();
} else if (adapterType == DeltaCloudImage.class) {
@@ -48,17 +48,17 @@
}
}
- private DeltaCloudInstance getDeltaCloudInstance(CloudViewElement element) {
- if (element instanceof CVInstanceElement) {
- return (DeltaCloudInstance) element.getElement();
+ private DeltaCloudInstance getDeltaCloudInstance(DeltaCloudViewElement element) {
+ if (element instanceof InstanceViewElement) {
+ return (DeltaCloudInstance) element.getModel();
} else {
return null;
}
}
- private DeltaCloudImage getDeltaCloudImage(CloudViewElement element) {
- if (element instanceof CVImageElement) {
- return (DeltaCloudImage) element.getElement();
+ private DeltaCloudImage getDeltaCloudImage(DeltaCloudViewElement element) {
+ if (element instanceof ImageViewElement) {
+ return (DeltaCloudImage) element.getModel();
} else {
return null;
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -21,8 +21,8 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstanceWizard2;
@@ -35,13 +35,13 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- CloudViewElement element = UIUtils.getFirstAdaptedElement(selection, CloudViewElement.class);
- while (element != null && !(element instanceof CVCloudElement)) {
- element = (CloudViewElement) element.getParent();
+ DeltaCloudViewElement element = UIUtils.getFirstAdaptedElement(selection, DeltaCloudViewElement.class);
+ while (element != null && !(element instanceof CloudViewElement)) {
+ element = (DeltaCloudViewElement) element.getParent();
}
if (element != null) {
- CVCloudElement cloudElement = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ CloudViewElement cloudElement = (CloudViewElement) element;
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getModel();
IWizard wizard = new NewInstanceWizard2(cloud);
WizardDialog dialog = new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(),
wizard);
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -38,8 +38,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement;
/**
* @author Andre Dietisheim
@@ -132,8 +132,8 @@
DeltaCloud deltaCloud = null;
if (selectedElements.size() > 0) {
Object object = selectedElements.get(0);
- if (object instanceof CVCloudElement) {
- Object element = ((CVCloudElement) object).getElement();
+ if (object instanceof CloudViewElement) {
+ Object element = ((CloudViewElement) object).getModel();
if (element instanceof DeltaCloud) {
deltaCloud = (DeltaCloud) element;
}
@@ -154,11 +154,11 @@
}
private DeltaCloud getDeltaCloud(Object item) {
- if (!(item instanceof CloudViewElement)) {
+ if (!(item instanceof DeltaCloudViewElement)) {
return null;
}
- DeltaCloud cloud = getDeltaCloud((CloudViewElement) item);
+ DeltaCloud cloud = getDeltaCloud((DeltaCloudViewElement) item);
if (cloud == null) {
return null;
@@ -166,16 +166,16 @@
return cloud;
}
- private DeltaCloud getDeltaCloud(CloudViewElement element) {
+ private DeltaCloud getDeltaCloud(DeltaCloudViewElement element) {
if (element == null) {
return null;
}
- Object cloud = element.getElement();
+ Object cloud = element.getModel();
if (cloud instanceof DeltaCloud) {
return (DeltaCloud) cloud;
}
- return getDeltaCloud((CloudViewElement) element.getParent());
+ return getDeltaCloud((DeltaCloudViewElement) element.getParent());
}
private void removeDeltaClouds(Object[] deltaClouds) throws DeltaCloudException {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -21,8 +21,8 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.EditCloudConnectionWizard;
@@ -35,13 +35,13 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- CloudViewElement element = UIUtils.getFirstAdaptedElement(selection, CloudViewElement.class);
- while (element != null && !(element instanceof CVCloudElement)) {
- element = (CloudViewElement) element.getParent();
+ DeltaCloudViewElement element = UIUtils.getFirstAdaptedElement(selection, DeltaCloudViewElement.class);
+ while (element != null && !(element instanceof CloudViewElement)) {
+ element = (DeltaCloudViewElement) element.getParent();
}
if (element != null) {
- CVCloudElement cloudElement = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ CloudViewElement cloudElement = (CloudViewElement) element;
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getModel();
IWizard wizard = new EditCloudConnectionWizard(cloud);
WizardDialog dialog = new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(), wizard);
dialog.create();
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -25,7 +25,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudMultiException;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
@@ -38,14 +38,14 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- CloudViewElement cloudViewElement = UIUtils.getFirstAdaptedElement(selection, CloudViewElement.class);
+ DeltaCloudViewElement cloudViewElement = UIUtils.getFirstAdaptedElement(selection, DeltaCloudViewElement.class);
refresh(cloudViewElement);
}
return Status.OK_STATUS;
}
- private void refresh(final CloudViewElement cloudViewElement) {
+ private void refresh(final DeltaCloudViewElement cloudViewElement) {
if (cloudViewElement != null) {
final DeltaCloud cloud = CloudViewElementUtils.getCloud(cloudViewElement);
if (cloud != null) {
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.cloud.property.CloudPropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVCloudElement extends CloudViewElement {
-
- private TreeViewer viewer;
-
- public CVCloudElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- super(element, parent, viewer);
- this.viewer = viewer;
- }
-
- public String getName() {
- Object element = getElement();
- if (element instanceof DeltaCloud) {
- return ((DeltaCloud) element).getName();
- } else {
- return "";
- }
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public synchronized Object[] getChildren() {
- if (!initialized.get()) {
- DeltaCloud cloud = (DeltaCloud) getElement();
- CVCloudElementCategoryElement instances = new CVInstancesCategoryElement(cloud, this, viewer);
- addCategory(instances);
- CVCloudElementCategoryElement images = new CVImagesCategoryElement(cloud, this, viewer);
- addCategory(images);
- }
- initialized.set(true);
- return super.getChildren();
- }
-
- private void addCategory(CVCloudElementCategoryElement categoryElement) {
- children.add(categoryElement);
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new CloudPropertySource(getElement());
- }
-
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class CVCloudElementCategoryElement extends CloudViewElement {
-
- public CVCloudElementCategoryElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- super(element, parent, viewer);
- addCloudElementListener(getCloud());
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public Object[] getChildren() {
- if (!initialized.get()) {
- setLoadingIndicator();
- asyncGetCloudElements();
- initialized.set(true);
- }
- return super.getChildren();
- }
-
- private void setLoadingIndicator() {
- children.add(new LoadingCloudViewElement(this, viewer));
- }
-
- protected abstract void asyncGetCloudElements();
-
- protected void addChildren(Object[] modelElements) {
- if (modelElements.length > CVNumericFoldingElement.FOLDING_SIZE) {
- addFoldedChildren(modelElements);
- } else {
- addChildren(getElements(modelElements, 0, modelElements.length));
- }
- }
-
- protected void addFoldedChildren(Object[] modelElements) {
- int min = 0;
- int max = CVNumericFoldingElement.FOLDING_SIZE;
- int length = modelElements.length;
- while (length > CVNumericFoldingElement.FOLDING_SIZE) {
- CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, this, viewer);
- addChild(f);
- f.addChildren(getElements(modelElements, min, max));
- min += CVNumericFoldingElement.FOLDING_SIZE;
- max += CVNumericFoldingElement.FOLDING_SIZE;
- length -= CVNumericFoldingElement.FOLDING_SIZE;
- }
- if (length > 0) {
- CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, this, viewer);
- addChild(f);
- f.addChildren(getElements(modelElements, min, min + length));
- }
- }
-
- protected abstract CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex);
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for cathegories
- return null;
- }
-
- protected DeltaCloud getCloud() {
- return (DeltaCloud) getElement();
- }
-
- @Override
- protected void dispose() {
- removeCloudElementListener(getCloud());
- }
-
- protected abstract void addCloudElementListener(DeltaCloud cloud);
-
- protected abstract void removeCloudElementListener(DeltaCloud cloud);
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.ui.views.cloud.property.ImagePropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVImageElement extends CloudViewElement {
-
- public CVImageElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- super(element, parent, viewer);
- }
-
- public String getName() {
- Object element = getElement();
- if (element instanceof DeltaCloudImage) {
- return ((DeltaCloudImage) element).getName();
- } else {
- return "";
- }
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new ImagePropertySource(getElement());
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.core.GetImagesCommand;
-import org.jboss.tools.deltacloud.core.IImageFilter;
-import org.jboss.tools.deltacloud.core.IImageListListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.CVMessages;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVImagesCategoryElement extends CVCloudElementCategoryElement implements IImageListListener {
-
- private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName"; //$NON-NLS-1$
-
- public CVImagesCategoryElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- super(element, parent, viewer);
- }
-
- public String getName() {
- return CVMessages.getString(IMAGE_CATEGORY_NAME);
- }
-
- protected void asyncGetCloudElements() {
- new GetImagesCommand(getCloud()).execute();
- }
-
- @Override
- protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
- CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
- for (int i = startIndex; i < stopIndex; ++i) {
- elements[i - startIndex] = new CVImageElement(modelElements[i], this, viewer);
- }
- return elements;
- }
-
- @Override
- public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
- try {
- clearChildren();
- initialized.set(false);
- DeltaCloudImage[] images = filter(newImages);
- addChildren(images);
- expand();
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- MessageFormat.format("Could not get images from cloud \"{0}\"", cloud.getName()), e,
- viewer.getControl().getShell());
- } finally {
- initialized.set(true);
- }
- }
-
- public DeltaCloudImage[] filter(DeltaCloudImage[] images) throws DeltaCloudException {
- DeltaCloud cloud = (DeltaCloud) getElement();
- IImageFilter f = cloud.getImageFilter();
- return f.filter(images).toArray(new DeltaCloudImage[images.length]);
- }
-
- protected void addCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.addImageListListener(this);
- }
- }
-
- protected void removeCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.removeImageListListener(this);
- }
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.views.cloud.property.InstancePropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVInstanceElement extends CloudViewElement {
-
- public CVInstanceElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- super(element, parent, viewer);
- }
-
- public String getName() {
- Object element = getElement();
- StringBuilder sb = new StringBuilder();
- if (element instanceof DeltaCloudInstance) {
- DeltaCloudInstance instance = (DeltaCloudInstance) element;
- if (instance.getName() != null) {
- sb.append(instance.getName());
- }
- if (instance.getId() != null) {
- sb.append(" [").append(instance.getId()).append("] ");
- }
- }
- return sb.toString();
-
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new InstancePropertySource(this, getElement());
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.GetInstancesCommand;
-import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.core.IInstanceListListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.CVMessages;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVInstancesCategoryElement extends CVCloudElementCategoryElement implements IInstanceListListener {
-
- private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName"; //$NON-NLS-1$
-
- public CVInstancesCategoryElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- super(element, parent, viewer);
- }
-
- public String getName() {
- return CVMessages.getString(INSTANCE_CATEGORY_NAME);
- }
-
- protected void asyncGetCloudElements() {
- new GetInstancesCommand(getCloud()).execute();
- }
-
- @Override
- protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
- CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
- for (int i = startIndex; i < stopIndex; ++i) {
- elements[i - startIndex] = new CVInstanceElement(modelElements[i], this, viewer);
- }
- return elements;
- }
-
- @Override
- public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
- try {
- clearChildren();
- initialized.set(false);
- final DeltaCloudInstance[] instances = filter(newInstances);
- addChildren(instances);
- expand();
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- MessageFormat.format("Could not get instanceso from cloud \"{0}\"", cloud.getName()), e,
- viewer.getControl().getShell());
- } finally {
- initialized.set(true);
- }
- }
-
- public DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) throws DeltaCloudException {
- IInstanceFilter f = getCloud().getInstanceFilter();
- return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
- }
-
- protected void addCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.addInstanceListListener(this);
- }
- }
-
- protected void removeCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.removeInstanceListListener(this);
- }
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVNumericFoldingElement extends CloudViewElement {
-
- public static int FOLDING_SIZE = 50;
- private Object min;
- private int max;
-
- public CVNumericFoldingElement(int min, int max, CloudViewElement parent, TreeViewer viewer) {
- super(null, parent, viewer);
- this.min = min;
- this.max = max;
- }
-
- @Override
- public String getName() {
- return new StringBuilder()
- .append("[")
- .append(min)
- .append("..")
- .append(max - 1)
- .append("]").toString();
- }
-
- @Override
- public Object[] getChildren() {
- return super.getChildren();
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return null;
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVRootElement extends CloudViewElement implements ICloudManagerListener {
-
- public CVRootElement(TreeViewer viewer) {
- super(DeltaCloudManager.getDefault(), null, viewer); //$NON-NLS-1$
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- @Override
- public String getName() {
- return "root"; //$NON-NLS-1$
- }
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for the root element
- return null;
- }
-
- @Override
- public Object[] getChildren() {
- if (!initialized.get()) {
- DeltaCloudManager m = DeltaCloudManager.getDefault();
- try {
- addClouds(m.getClouds());
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError("Error", "Could not get clouds", e, Display.getDefault().getActiveShell());
- } finally {
- initialized.set(true);
- }
- }
- return super.getChildren();
- }
-
- private void addClouds(DeltaCloud[] clouds) {
- for (DeltaCloud cloud : clouds) {
- addCloud(cloud);
- }
- }
-
- private void addCloud(DeltaCloud cloud) {
- CVCloudElement e = new CVCloudElement(cloud, this, viewer);
- children.add(e);
- }
-
- private CloudViewElement getCloudViewElement(DeltaCloud cloudToMatch) {
- for (CloudViewElement cloudElement : children) {
- DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
- if (cloudToMatch.equals(cloud)) {
- return cloudElement;
- }
- }
- return null;
- }
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- }
-
- public void cloudsChanged(int type, DeltaCloud cloud) {
- switch (type) {
- case ICloudManagerListener.ADD_EVENT:
- addChild(new CVCloudElement(cloud, this, viewer));
- break;
- case ICloudManagerListener.REMOVE_EVENT:
- removeChild(getCloudViewElement(cloud));
- break;
- case ICloudManagerListener.RENAME_EVENT:
- CloudViewElement cloudViewElement = getCloudViewElement(cloud);
- viewer.refresh(cloudViewElement);
- break;
- }
- initialized.set(true);
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
-
-public class CVTypeMapper extends AbstractTypeMapper {
-
- @SuppressWarnings("rawtypes")
- @Override
- public Class mapType(Object object) {
- if (object instanceof TreeNode) {
- return ((TreeNode) object).getValue().getClass();
- }
- return super.mapType(object);
- }
-
-}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudElementCategoryViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudElementCategoryViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudElementCategoryViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class CloudElementCategoryViewElement<CLOUDELEMENT> extends DeltaCloudViewElement {
+
+ protected CloudElementCategoryViewElement(Object model, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(model, parent, viewer);
+ addCloudElementListener(getCloud());
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized.get()) {
+// setLoadingIndicator();
+ asyncGetCloudElements();
+ initialized.set(true);
+ }
+ return super.getChildren();
+ }
+
+ protected void setLoadingIndicator() {
+ children.add(new LoadingCloudElementViewElement(this, viewer));
+ }
+
+ protected abstract void asyncGetCloudElements();
+
+ protected void addChildren(Object[] modelElements) {
+ if (modelElements.length > NumericFoldingViewElement.FOLDING_SIZE) {
+ addFoldedChildren(modelElements);
+ } else {
+ addChildren(getElements(modelElements, 0, modelElements.length));
+ }
+ }
+
+ protected void addFoldedChildren(Object[] modelElements) {
+ int min = 0;
+ int max = NumericFoldingViewElement.FOLDING_SIZE;
+ int length = modelElements.length;
+ while (length > NumericFoldingViewElement.FOLDING_SIZE) {
+ NumericFoldingViewElement f = new NumericFoldingViewElement(min, max, this, viewer);
+ addChild(f);
+ f.addChildren(getElements(modelElements, min, max));
+ min += NumericFoldingViewElement.FOLDING_SIZE;
+ max += NumericFoldingViewElement.FOLDING_SIZE;
+ length -= NumericFoldingViewElement.FOLDING_SIZE;
+ }
+ if (length > 0) {
+ NumericFoldingViewElement f = new NumericFoldingViewElement(min, max, this, viewer);
+ addChild(f);
+ f.addChildren(getElements(modelElements, min, min + length));
+ }
+ }
+
+ protected void onListChanged(DeltaCloud cloud, CLOUDELEMENT[] cloudElements) throws DeltaCloudException {
+ try {
+ clearChildren();
+ initialized.set(false);
+ final CLOUDELEMENT[] filteredElements = filter(cloudElements);
+ addChildren(filteredElements);
+ expand();
+ } finally {
+ initialized.set(true);
+ }
+ }
+
+ protected abstract CLOUDELEMENT[] filter(CLOUDELEMENT[] cloudElements) throws DeltaCloudException;
+
+ protected abstract DeltaCloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex);
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for cathegories
+ return null;
+ }
+
+ protected DeltaCloud getCloud() {
+ return (DeltaCloud) getModel();
+ }
+
+ @Override
+ protected void dispose() {
+ removeCloudElementListener(getCloud());
+ }
+
+ protected abstract void addCloudElementListener(DeltaCloud cloud);
+
+ protected abstract void removeCloudElementListener(DeltaCloud cloud);
+
+}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class CloudViewContentProvider implements ITreeContentProvider {
-
- private CloudViewElement root;
-
- @Override
- public Object[] getChildren(Object element) {
- if (element instanceof CloudViewElement) {
- return ((CloudViewElement) element).getChildren();
- } else {
- return null;
- }
- }
-
- @Override
- public Object getParent(Object element) {
- if (element instanceof CloudViewElement) {
- return ((CloudViewElement) element).getParent();
- } else {
- return null;
- }
- }
-
- @Override
- public boolean hasChildren(Object element) {
- CloudViewElement e = (CloudViewElement) element;
- return e.hasChildren();
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return root.getChildren();
- }
-
- @Override
- public void dispose() {
-
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- root = (CloudViewElement) newInput;
- }
-
-}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -10,154 +10,59 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views.cloud;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CloudPropertySource;
/**
* @author Jeff Johnston
* @author Andre Dietisheim
*/
-public abstract class CloudViewElement implements IAdaptable {
+public class CloudViewElement extends DeltaCloudViewElement {
- private Object element;
- private CloudViewElement parent;
- protected List<CloudViewElement> children =
- Collections.synchronizedList(new ArrayList<CloudViewElement>());
- protected TreeViewer viewer;
- protected AtomicBoolean initialized = new AtomicBoolean();
+ private TreeViewer viewer;
- public CloudViewElement(Object element, CloudViewElement parent, TreeViewer viewer) {
- this.element = element;
- this.parent = parent;
+ protected CloudViewElement(Object element, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
this.viewer = viewer;
- initDisposeListener(viewer);
}
- public abstract String getName();
-
- public Object[] getChildren() {
- return children.toArray();
+ public String getName() {
+ Object element = getModel();
+ if (element instanceof DeltaCloud) {
+ return ((DeltaCloud) element).getName();
+ } else {
+ return "";
+ }
}
- protected void clearChildren() {
- getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- // viewer.getTree().setRedraw(false);
- for (final CloudViewElement element : children) {
- viewer.remove(element);
- }
- // viewer.getTree().setRedraw(true);
- }
- });
- children.clear();
- }
-
+ @Override
public boolean hasChildren() {
- return children.size() > 0;
+ return true;
}
- public Object getParent() {
- return parent;
- }
-
- public void addChild(final CloudViewElement element) {
- children.add(element);
-
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- viewer.add(CloudViewElement.this, element);
- }
- });
- }
-
- public void addChildren(final CloudViewElement[] elements) {
- for (CloudViewElement element : elements) {
- children.add(element);
+ @Override
+ public synchronized Object[] getChildren() {
+ if (!initialized.get()) {
+ DeltaCloud cloud = (DeltaCloud) getModel();
+ CloudElementCategoryViewElement instances = new InstancesCategoryViewElement(cloud, this, viewer);
+ addCategory(instances);
+ CloudElementCategoryViewElement images = new ImagesCategoryViewElement(cloud, this, viewer);
+ addCategory(images);
}
-
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- viewer.add(CloudViewElement.this, elements);
- }
- });
+ initialized.set(true);
+ return super.getChildren();
}
- public void removeChild(final CloudViewElement element) {
-
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (element != null) {
- int index = children.indexOf(element);
- viewer.remove(CloudViewElement.this, index);
- }
- }
- });
+ private void addCategory(CloudElementCategoryViewElement categoryElement) {
+ children.add(categoryElement);
}
- protected void expand() {
- getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- viewer.setExpandedState(CloudViewElement.this, true);
- }
- });
- }
-
- public Object getElement() {
- return element;
- }
-
- @SuppressWarnings("rawtypes")
@Override
- public Object getAdapter(Class adapter) {
- if (adapter == IPropertySource.class) {
- IPropertySource p = getPropertySource();
- return p;
- }
- return null;
+ public IPropertySource getPropertySource() {
+ return new CloudPropertySource(getModel());
}
-
- public abstract IPropertySource getPropertySource();
-
- private void initDisposeListener(Viewer viewer) {
- final Control control = viewer.getControl();
- control.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- control.addDisposeListener(new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- }
- });
- }
- });
- }
-
- protected Display getDisplay() {
- return viewer.getControl().getDisplay();
- }
-
- protected void dispose() {
- // nothing to do
- }
+
+
}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-
-public class CloudViewLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof CVCloudElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_CLOUD);
- } else if (element instanceof CVCloudElementCategoryElement ||
- element instanceof CVNumericFoldingElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_FOLDER);
- } else if (element instanceof CVInstanceElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_INSTANCE);
- } else if (element instanceof CVImageElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_IMAGE);
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.getName();
- }
-
-}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -53,10 +53,10 @@
private TreeViewer createTreeViewer(Composite parent) {
TreeViewer viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.setContentProvider(new CloudViewContentProvider());
- viewer.setLabelProvider(new CloudViewLabelProvider());
+ viewer.setContentProvider(new DeltaCloudViewContentProvider());
+ viewer.setLabelProvider(new DeltaCloudViewLabelProvider());
viewer.setUseHashlookup(true);
- viewer.setInput(new CVRootElement(viewer));
+ viewer.setInput(new RootViewElement(viewer));
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
getSite().setSelectionProvider(viewer);
return viewer;
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewContentProvider.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewContentProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewContentProvider.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class DeltaCloudViewContentProvider implements ITreeContentProvider {
+
+ private DeltaCloudViewElement root;
+
+ @Override
+ public Object[] getChildren(Object element) {
+ if (element instanceof DeltaCloudViewElement) {
+ return ((DeltaCloudViewElement) element).getChildren();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof DeltaCloudViewElement) {
+ return ((DeltaCloudViewElement) element).getParent();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ DeltaCloudViewElement e = (DeltaCloudViewElement) element;
+ return e.hasChildren();
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return root.getChildren();
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ root = (DeltaCloudViewElement) newInput;
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class DeltaCloudViewElement implements IAdaptable {
+
+ private Object model;
+ private DeltaCloudViewElement parent;
+ protected List<DeltaCloudViewElement> children =
+ Collections.synchronizedList(new ArrayList<DeltaCloudViewElement>());
+ protected TreeViewer viewer;
+ protected AtomicBoolean initialized = new AtomicBoolean();
+
+ protected DeltaCloudViewElement(Object model, DeltaCloudViewElement parent, TreeViewer viewer) {
+ this.model = model;
+ this.parent = parent;
+ this.viewer = viewer;
+ initDisposeListener(viewer);
+ }
+
+ public abstract String getName();
+
+ public Object[] getChildren() {
+ return children.toArray();
+ }
+
+ protected void clearChildren() {
+ getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ // viewer.getTree().setRedraw(false);
+ for (final DeltaCloudViewElement element : children) {
+ viewer.remove(element);
+ }
+ // viewer.getTree().setRedraw(true);
+ }
+ });
+ children.clear();
+ }
+
+ public boolean hasChildren() {
+ return children.size() > 0;
+ }
+
+ public Object getParent() {
+ return parent;
+ }
+
+ public void addChild(final DeltaCloudViewElement element) {
+ children.add(element);
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.add(DeltaCloudViewElement.this, element);
+ }
+ });
+ }
+
+ public void addChildren(final DeltaCloudViewElement[] elements) {
+ for (DeltaCloudViewElement element : elements) {
+ children.add(element);
+ }
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.add(DeltaCloudViewElement.this, elements);
+ }
+ });
+ }
+
+ public void removeChild(final DeltaCloudViewElement element) {
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (element != null) {
+ int index = children.indexOf(element);
+ viewer.remove(DeltaCloudViewElement.this, index);
+ }
+ }
+ });
+ }
+
+ protected void expand() {
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.setExpandedState(DeltaCloudViewElement.this, true);
+ }
+ });
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ IPropertySource p = getPropertySource();
+ return p;
+ }
+ return null;
+ }
+
+ public abstract IPropertySource getPropertySource();
+
+ private void initDisposeListener(Viewer viewer) {
+ final Control control = viewer.getControl();
+ control.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ control.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ });
+ }
+ });
+ }
+
+ protected Display getDisplay() {
+ return viewer.getControl().getDisplay();
+ }
+
+ protected void dispose() {
+ // nothing to do
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElementTypeMapper.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElementTypeMapper.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewElementTypeMapper.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
+
+public class DeltaCloudViewElementTypeMapper extends AbstractTypeMapper {
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Class mapType(Object object) {
+ if (object instanceof TreeNode) {
+ return ((TreeNode) object).getValue().getClass();
+ }
+ return super.mapType(object);
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewLabelProvider.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewLabelProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewLabelProvider.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+public class DeltaCloudViewLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof CloudViewElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_CLOUD);
+ } else if (element instanceof CloudElementCategoryViewElement ||
+ element instanceof NumericFoldingViewElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_FOLDER);
+ } else if (element instanceof InstanceViewElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_INSTANCE);
+ } else if (element instanceof ImageViewElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_IMAGE);
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ DeltaCloudViewElement e = (DeltaCloudViewElement)element;
+ return e.getName();
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImageViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImageViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImageViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.ImagePropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class ImageViewElement extends DeltaCloudViewElement {
+
+ protected ImageViewElement(Object model, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(model, parent, viewer);
+ }
+
+ public String getName() {
+ Object element = getModel();
+ if (element instanceof DeltaCloudImage) {
+ return ((DeltaCloudImage) element).getName();
+ } else {
+ return "";
+ }
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new ImagePropertySource(getModel());
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
+import org.jboss.tools.deltacloud.core.IImageFilter;
+import org.jboss.tools.deltacloud.core.IImageListListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class ImagesCategoryViewElement extends CloudElementCategoryViewElement<DeltaCloudImage> implements IImageListListener {
+
+ private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName"; //$NON-NLS-1$
+
+ protected ImagesCategoryViewElement(Object model, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(model, parent, viewer);
+ }
+
+ public String getName() {
+ return CVMessages.getString(IMAGE_CATEGORY_NAME);
+ }
+
+ @Override
+ protected void asyncGetCloudElements() {
+ setLoadingIndicator();
+ new GetImagesCommand(getCloud()){
+
+ @Override
+ protected void asyncGetImages() throws DeltaCloudException {
+ try {
+ super.asyncGetImages();
+ } catch(DeltaCloudException e) {
+ clearChildren();
+ throw e;
+ }
+ }
+
+ }.execute();
+ }
+
+ @Override
+ protected DeltaCloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
+ DeltaCloudViewElement[] elements = new DeltaCloudViewElement[stopIndex - startIndex];
+ for (int i = startIndex; i < stopIndex; ++i) {
+ elements[i - startIndex] = new ImageViewElement(modelElements[i], this, viewer);
+ }
+ return elements;
+ }
+
+ @Override
+ public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
+ try {
+ onListChanged(cloud, newImages);
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get images from cloud \"{0}\"", cloud.getName()), e,
+ viewer.getControl().getShell());
+ }
+ }
+
+ @Override
+ protected DeltaCloudImage[] filter(DeltaCloudImage[] images) throws DeltaCloudException {
+ DeltaCloud cloud = (DeltaCloud) getModel();
+ IImageFilter f = cloud.getImageFilter();
+ return f.filter(images).toArray(new DeltaCloudImage[images.length]);
+ }
+
+ protected void addCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.addImageListListener(this);
+ }
+ }
+
+ protected void removeCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.removeImageListListener(this);
+ }
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstanceViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstanceViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstanceViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.InstancePropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class InstanceViewElement extends DeltaCloudViewElement {
+
+ protected InstanceViewElement(Object model, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(model, parent, viewer);
+ }
+
+ public String getName() {
+ Object element = getModel();
+ StringBuilder sb = new StringBuilder();
+ if (element instanceof DeltaCloudInstance) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) element;
+ if (instance.getName() != null) {
+ sb.append(instance.getName());
+ }
+ if (instance.getId() != null) {
+ sb.append(" [").append(instance.getId()).append("] ");
+ }
+ }
+ return sb.toString();
+
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new InstancePropertySource(this, getModel());
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
+import org.jboss.tools.deltacloud.core.IInstanceFilter;
+import org.jboss.tools.deltacloud.core.IInstanceListListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class InstancesCategoryViewElement extends CloudElementCategoryViewElement<DeltaCloudInstance> implements IInstanceListListener {
+
+ private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName"; //$NON-NLS-1$
+
+ protected InstancesCategoryViewElement(Object model, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(model, parent, viewer);
+ }
+
+ public String getName() {
+ return CVMessages.getString(INSTANCE_CATEGORY_NAME);
+ }
+
+ @Override
+ protected void asyncGetCloudElements() {
+ setLoadingIndicator();
+ new GetInstancesCommand(getCloud()){
+
+ @Override
+ protected void asyncGetInstances() throws DeltaCloudException {
+ try {
+ super.asyncGetInstances();
+ } catch(DeltaCloudException e) {
+ clearChildren();
+ throw e;
+ }
+ }
+
+ }.execute();
+ }
+
+ @Override
+ protected DeltaCloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
+ DeltaCloudViewElement[] elements = new DeltaCloudViewElement[stopIndex - startIndex];
+ for (int i = startIndex; i < stopIndex; ++i) {
+ elements[i - startIndex] = new InstanceViewElement(modelElements[i], this, viewer);
+ }
+ return elements;
+ }
+
+ @Override
+ public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
+ try {
+ onListChanged(cloud, newInstances);
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get instances from cloud \"{0}\"", cloud.getName()), e,
+ viewer.getControl().getShell());
+ }
+ }
+
+ @Override
+ protected DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) throws DeltaCloudException {
+ DeltaCloud cloud = (DeltaCloud) getModel();
+ IInstanceFilter f = cloud.getInstanceFilter();
+ return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
+ }
+
+ protected void addCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.addInstanceListListener(this);
+ }
+ }
+
+ protected void removeCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.removeInstanceListListener(this);
+ }
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudElementViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudElementViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudElementViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * A tree element that shows the user that the tree is currently loading
+ * elements
+ */
+public class LoadingCloudElementViewElement extends DeltaCloudViewElement {
+
+ protected LoadingCloudElementViewElement(DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(null, parent, viewer);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for this element
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO: internationalize strings
+ return "Loading...";
+ }
+}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.deltacloud.ui.views.cloud;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * A tree element that shows the user that the tree is currently loading
- * elements
- */
-public class LoadingCloudViewElement extends CloudViewElement {
- protected LoadingCloudViewElement(CloudViewElement parent, TreeViewer viewer) {
- super(null, parent, viewer);
- }
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for this element
- return null;
- }
-
- @Override
- public String getName() {
- // TODO: internationalize strings
- return "Loading...";
- }
-}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/NumericFoldingViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/NumericFoldingViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/NumericFoldingViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class NumericFoldingViewElement extends DeltaCloudViewElement {
+
+ public static int FOLDING_SIZE = 50;
+ private Object min;
+ private int max;
+
+ protected NumericFoldingViewElement(int min, int max, DeltaCloudViewElement parent, TreeViewer viewer) {
+ super(null, parent, viewer);
+ this.min = min;
+ this.max = max;
+ }
+
+ @Override
+ public String getName() {
+ return new StringBuilder()
+ .append("[")
+ .append(min)
+ .append("..")
+ .append(max - 1)
+ .append("]").toString();
+ }
+
+ @Override
+ public Object[] getChildren() {
+ return super.getChildren();
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return null;
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/RootViewElement.java (from rev 27203, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/RootViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/RootViewElement.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class RootViewElement extends DeltaCloudViewElement implements ICloudManagerListener {
+
+ protected RootViewElement(TreeViewer viewer) {
+ super(DeltaCloudManager.getDefault(), null, viewer); //$NON-NLS-1$
+ DeltaCloudManager.getDefault().addCloudManagerListener(this);
+ }
+
+ @Override
+ public String getName() {
+ return "root"; //$NON-NLS-1$
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for the root element
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized.get()) {
+ DeltaCloudManager m = DeltaCloudManager.getDefault();
+ try {
+ addClouds(m.getClouds());
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError("Error", "Could not get clouds", e, Display.getDefault().getActiveShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+ return super.getChildren();
+ }
+
+ private void addClouds(DeltaCloud[] clouds) {
+ for (DeltaCloud cloud : clouds) {
+ addCloud(cloud);
+ }
+ }
+
+ private void addCloud(DeltaCloud cloud) {
+ CloudViewElement e = new CloudViewElement(cloud, this, viewer);
+ children.add(e);
+ }
+
+ private DeltaCloudViewElement getCloudViewElement(DeltaCloud cloudToMatch) {
+ for (DeltaCloudViewElement cloudElement : children) {
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getModel();
+ if (cloudToMatch.equals(cloud)) {
+ return cloudElement;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ DeltaCloudManager.getDefault().removeCloudManagerListener(this);
+ }
+
+ public void cloudsChanged(int type, DeltaCloud cloud) {
+ switch (type) {
+ case ICloudManagerListener.ADD_EVENT:
+ addChild(new CloudViewElement(cloud, this, viewer));
+ break;
+ case ICloudManagerListener.REMOVE_EVENT:
+ removeChild(getCloudViewElement(cloud));
+ break;
+ case ICloudManagerListener.RENAME_EVENT:
+ DeltaCloudViewElement cloudViewElement = getCloudViewElement(cloud);
+ viewer.refresh(cloudViewElement);
+ break;
+ }
+ initialized.set(true);
+ }
+}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -21,7 +21,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.InstanceViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
public class InstancePropertySource implements IPropertySource {
@@ -49,7 +49,7 @@
private DeltaCloudInstance instance;
private DeltaCloud cloud;
- public InstancePropertySource(CVInstanceElement element, Object o) {
+ public InstancePropertySource(InstanceViewElement element, Object o) {
cloud = CloudViewElementUtils.getCloud(element);
instance = (DeltaCloudInstance) o;
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java 2010-12-07 12:16:53 UTC (rev 27209)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java 2010-12-07 12:40:13 UTC (rev 27210)
@@ -11,8 +11,8 @@
package org.jboss.tools.internal.deltacloud.ui.utils;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewElement;
public class CloudViewElementUtils {
@@ -24,14 +24,14 @@
* @return the cloud for the given CloudViewElement
*
* @see DeltaCloud
- * @see CloudViewElement
+ * @see DeltaCloudViewElement
*/
- public static DeltaCloud getCloud(CloudViewElement element) {
- CVCloudElement cvCloud = getCVCloudElement(element);
+ public static DeltaCloud getCloud(DeltaCloudViewElement element) {
+ CloudViewElement cvCloud = getCVCloudElement(element);
if (cvCloud == null) {
return null;
}
- DeltaCloud cloud = (DeltaCloud) cvCloud.getElement();
+ DeltaCloud cloud = (DeltaCloud) cvCloud.getModel();
return cloud;
}
@@ -42,15 +42,15 @@
* the cloud view element to get the CVCloudElement for
* @return the CVCloudElement for the given CloudViewElement
*
+ * @see DeltaCloudViewElement
* @see CloudViewElement
- * @see CVCloudElement
*/
- public static CVCloudElement getCVCloudElement(CloudViewElement element) {
- while (!(element instanceof CVCloudElement)
+ public static CloudViewElement getCVCloudElement(DeltaCloudViewElement element) {
+ while (!(element instanceof CloudViewElement)
&& element != null) {
- element = (CloudViewElement) element.getParent();
+ element = (DeltaCloudViewElement) element.getParent();
}
- return (CVCloudElement) element;
+ return (CloudViewElement) element;
}
}
14 years
JBoss Tools SVN: r27209 - trunk/jst/plugins/org.jboss.tools.jst.css/META-INF.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-07 07:16:53 -0500 (Tue, 07 Dec 2010)
New Revision: 27209
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
Log:
Fixed compilation problems.
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF 2010-12-07 11:21:58 UTC (rev 27208)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF 2010-12-07 12:16:53 UTC (rev 27209)
@@ -19,7 +19,7 @@
org.eclipse.wst.sse.ui,
org.jboss.tools.common;bundle-version="3.2.0",
org.jboss.tools.common.text.ext;bundle-version="3.2.0",
- org.eclipse.wst.css.ui;bundle-version="1.0.501",
+ org.eclipse.wst.css.ui,
org.jboss.tools.common.model.ui;bundle-version="3.2.0",
org.jboss.tools.jst.web.kb;bundle-version="3.2.0",
org.jboss.tools.common.el.core;bundle-version="3.2.0",
14 years
JBoss Tools SVN: r27208 - trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-12-07 06:21:58 -0500 (Tue, 07 Dec 2010)
New Revision: 27208
Modified:
trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/browse/JBIDE-7740, removing unused dependency from plugin
Modified: trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF 2010-12-07 10:41:14 UTC (rev 27207)
+++ trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF 2010-12-07 11:21:58 UTC (rev 27208)
@@ -22,8 +22,7 @@
org.jboss.tools.jst.jsp,
org.eclipse.wst.xml.core,
org.jboss.tools.common.text.ext,
- org.jboss.tools.jst.web,
- org.jboss.tools.jsf.ui.test;bundle-version="3.2.0"
+ org.jboss.tools.jst.web
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
14 years