JBoss Tools SVN: r13189 - trunk/esb/docs/esb_ref_guide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-01-22 09:26:15 -0500 (Thu, 22 Jan 2009)
New Revision: 13189
Modified:
trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml
trunk/esb/docs/esb_ref_guide/en/modules/esb_support.xml
trunk/esb/docs/esb_ref_guide/en/modules/introduction.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-571 - deleting the old markers;
Modified: trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml 2009-01-22 14:25:26 UTC (rev 13188)
+++ trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml 2009-01-22 14:26:15 UTC (rev 13189)
@@ -15,7 +15,7 @@
addition you'll get to know with how <property>ESB Editor</property> uses combined
visual and source editing of esb files.</para>
- <section id="esb_file" role="updated">
+ <section id="esb_file">
<title>ESB File Editor</title>
<para><property>ESB File Editor</property> is a powerful and customizable tool. ESB File
Modified: trunk/esb/docs/esb_ref_guide/en/modules/esb_support.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en/modules/esb_support.xml 2009-01-22 14:25:26 UTC (rev 13188)
+++ trunk/esb/docs/esb_ref_guide/en/modules/esb_support.xml 2009-01-22 14:26:15 UTC (rev 13189)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="esb_support" role="updated">
+<chapter id="esb_support">
<?dbhtml filename="esb_support.html"?>
<chapterinfo>
<keywordset>
@@ -29,7 +29,7 @@
>InstallingJBossTools</ulink> section.</para>
</section>
- <section role="new">
+ <section>
<title>Creating a ESB Project</title>
<para>In this chapter we suggest a step-by-step walk-through of creating a new
ESB project. Let's try to create a new JBoss ESB project.</para>
@@ -105,7 +105,7 @@
</section>
- <section id="ESB_project_wizard" xreflabel="here" role="new">
+ <section id="ESB_project_wizard" xreflabel="here">
<title>Creating ESB Project using JBoss Tools Project Examples Wizard</title>
<para>JBoss Tools provides a Project Example wizard that is an easy way for users to create some kinds of projects to be used as examples with some predefined structure. Let's start
creating a ESB project using this wizard.</para>
@@ -156,7 +156,7 @@
<para> Deploy the HelloWorld ESB project and run a test class in the client Java project to see the test result in the Console view.</para>
</section>
- <section role="new">
+ <section>
<title>Deploying a ESB Project</title>
<para>In this chapter youwill see how to deploy a ESB project using the WTP deployment framework.</para>
@@ -242,7 +242,7 @@
</section>
- <section role="new">
+ <section>
<title>Configuring ESB Runtime in Preferences</title>
<para>In this chapter you will know how to predefine a JBoss ESB runtime on the Preferences page.</para>
@@ -296,7 +296,7 @@
</section>
- <section id="using_SOA" role="new">
+ <section id="using_SOA">
<title>Using and Configuring SOA Platform</title>
<para>In this chapter you will know what is JBoss Enterprise SOA Platform and how you can configure it to use for your ESB projects. </para>
Modified: trunk/esb/docs/esb_ref_guide/en/modules/introduction.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en/modules/introduction.xml 2009-01-22 14:25:26 UTC (rev 13188)
+++ trunk/esb/docs/esb_ref_guide/en/modules/introduction.xml 2009-01-22 14:26:15 UTC (rev 13189)
@@ -16,7 +16,7 @@
<title>Introduction</title>
- <section role="updated">
+ <section>
<title>What is ESB?</title>
15 years, 11 months
JBoss Tools SVN: r13188 - in trunk/jmx/docs/reference/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2009-01-22 09:25:26 -0500 (Thu, 22 Jan 2009)
New Revision: 13188
Added:
trunk/jmx/docs/reference/en/modules/connection.xml
trunk/jmx/docs/reference/en/modules/how_to.xml
trunk/jmx/docs/reference/en/modules/mbean_explorer.xml
Modified:
trunk/jmx/docs/reference/en/master.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-528
missing modules are added to guide build and master.xml
Modified: trunk/jmx/docs/reference/en/master.xml
===================================================================
--- trunk/jmx/docs/reference/en/master.xml 2009-01-22 14:23:34 UTC (rev 13187)
+++ trunk/jmx/docs/reference/en/master.xml 2009-01-22 14:25:26 UTC (rev 13188)
@@ -4,17 +4,11 @@
[<!ENTITY introduction SYSTEM "modules/introduction.xml">
<!ENTITY mbean_editor SYSTEM "modules/mbean_editor.xml">
-<!--ENTITY mbean_explorer SYSTEM "modules/mbean_explorer.xml">
+<!ENTITY mbean_explorer SYSTEM "modules/mbean_explorer.xml">
<!ENTITY connection SYSTEM "modules/connection.xml">
<!ENTITY how_to SYSTEM "modules/how_to.xml">
-<!ENTITY runtimes_servers SYSTEM "modules/runtimes_servers.xml">
-<!ENTITY perspective SYSTEM "modules/perspective.xml">
-<!ENTITY webtools SYSTEM "modules/webtools.xml">
-<!ENTITY modules SYSTEM "modules/modules.xml">
-<!ENTITY tptp_support SYSTEM "modules/tptp_support.xml"-->
-
<!ENTITY seamlink "../../seam/html_single/index.html">
<!ENTITY aslink "../../as/html_single/index.html">
<!ENTITY esblink "../../esb_ref_guide/html_single/index.html">
@@ -62,8 +56,8 @@
<toc/>
&introduction;
&mbean_editor;
-<!-- &mbean_explorer;
+ &mbean_explorer;
&connection;
&how_to;
--->
+
</book>
Added: trunk/jmx/docs/reference/en/modules/connection.xml
===================================================================
--- trunk/jmx/docs/reference/en/modules/connection.xml (rev 0)
+++ trunk/jmx/docs/reference/en/modules/connection.xml 2009-01-22 14:25:26 UTC (rev 13188)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="connection" xreflabel="connection">
+ <?dbhtml filename="connection.html"?>
+
+ <title>Connection</title>
+ <para> There are two ways to connect to an application with remote management enabled:</para>
+ <para> The first step is the same for both - to connect to a MBean Server - click on the
+ Connect... icon () in the MBean Explorer menu bar, </para>
+ <para>Then to follow the simple one you just need to specify host, port (and optionally user
+ name & password) and click OK</para>
+ <para>The default JMX URL is service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi </para>
+
+ <para> In case you need to connect to an application which has not used the "standard" JMX URL
+ (e.g. Eclipse Equinox), you need chose more advance way, where it's necessary to specify
+ explicitly a JMX URL in the Advanced Tab of the JMX Connection window </para>
+
+ <note>
+ <title>Note</title>
+ <para>only JMX URL based on RMI are supported </para>
+ </note>
+</chapter>
\ No newline at end of file
Added: trunk/jmx/docs/reference/en/modules/how_to.xml
===================================================================
--- trunk/jmx/docs/reference/en/modules/how_to.xml (rev 0)
+++ trunk/jmx/docs/reference/en/modules/how_to.xml 2009-01-22 14:25:26 UTC (rev 13188)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="how_to" xreflabel="how_to">
+ <?dbhtml filename="how_to.html"?>
+ <title>How to ...</title>
+ <para>This chapter will give you answers on most popular questions asked by JMX plugin users</para>
+
+ <section>
+ <title>How to Manage Tomcat </title>
+ <para>It's possible to manage Tomcat using eclipse-jmx</para>
+ <para> Currently, eclipse-jmx is able to connect to Tomcat without authentication or with password-based authentication.</para>
+ <para> Using SSL for authentication is not supported: you need to make sure that the System property com.sun.management.jmxremote.ssl is set to false.
+ </para>
+ <para> More information to manage Tomcat can be found in Tomcat management documentation </para>
+ <para> Instructions to manage remotely Tomcat are available in Tomcat's monitoring documentation.</para>
+
+ </section>
+
+ <section>
+ <title>How to manage Eclipse Equinox using eclipse-jmx</title>
+
+ <para> You can manage Equinox using eclipse-jmx through Equinox monitoring framework.</para>
+ <para> Once you have installed Equinox monitoring framework and restarted Eclipse:</para>
+ <itemizedlist>
+ <listitem><para> Go to Window > Open Perspective > Other... and select the JMX Resource Management perspective</para></listitem>
+ <listitem><para> Select JMX Server > Open Connection and click on OK</para></listitem>
+ <listitem><para> Switch to eclipse-jmx perspective by going to Window > Open Perspective > Other... and selecting the JMX perspective</para></listitem>
+ <listitem><para> click on the Connect... icon () in the MBean Explorer menu bar </para></listitem>
+ <listitem><para> select the Advanced tab and set the JMX URL to service:jmx:rmi:///jndi/rmi://:8118/jmxserver </para></listitem>
+ </itemizedlist>
+ <para> You now have access to the MBeans exposed by Equinox. </para>
+ </section>
+
+
+
+
+</chapter>
\ No newline at end of file
Added: trunk/jmx/docs/reference/en/modules/mbean_explorer.xml
===================================================================
--- trunk/jmx/docs/reference/en/modules/mbean_explorer.xml (rev 0)
+++ trunk/jmx/docs/reference/en/modules/mbean_explorer.xml 2009-01-22 14:25:26 UTC (rev 13188)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="mbean_explorer" xreflabel="mbean_explorer">
+ <?dbhtml filename="mbean_explorer.html"?>
+
+ <title>MBean Explorer</title>
+ <para>The MBean explorer displays the MBean features (both attributes and operations) in its
+ hierarchy. Double-clicking on a feature will open a MBean Editor, display the page
+ corresponding to the feature type and select the feature.</para>
+
+ <figure>
+ <title>MBean Explorer Features</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/mbean-explorer-features.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Since It's possible to have many MBean Editors opened at the same time, the MBean Explorer
+ has a Link With Editor checkbox to synchronize selections between the active MBean Editor and
+ the MBean explorer(and vice versa) </para>
+
+ <figure>
+ <title>Linking with Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/link-with-editor_0.2.0.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The MBean Explorer has also a filter text that can be used to filter among all the MBeans
+ the few ones, which interest you.</para>
+
+ <para>For example, if you are only interested by MBeans related to memory, typing memo will show
+ only the MBeans registered under an ObjectName, which contains memo: </para>
+
+ <para>A Collapse All button on the MBean Explorer toolbar is used to collapse all the MBeans and
+ display only the domains. It is also possible to double click on a node to expand/collapse it. </para>
+
+</chapter>
15 years, 11 months
JBoss Tools SVN: r13187 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-01-22 09:23:34 -0500 (Thu, 22 Jan 2009)
New Revision: 13187
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-571 - deleting the old marks;
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2009-01-22 14:19:43 UTC (rev 13186)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2009-01-22 14:23:34 UTC (rev 13187)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="first_seam" xreflabel="first_seam" role="updated">
+<chapter id="first_seam" xreflabel="first_seam">
<?dbhtml filename="first_seam.html"?>
<chapterinfo>
<keywordset>
@@ -41,7 +41,7 @@
</section>
- <section id="create_deploy_seam" role="updated">
+ <section id="create_deploy_seam">
<title>Create and deploy Seam Web Project</title>
<para>Minimize the terminal window and run the <property>JBoss Developer Studio</property>
@@ -308,7 +308,7 @@
</section>
- <section id="workshop_code_overview" role="updated">
+ <section id="workshop_code_overview">
<title>Workshop Project Code Overview</title>
<para>Now let's examine the project and its structure. Go back to the Package Explorer view in
@@ -544,7 +544,7 @@
</section>
- <section id="declarative_security" role="updated">
+ <section id="declarative_security">
<title>Declarative Security</title>
<para>In this section you will see how it’s easy to secure the facelets and facelet components
@@ -714,13 +714,13 @@
</section>
- <section id="db_programming" role="updated">
+ <section id="db_programming">
<title>Database Programming</title>
<para>Now, it’s time to reverse engineer the workshop database into a fully functioning Seam
CRUD(Create Read Update Delete) application.</para>
- <section id="reverse_engineer_crud" role="updated">
+ <section id="reverse_engineer_crud">
<title>Reverse Engineer CRUD from a Running Database</title>
<para>In <property>JBoss Developer Studio</property>, switch to <property>Seam
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2009-01-22 14:19:43 UTC (rev 13186)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2009-01-22 14:23:34 UTC (rev 13187)
@@ -34,7 +34,7 @@
guide we will show you how to install a 32-bit Sun JDK 5.0 on a Linux Platform and Microsoft
Windows Platform.</para>
- <section id="InstallJDK50onLinux" role="updated">
+ <section id="InstallJDK50onLinux">
<title>Installing and Configuring 32-bit Sun JDK 5.0 on Linux</title>
<para>To install 32-bit Sun JDK 5.0 on Linux and configure it, you should follow the next steps:</para>
<itemizedlist>
@@ -424,7 +424,7 @@
>JBoss.com</ulink></para>
</section>
- <section id="JBossToolsInstall" role="updated">
+ <section id="JBossToolsInstall">
<title>JBoss Tools Installation</title>
<para>Here, let's consider the installation of the <property>JBoss Tools</property>
modules.</para>
15 years, 11 months
JBoss Tools SVN: r13186 - trunk/as/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-01-22 09:19:43 -0500 (Thu, 22 Jan 2009)
New Revision: 13186
Modified:
trunk/as/docs/reference/en/modules/perspective.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-571 - deleting the old markers;
Modified: trunk/as/docs/reference/en/modules/perspective.xml
===================================================================
--- trunk/as/docs/reference/en/modules/perspective.xml 2009-01-22 13:52:15 UTC (rev 13185)
+++ trunk/as/docs/reference/en/modules/perspective.xml 2009-01-22 14:19:43 UTC (rev 13186)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="perspective" xreflabel="perspective" role="updated">
+<chapter id="perspective" xreflabel="perspective">
<?dbhtml filename="perspective.html"?>
<chapterinfo>
<keywordset>
@@ -22,7 +22,7 @@
<property>Project archives view</property> and the <property>JBoss Server
View</property>.</para>
- <section id="JBossServerView" role="updated">
+ <section id="JBossServerView">
<?dbhtml filename="JBossServerView.html"?>
<title>The JBoss Server View</title>
@@ -641,7 +641,7 @@
</section>
</section>
- <section id="Project_archivesView" role="updated">
+ <section id="Project_archivesView">
<title>Project Archives View</title>
<para>Every application, whether Plain Old Java, J2EE, or some other language altogether,
needs to be packaged in some way. In Java-related projects, many people use ANT. </para>
15 years, 11 months
JBoss Tools SVN: r13185 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui: jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-01-22 08:52:15 -0500 (Thu, 22 Jan 2009)
New Revision: 13185
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerDecorator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersDropAdapter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersView.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersViewDropAdapterAssistant.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerDecorator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersView.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersViewDropAdapterAssistant.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
package renamed and headers added
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -36,7 +36,7 @@
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.actions.ExploreUtils;
-import org.jboss.tools.as.wst.server.ui.ServerActionProvider;
+import org.jboss.tools.as.wst.server.ui.xpl.ServerActionProvider;
public class ModuleActionProvider extends CommonActionProvider {
private Action deleteModuleAction, fullPublishModuleAction, incrementalPublishModuleAction;
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerActionProvider.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerActionProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,322 +0,0 @@
-package org.jboss.tools.as.wst.server.ui;
-
-import java.util.Iterator;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.bindings.TriggerSequence;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.keys.IBindingService;
-import org.eclipse.ui.navigator.CommonActionProvider;
-import org.eclipse.ui.navigator.CommonViewer;
-import org.eclipse.ui.navigator.ICommonActionExtensionSite;
-import org.eclipse.ui.navigator.ICommonViewerSite;
-import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.actions.NewServerWizardAction;
-import org.eclipse.wst.server.ui.internal.view.servers.CopyAction;
-import org.eclipse.wst.server.ui.internal.view.servers.DeleteAction;
-import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-import org.eclipse.wst.server.ui.internal.view.servers.ModuleSloshAction;
-import org.eclipse.wst.server.ui.internal.view.servers.MonitorServerPortAction;
-import org.eclipse.wst.server.ui.internal.view.servers.OpenAction;
-import org.eclipse.wst.server.ui.internal.view.servers.PasteAction;
-import org.eclipse.wst.server.ui.internal.view.servers.PropertiesAction;
-import org.eclipse.wst.server.ui.internal.view.servers.PublishAction;
-import org.eclipse.wst.server.ui.internal.view.servers.PublishCleanAction;
-import org.eclipse.wst.server.ui.internal.view.servers.RemoveModuleAction;
-import org.eclipse.wst.server.ui.internal.view.servers.RenameAction;
-import org.eclipse.wst.server.ui.internal.view.servers.RestartModuleAction;
-import org.eclipse.wst.server.ui.internal.view.servers.ShowInConsoleAction;
-import org.eclipse.wst.server.ui.internal.view.servers.ShowInDebugAction;
-import org.eclipse.wst.server.ui.internal.view.servers.StartAction;
-import org.eclipse.wst.server.ui.internal.view.servers.StartModuleAction;
-import org.eclipse.wst.server.ui.internal.view.servers.StopAction;
-import org.eclipse.wst.server.ui.internal.view.servers.StopModuleAction;
-import org.jboss.ide.eclipse.as.ui.actions.ExploreAction;
-
-public class ServerActionProvider extends CommonActionProvider {
- public static final String NEW_MENU_ID = "org.jboss.tools.as.wst.server.ui.internal.cnf.newMenuId";
- public static final String SHOW_IN_MENU_ID = "org.jboss.tools.as.wst.server.ui.internal.cnf.showInMenuId";
- public static final String TOP_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.topSectionStart";
- public static final String TOP_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.topSectionEnd";
- public static final String EDIT_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnfeditSectionStart";
- public static final String EDIT_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.editSectionEnd";
- public static final String CONTROL_SERVER_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlServerSectionStart";
- public static final String CONTROL_SERVER_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlServerSectionEnd";
- public static final String SERVER_ERATA_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.serverErataSectionStart";
- public static final String SERVER_ERATA_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.serverErataSectionEnd";
- public static final String CONTROL_MODULE_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlModuleSectionStart";
- public static final String CONTROL_MODULE_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlModuleSectionEnd";
-
- private ICommonActionExtensionSite actionSite;
- private Clipboard clipboard;
- public ServerActionProvider() {
- super();
- }
-
- public void init(ICommonActionExtensionSite aSite) {
- super.init(aSite);
- this.actionSite = aSite;
- ICommonViewerSite site = aSite.getViewSite();
- if( site instanceof ICommonViewerWorkbenchSite ) {
- StructuredViewer v = aSite.getStructuredViewer();
- if( v instanceof CommonViewer ) {
- CommonViewer cv = (CommonViewer)v;
- ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
- addListeners(cv);
- makeServerActions(cv, wsSite.getSelectionProvider());
- }
- }
- }
-
-
- // actions on a server
- protected Action[] actions;
- protected Action actionModifyModules;
- protected Action openAction, showInConsoleAction, showInDebugAction, propertiesAction, monitorPropertiesAction;
- protected Action copyAction, pasteAction, deleteAction, renameAction;
- protected Action noneAction = new Action(Messages.dialogMonitorNone) {
- // dummy action
- };
-
- private void addListeners(CommonViewer tableViewer) {
- tableViewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- try {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- Object data = sel.getFirstElement();
- if (!(data instanceof IServer))
- return;
- IServer server = (IServer) data;
- ServerUIPlugin.editServer(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not open server", e);
- }
- }
- });
- }
-
- private void makeServerActions(CommonViewer tableViewer, ISelectionProvider provider) {
- clipboard = new Clipboard(tableViewer.getTree().getDisplay());
- Shell shell = tableViewer.getTree().getShell();
-
- actions = new Action[7];
- // create the start actions
- actions[0] = new StartAction(shell, provider, ILaunchManager.DEBUG_MODE);
- actions[1] = new StartAction(shell, provider, ILaunchManager.RUN_MODE);
- actions[2] = new StartAction(shell, provider, ILaunchManager.PROFILE_MODE);
-
- // create the stop action
- actions[3] = new StopAction(shell, provider);
-
- // create the publish actions
- actions[4] = new PublishAction(shell, provider);
- actions[5] = new PublishCleanAction(shell, provider);
- actions[6] = new ExploreAction(shell,provider);
-
- // create the open action
- openAction = new OpenAction(provider);
-
-// // create copy, paste, and delete actions
- pasteAction = new PasteAction(shell, provider, clipboard);
- copyAction = new CopyAction(provider, clipboard, pasteAction);
- deleteAction = new DeleteAction(shell, provider);
- renameAction = new RenameAction(shell, tableViewer, provider);
-
- // create the other actions
- actionModifyModules = new ModuleSloshAction(shell, provider);
- showInConsoleAction = new ShowInConsoleAction(provider);
- showInDebugAction = new ShowInDebugAction(provider);
-
- // create the properties action
- propertiesAction = new PropertiesAction(shell, provider);
- monitorPropertiesAction = new PropertiesAction(shell, "org.eclipse.wst.server.ui.properties.monitor", provider);
- }
-
- public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler("org.eclipse.wst.server.debug", actions[0]);
- actionBars.setGlobalActionHandler("org.eclipse.wst.server.run", actions[1]);
- actionBars.setGlobalActionHandler("org.eclipse.wst.server.stop", actions[3]);
- actionBars.setGlobalActionHandler("org.eclipse.wst.server.publish", actions[4]);
- actionBars.setGlobalActionHandler("org.eclipse.ui.navigator.Open", openAction);
- actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
- actionBars.updateActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
-
- IContributionManager cm = actionBars.getToolBarManager();
- cm.removeAll();
-
- for (int i = 0; i < actions.length - 1; i++)
- cm.add(actions[i]);
- }
-
- public void fillContextMenu(IMenuManager menu) {
- ICommonViewerSite site = actionSite.getViewSite();
- IStructuredSelection selection = null;
- Shell shell = actionSite.getViewSite().getShell();
- if( site instanceof ICommonViewerWorkbenchSite ) {
- ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
- selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
- }
-
- IServer server = null;
- IModule[] module = null;
- if (selection != null && !selection.isEmpty()) {
- Iterator iterator = selection.iterator();
- Object obj = iterator.next();
- if (obj instanceof IServer)
- server = (IServer) obj;
- if (obj instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) obj;
- server = ms.server;
- module = ms.module;
- }
- if (iterator.hasNext()) {
- server = null;
- module = null;
- }
- }
-
- menu.add(invisibleSeparator(TOP_SECTION_START_SEPARATOR));
- addTopSection(menu, server, module);
- menu.add(invisibleSeparator(TOP_SECTION_END_SEPARATOR));
- menu.add(new Separator());
-
- if (server != null && module == null) {
- menu.add(invisibleSeparator(EDIT_SECTION_START_SEPARATOR));
- menu.add(copyAction);
- menu.add(pasteAction);
- menu.add(deleteAction);
- menu.add(renameAction);
- menu.add(invisibleSeparator(EDIT_SECTION_END_SEPARATOR));
-
- menu.add(new Separator());
-
- menu.add(invisibleSeparator(CONTROL_SERVER_SECTION_START_SEPARATOR));
- for (int i = 0; i < actions.length; i++)
- menu.add(actions[i]);
- menu.add(invisibleSeparator(CONTROL_SERVER_SECTION_END_SEPARATOR));
-
- menu.add(new Separator());
-
- menu.add(invisibleSeparator(SERVER_ERATA_SECTION_START_SEPARATOR));
- menu.add(actionModifyModules);
- addMonitor(server, menu, shell);
- menu.add(invisibleSeparator(SERVER_ERATA_SECTION_END_SEPARATOR));
- menu.add(new Separator());
- menu.add(propertiesAction);
-
- } else if (server != null && module != null) {
-
- menu.add(invisibleSeparator(CONTROL_MODULE_SECTION_START_SEPARATOR));
- menu.add(new StartModuleAction(server, module));
- menu.add(new StopModuleAction(server, module));
- menu.add(new RestartModuleAction(server, module));
- if(module.length == 1) {
- menu.add(new RemoveModuleAction(shell, server, module[0]));
- }
- menu.add(invisibleSeparator(CONTROL_MODULE_SECTION_END_SEPARATOR));
- }
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));
- }
-
- protected void addTopSection(IMenuManager menu, IServer server, IModule[] module) {
- MenuManager newMenu = new MenuManager(Messages.actionNew, NEW_MENU_ID);
- IAction newServerAction = new NewServerWizardAction();
- newServerAction.setText(Messages.actionNewServer);
- newMenu.add(newServerAction);
- menu.add(newMenu);
-
- // open action
- if (server != null && module == null) {
- menu.add(openAction);
-
- String text = Messages.actionShowIn;
- final IWorkbench workbench = PlatformUI.getWorkbench();
- final IBindingService bindingService = (IBindingService) workbench
- .getAdapter(IBindingService.class);
- final TriggerSequence[] activeBindings = bindingService
- .getActiveBindingsFor("org.eclipse.ui.navigate.showInQuickMenu");
- if (activeBindings.length > 0) {
- text += "\t" + activeBindings[0].format();
- }
-
- MenuManager showInMenu = new MenuManager(text, "org.eclipse.ui.navigate.showInQuickMenu");
- showInMenu.add(showInConsoleAction);
- showInMenu.add(showInDebugAction);
- menu.add(showInMenu);
- }
- }
-
- protected void addMonitor(IServer server, IMenuManager menu, Shell shell) {
-
- if (server.getServerType() != null) {
- final MenuManager menuManager = new MenuManager(Messages.actionMonitor);
-
- final IServer server2 = server;
- final Shell shell2 = shell;
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- menuManager.removeAll();
- if (server2.getAdapter(ServerDelegate.class) != null) {
- ServerPort[] ports = server2.getServerPorts(null);
- if (ports != null) {
- int size = ports.length;
- for (int i = 0; i < size; i++) {
- if (!ports[i].isAdvanced())
- menuManager.add(new MonitorServerPortAction(shell2, server2, ports[i]));
- }
- }
- }
-
- if (menuManager.isEmpty())
- menuManager.add(noneAction);
-
- menuManager.add(new Separator());
- menuManager.add(monitorPropertiesAction);
- }
- });
-
- // add an initial menu item so that the menu appears correctly
- noneAction.setEnabled(false);
- menuManager.add(noneAction);
- menu.add(menuManager);
- }
- }
-
-
- private Separator invisibleSeparator(String s) {
- Separator sep = new Separator(s);
- sep.setVisible(false);
- return sep;
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerContentProvider.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerContentProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,352 +0,0 @@
-package org.jboss.tools.as.wst.server.ui;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IPublishListener;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerLifecycleListener;
-import org.eclipse.wst.server.core.IServerListener;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerEvent;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.UpdateServerJob;
-import org.eclipse.wst.server.core.util.PublishAdapter;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-import org.eclipse.wst.server.ui.internal.viewers.BaseContentProvider;
-
-public class ServerContentProvider extends BaseContentProvider implements ITreeContentProvider {
- public static Object INITIALIZING = new Object();
- protected IServerLifecycleListener serverResourceListener;
- protected IPublishListener publishListener;
- protected IServerListener serverListener;
-
- // servers that are currently publishing and starting
- protected static Set<String> publishing = new HashSet<String>(4);
- protected static Set<String> starting = new HashSet<String>(4);
- protected boolean animationActive = false;
- protected boolean stopAnimation = false;
- protected boolean initialized = false;
-
-
- private StructuredViewer viewer;
-
- public ServerContentProvider() {
- addListeners();
- }
-
- public Object[] getElements(Object element) {
- if( !initialized ) {
- deferInitialization();
- return new Object[] {INITIALIZING};
- }
-
- List<IServer> list = new ArrayList<IServer>();
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (!((Server)servers[i]).isPrivate())
- list.add(servers[i]);
- }
- }
- return list.toArray();
- }
-
- public Object[] getChildren(Object element) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- try {
- IModule[] children = ms.server.getChildModules(ms.module, null);
- int size = children.length;
- ModuleServer[] ms2 = new ModuleServer[size];
- for (int i = 0; i < size; i++) {
- int size2 = ms.module.length;
- IModule[] module = new IModule[size2 + 1];
- System.arraycopy(ms.module, 0, module, 0, size2);
- module[size2] = children[i];
- ms2[i] = new ModuleServer(ms.server, module);
- }
- return ms2;
- } catch (Exception e) {
- return null;
- }
- }
-
- IServer server = (IServer) element;
- IModule[] modules = server.getModules();
- int size = modules.length;
- ModuleServer[] ms = new ModuleServer[size];
- for (int i = 0; i < size; i++) {
- ms[i] = new ModuleServer(server, new IModule[] { modules[i] });
- }
- return ms;
- }
-
- public Object getParent(Object element) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- return ms.server;
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof ModuleServer) {
- // Check if the module server has child modules.
- ModuleServer curModuleServer = (ModuleServer)element;
- IServer curServer = curModuleServer.server;
- IModule[] curModule = curModuleServer.module;
- if (curServer != null && curModule != null) {
- IModule[] curChildModule = curServer.getChildModules(curModule, null);
- if (curChildModule != null && curChildModule.length > 0)
- return true;
-
- return false;
- }
-
- return false;
- }
- if( element instanceof IServer ) {
- return ((IServer) element).getModules().length > 0;
- }
- return false;
- }
-
- public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
- viewer = (StructuredViewer) aViewer;
- }
-
- public void dispose() {
- // remove all listeners!
- ServerCore.removeServerLifecycleListener(serverResourceListener);
- IServer[] servers = ServerCore.getServers();
- for( int i = 0;i < servers.length; i++ ) {
- servers[i].removePublishListener(publishListener);
- servers[i].removeServerListener(serverListener);
- }
- }
-
-
-
- // Listeners and refreshing the viewer
- protected void addListeners() {
- serverResourceListener = new IServerLifecycleListener() {
- public void serverAdded(IServer server) {
- refreshServer(null);
- server.addServerListener(serverListener);
- ((Server) server).addPublishListener(publishListener);
- }
- public void serverChanged(IServer server) {
- refreshServer(server);
- }
- public void serverRemoved(IServer server) {
- refreshServer(null);
- server.removeServerListener(serverListener);
- ((Server) server).removePublishListener(publishListener);
- }
- };
- ServerCore.addServerLifecycleListener(serverResourceListener);
-
- publishListener = new PublishAdapter() {
- public void publishStarted(IServer server) {
- handlePublishChange(server, true);
- }
-
- public void publishFinished(IServer server, IStatus status) {
- handlePublishChange(server, false);
- }
- };
-
- serverListener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- if (event == null)
- return;
-
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
- // server change event
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
- refreshServer(server, true);
- int state = event.getState();
- String id = server.getId();
- if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
- boolean startThread = false;
- synchronized (starting) {
- if (!starting.contains(id)) {
- if (starting.isEmpty())
- startThread = true;
- starting.add(id);
- }
- }
- if (startThread)
- startThread();
- } else {
- boolean stopThread = false;
- synchronized (starting) {
- if (starting.contains(id)) {
- starting.remove(id);
- if (starting.isEmpty())
- stopThread = true;
- }
- }
- if (stopThread)
- stopThread();
- }
- } else
- refreshServer(server);
- } else if ((eventKind & ServerEvent.MODULE_CHANGE) != 0) {
- // module change event
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0 || (eventKind & ServerEvent.PUBLISH_STATE_CHANGE) != 0) {
- refreshServer(server);
- }
- }
- }
- };
-
- // add listeners to servers
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].addServerListener(serverListener);
- ((Server) servers[i]).addPublishListener(publishListener);
- }
- }
- }
-
- protected void deferInitialization() {
- Job job = new Job(Messages.jobInitializingServersView) {
- public IStatus run(IProgressMonitor monitor) {
- IServer[] servers = ServerCore.getServers();
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- ((Server)servers[i]).getAllModules().iterator();
- }
-
- for (int i = 0; i < size; i++) {
- IServer server = servers[i];
- if (server.getServerType() != null && server.getServerState() == IServer.STATE_UNKNOWN) {
- UpdateServerJob job2 = new UpdateServerJob(server);
- job2.schedule();
- }
- }
- initialized = true;
- refreshServer(null);
- return Status.OK_STATUS;
- }
- };
-
- job.setSystem(true);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
-
- protected void updateServerLabel(final IServer server) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- try {
- if( viewer != null && !viewer.getControl().isDisposed()) {
- viewer.update(server, null);
- ServerDecorator.getDefault().redecorate(server);
- }
- } catch (Exception e) {
- // ignore
- }
- }
- });
- }
-
- protected void refreshServer(final IServer server) {
- refreshServer(server, false);
- }
- protected void refreshServer(final IServer server, final boolean resetSelection) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- try {
- if( viewer != null && !viewer.getControl().isDisposed()) {
- viewer.refresh(server);
- if( resetSelection ) {
- ISelection sel = viewer.getSelection();
- viewer.setSelection(sel);
- }
- ServerDecorator.getDefault().redecorate(server);
- }
- } catch (Exception e) {
- // ignore
- }
- }
- });
- }
-
- protected void handlePublishChange(IServer server, boolean isPublishing) {
- String serverId = server.getId();
- if (isPublishing)
- publishing.add(serverId);
- else
- publishing.remove(serverId);
-
- refreshServer(server);
- }
-
-
- protected void startThread() {
- if (animationActive)
- return;
-
- stopAnimation = false;
-
- final Display display = viewer == null ? Display.getDefault() : viewer.getControl().getDisplay();
- final int SLEEP = 200;
- final Runnable[] animator = new Runnable[1];
- animator[0] = new Runnable() {
- public void run() {
- if (!stopAnimation) {
- try {
- int size = 0;
- String[] servers;
- synchronized (starting) {
- size = starting.size();
- servers = new String[size];
- starting.toArray(servers);
- }
-
- for (int i = 0; i < size; i++) {
- IServer server = ServerCore.findServer(servers[i]);
- if (server != null ) {
- ServerDecorator.animate();
- updateServerLabel(server);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.FINEST, "Error in Servers view animation", e);
- }
- display.timerExec(SLEEP, animator[0]);
- }
- }
- };
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- display.timerExec(SLEEP, animator[0]);
- }
- });
- }
-
- protected void stopThread() {
- stopAnimation = true;
- }}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerDecorator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerDecorator.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerDecorator.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,196 +0,0 @@
-package org.jboss.tools.as.wst.server.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILightweightLabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.provisional.UIDecoratorManager;
-import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-
-public class ServerDecorator extends LabelProvider implements ILightweightLabelDecorator {
-
- public static final String[] syncState = new String[] {
- Messages.viewSyncOkay,
- Messages.viewSyncRestart,
- Messages.viewSyncPublish,
- Messages.viewSyncRestartPublish,
- Messages.viewSyncPublishing};
-
- public static final String[] syncStateUnmanaged = new String[] {
- Messages.viewSyncOkay2,
- Messages.viewSyncRestart2,
- Messages.viewSyncPublish2,
- Messages.viewSyncRestartPublish2,
- Messages.viewSyncPublishing2};
-
- public static final String[] modulePublishState = new String[] {
- "",
- Messages.viewSyncOkay,
- Messages.viewSyncPublish,
- Messages.viewSyncPublish};
-
- private static ServerDecorator instance;
- public static ServerDecorator getDefault() {
- return instance;
- }
-
- private static int count = 0;
- public static void animate() {
- count = (count + 1)%3;
- }
- public static int getCount() {
- return count;
- }
-
- public ServerDecorator() {
- instance = this;
- }
-
- public void decorate(Object element, IDecoration decoration) {
- if( element instanceof IServer ) {
- String state = getServerStateLabel((IServer)element);
- String status = getServerStatusLabel((IServer)element);
- decoration.addSuffix(combine(state, status));
- } else if( element instanceof ModuleServer ) {
- String state = getModuleStateText((ModuleServer)element);
- String status = getModuleStatusText((ModuleServer)element);
- decoration.addSuffix(combine(state, status));
- }
- }
-
- protected String combine(String state, String status) {
- if(isEmpty(state) && isEmpty(status))
- return "";
- if( isEmpty(state))
- return " [" + status + "]";
- if( isEmpty(status))
- return " [" + state + "]";
- return " [" + state + ", " + status + "]";
- }
-
- protected boolean isEmpty(String s) {
- return (s == null || "".equals(s));
- }
-
- public void redecorate(IServer server) {
- fireLabelProviderChanged(new LabelProviderChangedEvent(this));
- }
-
-
-
- /*
- * Utility methods
- */
- public static Image getServerImage(IServer server) {
- return server == null ? null :
- server.getServerType() == null ? null :
- ImageResource.getImage(server.getServerType().getId());
- }
-
- public static String getServerStateLabel(IServer server) {
- return server == null ? null :
- server.getServerType() == null ? null :
- getStateLabel(server.getServerType(), server.getServerState(), server.getMode());
- }
-
- public static String getStateLabel(IServerType serverType, int state, String mode) {
- return serverType == null ? null :
- UIDecoratorManager.getUIDecorator(serverType).getStateLabel(state, mode, count);
- }
-
- public static String getServerStatusLabel(IServer server) {
- IStatus status = ((Server) server).getServerStatus();
- if (status != null)
- return status.getMessage();
-
- if (server.getServerType() == null)
- return "";
-
- if (server.getServerState() == IServer.STATE_UNKNOWN)
- return "";
-
- String serverId = server.getId();
- if (ServerContentProvider.publishing.contains(serverId))
- return ServerDecorator.syncState[4];
-
- // republish
- int i = 0;
- if (server.shouldPublish()) {
- if (((Server)server).isPublishUnknown())
- return "";
- i += 2;
- }
-
- if (server.shouldRestart())
- i = 1;
-
- return syncState[i];
- }
-
- public static Image getServerStateImage(IServer server) {
- return server == null ? null :
- getStateImage(server.getServerType(), server.getServerState(), server.getMode());
- }
-
- public static Image getStateImage(IServerType serverType, int state, String mode) {
- return serverType == null ? null :
- UIDecoratorManager.getUIDecorator(serverType).getStateImage(state, mode, getCount());
- }
-
- public static String getModuleText(ModuleServer ms ) {
- if (ms == null || ms.module == null)
- return "";
- int size = ms.module.length;
- return ms.module[size - 1].getName();
- }
-
- public static Image getModuleImage(ModuleServer ms) {
- if( ms != null ) {
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- Image image = labelProvider.getImage(ms.module[ms.module.length - 1]);
- labelProvider.dispose();
- return image;
- }
- return null;
- }
-
- public static String getModuleStateText(ModuleServer ms) {
- return "";
- }
-
- public static String getModuleStatusText(ModuleServer ms) {
- if( ms != null && ms.server != null && ms.module != null ) {
- IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
- if (status != null)
- return status.getMessage();
-
- return modulePublishState[ms.server.getModulePublishState(ms.module)];
- }
- return "";
- }
-
- public static Image getModuleStatusImage(ModuleServer ms) {
- IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
- if (status != null) {
- ISharedImages sharedImages = ServerUIPlugin.getInstance().getWorkbench().getSharedImages();
- if (status.getSeverity() == IStatus.ERROR)
- return sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
- else if (status.getSeverity() == IStatus.WARNING)
- return sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
- else if (status.getSeverity() == IStatus.INFO)
- return sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
- }
- return null;
- }
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerLabelProvider.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerLabelProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * 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:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.as.wst.server.ui;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-/**
- * Server table label provider.
- */
-public class ServerLabelProvider extends LabelProvider {
-
- /**
- * ServerTableLabelProvider constructor comment.
- */
- public ServerLabelProvider() {
- super();
- }
-
- public String getText(Object element) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- if (ms.module == null)
- return "";
- int size = ms.module.length;
- String name = ms.module[size - 1].getName();
- return name;
- }
-
- if( element instanceof IServer ) {
- IServer server = (IServer) element;
- return notNull(server.getName());
- }
-
- if( element == ServerContentProvider.INITIALIZING)
- return Messages.viewInitializing;
-
- return "-";
- }
- public Image getImage(Object element) {
- Image image = null;
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- image = labelProvider.getImage(ms.module[ms.module.length - 1]);
- labelProvider.dispose();
- } else if( element instanceof IServer ) {
- IServer server = (IServer) element;
- if (server.getServerType() != null) {
- image = ImageResource.getImage(server.getServerType().getId());
- }
- }
- return image;
- }
-
- protected String notNull(String s) {
- if (s == null)
- return "";
- return s;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,321 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- * ken.ryall(a)nokia.com - 157506 drop from external sources does not work on Linux/Mac
- *******************************************************************************/
-package org.jboss.tools.as.wst.server.ui;
-
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.ui.internal.navigator.NavigatorPlugin;
-import org.eclipse.ui.internal.navigator.dnd.CommonDropAdapterDescriptor;
-import org.eclipse.ui.internal.navigator.dnd.CommonDropDescriptorManager;
-import org.eclipse.ui.internal.navigator.dnd.NavigatorPluginDropAction;
-import org.eclipse.ui.navigator.CommonDragAdapter;
-import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
-import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
-import org.eclipse.ui.navigator.CommonViewer;
-import org.eclipse.ui.navigator.INavigatorContentService;
-import org.eclipse.ui.navigator.INavigatorDnDService;
-import org.eclipse.ui.part.PluginDropAdapter;
-import org.eclipse.ui.part.PluginTransfer;
-
-/*
- * THIS CLASS IS A CLONE of CommonDropAdapter.
- * It is necessary because dragged items must be acceptable children.
- * Stupid restriction
- *
- * I use a delegate and push all methods to the delegate,
- * even the ones I override.
- *
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261606
- *
- * Maybe one day they'll fix that ;)
- */
-
-/**
- * Provides an implementation of {@link PluginDropAdapter} which uses the
- * extensions provided by the associated {@link INavigatorContentService}.
- *
- * <p>
- * Clients should not need to create an instance of this class unless they are
- * creating their own custom viewer. Otherwise, {@link CommonViewer} configures
- * its drop adapter automatically.
- * </p>
- *
- *
- * @see INavigatorDnDService
- * @see CommonDragAdapter
- * @see CommonDragAdapterAssistant
- * @see CommonDropAdapterAssistant
- * @see CommonViewer
- * @since 3.2
- */
-public final class ServersDropAdapter extends PluginDropAdapter {
- private static final Transfer[] SUPPORTED_DROP_TRANSFERS = new Transfer[] {
- LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(),
- PluginTransfer.getInstance() };
- private final INavigatorContentService contentService;
- private final INavigatorDnDService dndService;
-
- public ServersDropAdapter(INavigatorContentService aContentService,
- StructuredViewer aStructuredViewer) {
- super(aStructuredViewer);
- contentService = aContentService;
- dndService = contentService.getDnDService();
- }
-
- public Transfer[] getSupportedDropTransfers() {
- return SUPPORTED_DROP_TRANSFERS;
- }
-
- public void dragEnter(DropTargetEvent event) {
- super.dragEnter(event);
-
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(
- event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
- return;
- }
- }
-
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (FileTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- return;
- }
- }
-
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (PluginTransfer.getInstance()
- .isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
- return;
- }
- }
-
- event.detail = DND.DROP_NONE;
-
- }
-
- public void dragLeave(DropTargetEvent event) {
- super.dragLeave(event);
- if (LocalSelectionTransfer.getTransfer().isSupportedType(
- event.currentDataType)) {
- event.data = NavigatorPluginDropAction
- .createTransferData(contentService);
- }
- }
-
- /*
- * Changed from CommonDropAdapter to extract the findCommonDropAdapterAssistant section
- * since I do not like the impl in dnd service
- */
- public void drop(DropTargetEvent event) {
- // Must validate the drop here because on some platforms (Linux, Mac) the event
- // is not populated with the correct currentDataType until the drop actually
- // happens, and validateDrop sets the currentTransfer based on that. The
- // call to validateDrop in dragAccept is too early.
- validateDrop(getCurrentTarget(), getCurrentOperation(), event.currentDataType);
- if (PluginTransfer.getInstance().isSupportedType(event.currentDataType)) {
- super.drop(event);
- } else {
-
- Object target = getCurrentTarget() != null ?
- getCurrentTarget() : getViewer().getInput();
-
- CommonDropAdapterAssistant[] assistants =
- findCommonDropAdapterAssistants(target, getCurrentTransfer());
- IStatus valid = null;
- for (int i = 0; i < assistants.length; i++) {
- try {
- valid = assistants[i].validateDrop(getCurrentTarget(),
- getCurrentOperation(), getCurrentTransfer());
- if (valid != null && valid.isOK()) {
- assistants[i].handleDrop(null, event,
- getCurrentTarget());
- event.detail = DND.DROP_NONE;
- return;
- }
- } catch (Throwable t) {
- NavigatorPlugin.logError(0, t.getMessage(), t);
- }
- }
- event.detail = DND.DROP_NONE;
- }
- }
-
- /*
- * Changed from CommonDropAdapter to extract the findCommonDropAdapterAssistant section
- * since I do not like the impl in dnd service
- */
- public boolean validateDrop(Object aDropTarget, int theDropOperation,
- TransferData theTransferData) {
- boolean result = false;
- IStatus valid = null;
- if (super.validateDrop(aDropTarget, theDropOperation, theTransferData)) {
- result = true;
- } else {
- Object target = aDropTarget != null ? aDropTarget : getViewer().getInput();
- CommonDropAdapterAssistant[] assistants =
- findCommonDropAdapterAssistants(target,
- theTransferData);
- for (int i = 0; i < assistants.length; i++) {
- try {
- valid = assistants[i].validateDrop(target,
- theDropOperation, theTransferData);
- } catch (Throwable t) {
- NavigatorPlugin.logError(0, t.getMessage(), t);
- }
- if (valid != null && valid.isOK()) {
- result = true;
- break;
- }
- }
- }
- setScrollExpandEnabled(true);
- return result;
-
- }
-
- public Rectangle getBounds(Item item) {
- return super.getBounds(item);
- }
-
- public int getCurrentLocation() {
- return super.getCurrentLocation();
- }
-
- public int getCurrentOperation() {
- return super.getCurrentOperation();
- }
-
- public Object getCurrentTarget() {
- return super.getCurrentTarget();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.PluginDropAdapter#getCurrentTransfer()
- */
- public TransferData getCurrentTransfer() {
- return super.getCurrentTransfer();
- }
-
- /**
- * Returns the position of the given event's coordinates relative to its target.
- * The position is determined to be before, after, or on the item, based on
- * some threshold value.
- *
- * @param event the event
- * @return one of the <code>LOCATION_* </code>constants defined in this class
- */
- protected int determineLocation(DropTargetEvent event) {
- if (!(event.item instanceof Item)) {
- return LOCATION_NONE;
- }
- return LOCATION_ON;
- }
-
-
- private CommonDropAdapterAssistant[] findCommonDropAdapterAssistants(
- Object aDropTarget, TransferData theTransferType) {
- CommonDropAdapterAssistant[] result =
- findCommonDropAdapterAssistants2(aDropTarget, theTransferType);
- return result;
- }
-
-
-
- /*
- * Stolen from DND Service
- */
-
- private static final CommonDropAdapterAssistant[] NO_ASSISTANTS = new CommonDropAdapterAssistant[0];
- private final Map dropAssistants = new HashMap();
-
- public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants2(
- Object aDropTarget, TransferData aTransferType) {
-
- // TODO Make sure descriptors are sorted by priority
- CommonDropAdapterDescriptor[] descriptors = CommonDropDescriptorManager
- .getInstance().findCommonDropAdapterAssistants(aDropTarget,
- contentService);
-
- if (descriptors.length == 0) {
- return NO_ASSISTANTS;
- }
- if (LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType)
- && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) {
- return getAssistants(descriptors);
- }
- return getAssistantsByTransferData(descriptors, aTransferType);
- }
-
- private CommonDropAdapterAssistant[] getAssistants(CommonDropAdapterDescriptor[] descriptors) {
- Set assistants = new LinkedHashSet();
- for (int i = 0; i < descriptors.length; i++) {
- assistants.add(getAssistant(descriptors[i]));
- }
- return (CommonDropAdapterAssistant[]) assistants
- .toArray(new CommonDropAdapterAssistant[assistants.size()]);
- }
-
- private CommonDropAdapterAssistant[] getAssistantsByTransferData(
- CommonDropAdapterDescriptor[] descriptors,
- TransferData aTransferType) {
-
- Set assistants = new LinkedHashSet();
- for (int i = 0; i < descriptors.length; i++) {
- CommonDropAdapterAssistant asst = getAssistant(descriptors[i]);
- if (asst.isSupportedType(aTransferType)) {
- assistants.add(asst);
- }
- }
- return (CommonDropAdapterAssistant[]) assistants
- .toArray(new CommonDropAdapterAssistant[assistants.size()]);
-
- }
-
- private CommonDropAdapterAssistant getAssistant(
- CommonDropAdapterDescriptor descriptor) {
- CommonDropAdapterAssistant asst = (CommonDropAdapterAssistant) dropAssistants
- .get(descriptor);
- if (asst != null) {
- return asst;
- }
- synchronized (dropAssistants) {
- asst = (CommonDropAdapterAssistant) dropAssistants.get(descriptor);
- if (asst == null) {
- dropAssistants.put(descriptor, (asst = descriptor
- .createDropAssistant()));
- asst.init(contentService);
- }
- }
- return asst;
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersView.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersView.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersView.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * 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:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.as.wst.server.ui;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.navigator.CommonDragAdapter;
-import org.eclipse.ui.navigator.CommonDropAdapter;
-import org.eclipse.ui.navigator.CommonNavigator;
-import org.eclipse.ui.navigator.CommonViewer;
-/**
- * A view of servers, their modules, and status.
- */
-public class ServersView extends CommonNavigator {
-
- /**
- * ServersView constructor comment.
- */
- public ServersView() {
- super();
- }
-
- /*
- * Stuff that shouldn't even be here but CNF is kinda lame
- * Must override currently to overcome the bug below:
- *
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261606
- */
- private IMemento memento;
-
- public void init(IViewSite aSite, IMemento aMemento)
- throws PartInitException {
- this.memento = memento;
- super.init(aSite, aMemento);
- }
-
- protected CommonViewer createCommonViewer(Composite aParent) {
- CommonViewer aViewer = new CommonViewerExtension(getViewSite().getId(), aParent,
- SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- initListeners(aViewer);
- aViewer.getNavigatorContentService().restoreState(memento);
- return aViewer;
- }
-
-
- public class CommonViewerExtension extends CommonViewer {
- public CommonViewerExtension(String aViewerId, Composite aParent, int aStyle) {
- super(aViewerId, aParent, aStyle);
- }
-
- protected void initDragAndDrop() {
- /* Handle Drag and Drop */
- int operations = DND.DROP_COPY | DND.DROP_MOVE;
-
- CommonDragAdapter dragAdapter = new CommonDragAdapter(
- getNavigatorContentService(), this);
- addDragSupport(operations, dragAdapter.getSupportedDragTransfers(),
- dragAdapter);
-
- ServersDropAdapter dropAdapter = new ServersDropAdapter(
- getNavigatorContentService(), this);
- addDropSupport(operations, dropAdapter.getSupportedDropTransfers(),
- dropAdapter);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersViewDropAdapterAssistant.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersViewDropAdapterAssistant.java 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersViewDropAdapterAssistant.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -1,193 +0,0 @@
-package org.jboss.tools.as.wst.server.ui;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.activities.WorkbenchActivityHelper;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.navigator.CommonDropAdapter;
-import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate;
-
-public class ServersViewDropAdapterAssistant extends CommonDropAdapterAssistant {
-
- @SuppressWarnings("unchecked") private List fElements;
-
- public ServersViewDropAdapterAssistant() {
- super();
- }
- protected void doInit() {
- }
-
- public IStatus validatePluginTransferDrop(
- IStructuredSelection aDragSelection, Object aDropTarget) {
- initializeSelection(aDragSelection);
- return internalValidate(aDropTarget, fElements);
- }
-
- public IStatus validateDrop(Object target, int operation,
- TransferData transferType) {
- if (LocalSelectionTransfer.getInstance().isSupportedType(transferType)) {
- ISelection s = LocalSelectionTransfer.getInstance().getSelection();
- initializeSelection(s);
- return internalValidate(target, fElements);
- }
- return Status.CANCEL_STATUS;
- }
-
- protected void initializeSelection(ISelection s) {
- if (fElements != null)
- return;
- if (!(s instanceof IStructuredSelection)) {
- fElements= Collections.EMPTY_LIST;
- return;
- }
- fElements = ((IStructuredSelection) s).toList();
- }
-
- @SuppressWarnings("unchecked")
- protected IStatus internalValidate(Object target, List elements) {
- if( target instanceof IServer ) {
- IServer server = (IServer)target;
- Object next;
- if( elements != null ) {
- Iterator i = elements.iterator();
- while(i.hasNext() ) {
- next = i.next();
- IModuleArtifact[] moduleArtifacts = ServerPlugin.getModuleArtifacts(next);
- if (moduleArtifacts != null && moduleArtifacts.length > 0 ) {
- for( int j = 0; j < moduleArtifacts.length; j++ ) {
- if( moduleArtifacts[j] != null && moduleArtifacts[j].getModule() != null ) {
- IModuleType[] moduleTypes = server.getServerType().getRuntimeType().getModuleTypes();
- if (ServerUtil.isSupportedModule(moduleTypes, moduleArtifacts[j].getModule().getModuleType())) {
- return Status.OK_STATUS;
- }
- }
- }
- }
- }
- }
- }
- clear();
- return Status.CANCEL_STATUS;
- }
-
- public IStatus handleDrop(CommonDropAdapter dropAdapter,
- DropTargetEvent dropTargetEvent, Object target) {
- return internalHandleDrop(target, fElements);
- }
-
- public IStatus handlePluginTransferDrop(
- IStructuredSelection aDragSelection, Object aDropTarget) {
- return internalHandleDrop(aDropTarget, fElements);
- }
-
- protected IStatus internalHandleDrop(Object target, List elements) {
- boolean b = false;
- if( target instanceof IServer ) {
- b = true;
- if( fElements != null ) {
- Iterator iterator = elements.iterator();
- while (iterator.hasNext()) {
- Object data2 = iterator.next();
- if (!doSel((IServer)target, data2))
- b = false;
- }
- }
- }
- clear();
- return b ? Status.OK_STATUS : Status.CANCEL_STATUS;
- }
-
- private void clear() {
- fElements = null;
- }
-
- protected boolean doSel(IServer server, Object data) {
- // check if the selection is a project (module) that we can add to the server
- IProject project = (IProject) Platform.getAdapterManager().getAdapter(data, IProject.class);
- if (project != null) {
- IModule[] modules = ServerUtil.getModules(project);
- if (modules != null && modules.length == 1) {
- try {
- IServerWorkingCopy wc = server.createWorkingCopy();
- IModule[] parents = wc.getRootModules(modules[0], null);
- if (parents == null || parents.length == 0)
- return false;
-
- if (ServerUtil.containsModule(server, parents[0], null))
- return false;
-
- IModule[] add = new IModule[] { parents[0] };
- if (wc.canModifyModules(add, null, null).getSeverity() != IStatus.ERROR) {
- wc.modifyModules(modules, null, null);
- wc.save(false, null);
- return true;
- }
- } catch (final CoreException ce) {
- final Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
- shell.getDisplay().asyncExec(new Runnable() {
- public void run() {
- EclipseUtil.openError(shell, ce.getLocalizedMessage());
- }
- });
- return true;
- }
- }
- }
-
- // otherwise, try Run on Server
- final IServer finalServer = server;
- RunOnServerActionDelegate ros = new RunOnServerActionDelegate() {
- public IServer getServer(IModule module, IModuleArtifact moduleArtifact, IProgressMonitor monitor) throws CoreException {
- if (!ServerUIPlugin.isCompatibleWithLaunchMode(finalServer, launchMode))
- return null;
-
- if (!ServerUtil.containsModule(finalServer, module, monitor)) {
- IServerWorkingCopy wc = finalServer.createWorkingCopy();
- try {
- ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor);
- wc.save(false, monitor);
- } catch (CoreException ce) {
- throw ce;
- }
- }
-
- return finalServer;
- }
- };
- Action action = new Action() {
- //
- };
- ros.selectionChanged(action, new StructuredSelection(data));
-
- ros.run(action);
- return true;
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java (from rev 13054, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerActionProvider.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - Base Code
+ * Red Hat - Refactor for CNF
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import java.util.Iterator;
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.bindings.TriggerSequence;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.keys.IBindingService;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.model.ServerDelegate;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
+import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.actions.NewServerWizardAction;
+import org.eclipse.wst.server.ui.internal.view.servers.CopyAction;
+import org.eclipse.wst.server.ui.internal.view.servers.DeleteAction;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleSloshAction;
+import org.eclipse.wst.server.ui.internal.view.servers.MonitorServerPortAction;
+import org.eclipse.wst.server.ui.internal.view.servers.OpenAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PasteAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PropertiesAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PublishAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PublishCleanAction;
+import org.eclipse.wst.server.ui.internal.view.servers.RemoveModuleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.RenameAction;
+import org.eclipse.wst.server.ui.internal.view.servers.RestartModuleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.ShowInConsoleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.ShowInDebugAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StartAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StartModuleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StopAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StopModuleAction;
+import org.jboss.ide.eclipse.as.ui.actions.ExploreAction;
+
+public class ServerActionProvider extends CommonActionProvider {
+ public static final String NEW_MENU_ID = "org.jboss.tools.as.wst.server.ui.internal.cnf.newMenuId";
+ public static final String SHOW_IN_MENU_ID = "org.jboss.tools.as.wst.server.ui.internal.cnf.showInMenuId";
+ public static final String TOP_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.topSectionStart";
+ public static final String TOP_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.topSectionEnd";
+ public static final String EDIT_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnfeditSectionStart";
+ public static final String EDIT_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.editSectionEnd";
+ public static final String CONTROL_SERVER_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlServerSectionStart";
+ public static final String CONTROL_SERVER_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlServerSectionEnd";
+ public static final String SERVER_ERATA_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.serverErataSectionStart";
+ public static final String SERVER_ERATA_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.serverErataSectionEnd";
+ public static final String CONTROL_MODULE_SECTION_START_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlModuleSectionStart";
+ public static final String CONTROL_MODULE_SECTION_END_SEPARATOR = "org.jboss.tools.as.wst.server.ui.internal.cnf.controlModuleSectionEnd";
+
+ private ICommonActionExtensionSite actionSite;
+ private Clipboard clipboard;
+ public ServerActionProvider() {
+ super();
+ }
+
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ this.actionSite = aSite;
+ ICommonViewerSite site = aSite.getViewSite();
+ if( site instanceof ICommonViewerWorkbenchSite ) {
+ StructuredViewer v = aSite.getStructuredViewer();
+ if( v instanceof CommonViewer ) {
+ CommonViewer cv = (CommonViewer)v;
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
+ addListeners(cv);
+ makeServerActions(cv, wsSite.getSelectionProvider());
+ }
+ }
+ }
+
+
+ // actions on a server
+ protected Action[] actions;
+ protected Action actionModifyModules;
+ protected Action openAction, showInConsoleAction, showInDebugAction, propertiesAction, monitorPropertiesAction;
+ protected Action copyAction, pasteAction, deleteAction, renameAction;
+ protected Action noneAction = new Action(Messages.dialogMonitorNone) {
+ // dummy action
+ };
+
+ private void addListeners(CommonViewer tableViewer) {
+ tableViewer.addOpenListener(new IOpenListener() {
+ public void open(OpenEvent event) {
+ try {
+ IStructuredSelection sel = (IStructuredSelection) event.getSelection();
+ Object data = sel.getFirstElement();
+ if (!(data instanceof IServer))
+ return;
+ IServer server = (IServer) data;
+ ServerUIPlugin.editServer(server);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not open server", e);
+ }
+ }
+ });
+ }
+
+ private void makeServerActions(CommonViewer tableViewer, ISelectionProvider provider) {
+ clipboard = new Clipboard(tableViewer.getTree().getDisplay());
+ Shell shell = tableViewer.getTree().getShell();
+
+ actions = new Action[7];
+ // create the start actions
+ actions[0] = new StartAction(shell, provider, ILaunchManager.DEBUG_MODE);
+ actions[1] = new StartAction(shell, provider, ILaunchManager.RUN_MODE);
+ actions[2] = new StartAction(shell, provider, ILaunchManager.PROFILE_MODE);
+
+ // create the stop action
+ actions[3] = new StopAction(shell, provider);
+
+ // create the publish actions
+ actions[4] = new PublishAction(shell, provider);
+ actions[5] = new PublishCleanAction(shell, provider);
+ actions[6] = new ExploreAction(shell,provider);
+
+ // create the open action
+ openAction = new OpenAction(provider);
+
+// // create copy, paste, and delete actions
+ pasteAction = new PasteAction(shell, provider, clipboard);
+ copyAction = new CopyAction(provider, clipboard, pasteAction);
+ deleteAction = new DeleteAction(shell, provider);
+ renameAction = new RenameAction(shell, tableViewer, provider);
+
+ // create the other actions
+ actionModifyModules = new ModuleSloshAction(shell, provider);
+ showInConsoleAction = new ShowInConsoleAction(provider);
+ showInDebugAction = new ShowInDebugAction(provider);
+
+ // create the properties action
+ propertiesAction = new PropertiesAction(shell, provider);
+ monitorPropertiesAction = new PropertiesAction(shell, "org.eclipse.wst.server.ui.properties.monitor", provider);
+ }
+
+ public void fillActionBars(IActionBars actionBars) {
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.debug", actions[0]);
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.run", actions[1]);
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.stop", actions[3]);
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.publish", actions[4]);
+ actionBars.setGlobalActionHandler("org.eclipse.ui.navigator.Open", openAction);
+ actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
+ actionBars.updateActionBars();
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
+
+ IContributionManager cm = actionBars.getToolBarManager();
+ cm.removeAll();
+
+ for (int i = 0; i < actions.length - 1; i++)
+ cm.add(actions[i]);
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ ICommonViewerSite site = actionSite.getViewSite();
+ IStructuredSelection selection = null;
+ Shell shell = actionSite.getViewSite().getShell();
+ if( site instanceof ICommonViewerWorkbenchSite ) {
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
+ selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
+ }
+
+ IServer server = null;
+ IModule[] module = null;
+ if (selection != null && !selection.isEmpty()) {
+ Iterator iterator = selection.iterator();
+ Object obj = iterator.next();
+ if (obj instanceof IServer)
+ server = (IServer) obj;
+ if (obj instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) obj;
+ server = ms.server;
+ module = ms.module;
+ }
+ if (iterator.hasNext()) {
+ server = null;
+ module = null;
+ }
+ }
+
+ menu.add(invisibleSeparator(TOP_SECTION_START_SEPARATOR));
+ addTopSection(menu, server, module);
+ menu.add(invisibleSeparator(TOP_SECTION_END_SEPARATOR));
+ menu.add(new Separator());
+
+ if (server != null && module == null) {
+ menu.add(invisibleSeparator(EDIT_SECTION_START_SEPARATOR));
+ menu.add(copyAction);
+ menu.add(pasteAction);
+ menu.add(deleteAction);
+ menu.add(renameAction);
+ menu.add(invisibleSeparator(EDIT_SECTION_END_SEPARATOR));
+
+ menu.add(new Separator());
+
+ menu.add(invisibleSeparator(CONTROL_SERVER_SECTION_START_SEPARATOR));
+ for (int i = 0; i < actions.length; i++)
+ menu.add(actions[i]);
+ menu.add(invisibleSeparator(CONTROL_SERVER_SECTION_END_SEPARATOR));
+
+ menu.add(new Separator());
+
+ menu.add(invisibleSeparator(SERVER_ERATA_SECTION_START_SEPARATOR));
+ menu.add(actionModifyModules);
+ addMonitor(server, menu, shell);
+ menu.add(invisibleSeparator(SERVER_ERATA_SECTION_END_SEPARATOR));
+ menu.add(new Separator());
+ menu.add(propertiesAction);
+
+ } else if (server != null && module != null) {
+
+ menu.add(invisibleSeparator(CONTROL_MODULE_SECTION_START_SEPARATOR));
+ menu.add(new StartModuleAction(server, module));
+ menu.add(new StopModuleAction(server, module));
+ menu.add(new RestartModuleAction(server, module));
+ if(module.length == 1) {
+ menu.add(new RemoveModuleAction(shell, server, module[0]));
+ }
+ menu.add(invisibleSeparator(CONTROL_MODULE_SECTION_END_SEPARATOR));
+ }
+
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));
+ }
+
+ protected void addTopSection(IMenuManager menu, IServer server, IModule[] module) {
+ MenuManager newMenu = new MenuManager(Messages.actionNew, NEW_MENU_ID);
+ IAction newServerAction = new NewServerWizardAction();
+ newServerAction.setText(Messages.actionNewServer);
+ newMenu.add(newServerAction);
+ menu.add(newMenu);
+
+ // open action
+ if (server != null && module == null) {
+ menu.add(openAction);
+
+ String text = Messages.actionShowIn;
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ final IBindingService bindingService = (IBindingService) workbench
+ .getAdapter(IBindingService.class);
+ final TriggerSequence[] activeBindings = bindingService
+ .getActiveBindingsFor("org.eclipse.ui.navigate.showInQuickMenu");
+ if (activeBindings.length > 0) {
+ text += "\t" + activeBindings[0].format();
+ }
+
+ MenuManager showInMenu = new MenuManager(text, "org.eclipse.ui.navigate.showInQuickMenu");
+ showInMenu.add(showInConsoleAction);
+ showInMenu.add(showInDebugAction);
+ menu.add(showInMenu);
+ }
+ }
+
+ protected void addMonitor(IServer server, IMenuManager menu, Shell shell) {
+
+ if (server.getServerType() != null) {
+ final MenuManager menuManager = new MenuManager(Messages.actionMonitor);
+
+ final IServer server2 = server;
+ final Shell shell2 = shell;
+ menuManager.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ menuManager.removeAll();
+ if (server2.getAdapter(ServerDelegate.class) != null) {
+ ServerPort[] ports = server2.getServerPorts(null);
+ if (ports != null) {
+ int size = ports.length;
+ for (int i = 0; i < size; i++) {
+ if (!ports[i].isAdvanced())
+ menuManager.add(new MonitorServerPortAction(shell2, server2, ports[i]));
+ }
+ }
+ }
+
+ if (menuManager.isEmpty())
+ menuManager.add(noneAction);
+
+ menuManager.add(new Separator());
+ menuManager.add(monitorPropertiesAction);
+ }
+ });
+
+ // add an initial menu item so that the menu appears correctly
+ noneAction.setEnabled(false);
+ menuManager.add(noneAction);
+ menu.add(menuManager);
+ }
+ }
+
+
+ private Separator invisibleSeparator(String s) {
+ Separator sep = new Separator(s);
+ sep.setVisible(false);
+ return sep;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java (from rev 13054, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerContentProvider.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - Base Code
+ * Red Hat - Refactor for CNF
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IPublishListener;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerLifecycleListener;
+import org.eclipse.wst.server.core.IServerListener;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerEvent;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.internal.UpdateServerJob;
+import org.eclipse.wst.server.core.util.PublishAdapter;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+import org.eclipse.wst.server.ui.internal.viewers.BaseContentProvider;
+
+public class ServerContentProvider extends BaseContentProvider implements ITreeContentProvider {
+ public static Object INITIALIZING = new Object();
+ protected IServerLifecycleListener serverResourceListener;
+ protected IPublishListener publishListener;
+ protected IServerListener serverListener;
+
+ // servers that are currently publishing and starting
+ protected static Set<String> publishing = new HashSet<String>(4);
+ protected static Set<String> starting = new HashSet<String>(4);
+ protected boolean animationActive = false;
+ protected boolean stopAnimation = false;
+ protected boolean initialized = false;
+
+
+ private StructuredViewer viewer;
+
+ public ServerContentProvider() {
+ addListeners();
+ }
+
+ public Object[] getElements(Object element) {
+ if( !initialized ) {
+ deferInitialization();
+ return new Object[] {INITIALIZING};
+ }
+
+ List<IServer> list = new ArrayList<IServer>();
+ IServer[] servers = ServerCore.getServers();
+ if (servers != null) {
+ int size = servers.length;
+ for (int i = 0; i < size; i++) {
+ if (!((Server)servers[i]).isPrivate())
+ list.add(servers[i]);
+ }
+ }
+ return list.toArray();
+ }
+
+ public Object[] getChildren(Object element) {
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ try {
+ IModule[] children = ms.server.getChildModules(ms.module, null);
+ int size = children.length;
+ ModuleServer[] ms2 = new ModuleServer[size];
+ for (int i = 0; i < size; i++) {
+ int size2 = ms.module.length;
+ IModule[] module = new IModule[size2 + 1];
+ System.arraycopy(ms.module, 0, module, 0, size2);
+ module[size2] = children[i];
+ ms2[i] = new ModuleServer(ms.server, module);
+ }
+ return ms2;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ IServer server = (IServer) element;
+ IModule[] modules = server.getModules();
+ int size = modules.length;
+ ModuleServer[] ms = new ModuleServer[size];
+ for (int i = 0; i < size; i++) {
+ ms[i] = new ModuleServer(server, new IModule[] { modules[i] });
+ }
+ return ms;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ return ms.server;
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof ModuleServer) {
+ // Check if the module server has child modules.
+ ModuleServer curModuleServer = (ModuleServer)element;
+ IServer curServer = curModuleServer.server;
+ IModule[] curModule = curModuleServer.module;
+ if (curServer != null && curModule != null) {
+ IModule[] curChildModule = curServer.getChildModules(curModule, null);
+ if (curChildModule != null && curChildModule.length > 0)
+ return true;
+
+ return false;
+ }
+
+ return false;
+ }
+ if( element instanceof IServer ) {
+ return ((IServer) element).getModules().length > 0;
+ }
+ return false;
+ }
+
+ public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
+ viewer = (StructuredViewer) aViewer;
+ }
+
+ public void dispose() {
+ // remove all listeners!
+ ServerCore.removeServerLifecycleListener(serverResourceListener);
+ IServer[] servers = ServerCore.getServers();
+ for( int i = 0;i < servers.length; i++ ) {
+ servers[i].removePublishListener(publishListener);
+ servers[i].removeServerListener(serverListener);
+ }
+ }
+
+
+
+ // Listeners and refreshing the viewer
+ protected void addListeners() {
+ serverResourceListener = new IServerLifecycleListener() {
+ public void serverAdded(IServer server) {
+ refreshServer(null);
+ server.addServerListener(serverListener);
+ ((Server) server).addPublishListener(publishListener);
+ }
+ public void serverChanged(IServer server) {
+ refreshServer(server);
+ }
+ public void serverRemoved(IServer server) {
+ refreshServer(null);
+ server.removeServerListener(serverListener);
+ ((Server) server).removePublishListener(publishListener);
+ }
+ };
+ ServerCore.addServerLifecycleListener(serverResourceListener);
+
+ publishListener = new PublishAdapter() {
+ public void publishStarted(IServer server) {
+ handlePublishChange(server, true);
+ }
+
+ public void publishFinished(IServer server, IStatus status) {
+ handlePublishChange(server, false);
+ }
+ };
+
+ serverListener = new IServerListener() {
+ public void serverChanged(ServerEvent event) {
+ if (event == null)
+ return;
+
+ int eventKind = event.getKind();
+ IServer server = event.getServer();
+ if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
+ // server change event
+ if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
+ refreshServer(server, true);
+ int state = event.getState();
+ String id = server.getId();
+ if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
+ boolean startThread = false;
+ synchronized (starting) {
+ if (!starting.contains(id)) {
+ if (starting.isEmpty())
+ startThread = true;
+ starting.add(id);
+ }
+ }
+ if (startThread)
+ startThread();
+ } else {
+ boolean stopThread = false;
+ synchronized (starting) {
+ if (starting.contains(id)) {
+ starting.remove(id);
+ if (starting.isEmpty())
+ stopThread = true;
+ }
+ }
+ if (stopThread)
+ stopThread();
+ }
+ } else
+ refreshServer(server);
+ } else if ((eventKind & ServerEvent.MODULE_CHANGE) != 0) {
+ // module change event
+ if ((eventKind & ServerEvent.STATE_CHANGE) != 0 || (eventKind & ServerEvent.PUBLISH_STATE_CHANGE) != 0) {
+ refreshServer(server);
+ }
+ }
+ }
+ };
+
+ // add listeners to servers
+ IServer[] servers = ServerCore.getServers();
+ if (servers != null) {
+ int size = servers.length;
+ for (int i = 0; i < size; i++) {
+ servers[i].addServerListener(serverListener);
+ ((Server) servers[i]).addPublishListener(publishListener);
+ }
+ }
+ }
+
+ protected void deferInitialization() {
+ Job job = new Job(Messages.jobInitializingServersView) {
+ public IStatus run(IProgressMonitor monitor) {
+ IServer[] servers = ServerCore.getServers();
+ int size = servers.length;
+ for (int i = 0; i < size; i++) {
+ ((Server)servers[i]).getAllModules().iterator();
+ }
+
+ for (int i = 0; i < size; i++) {
+ IServer server = servers[i];
+ if (server.getServerType() != null && server.getServerState() == IServer.STATE_UNKNOWN) {
+ UpdateServerJob job2 = new UpdateServerJob(server);
+ job2.schedule();
+ }
+ }
+ initialized = true;
+ refreshServer(null);
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.setSystem(true);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+
+ protected void updateServerLabel(final IServer server) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ if( viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.update(server, null);
+ ServerDecorator.getDefault().redecorate(server);
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ });
+ }
+
+ protected void refreshServer(final IServer server) {
+ refreshServer(server, false);
+ }
+ protected void refreshServer(final IServer server, final boolean resetSelection) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ if( viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh(server);
+ if( resetSelection ) {
+ ISelection sel = viewer.getSelection();
+ viewer.setSelection(sel);
+ }
+ ServerDecorator.getDefault().redecorate(server);
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ });
+ }
+
+ protected void handlePublishChange(IServer server, boolean isPublishing) {
+ String serverId = server.getId();
+ if (isPublishing)
+ publishing.add(serverId);
+ else
+ publishing.remove(serverId);
+
+ refreshServer(server);
+ }
+
+
+ protected void startThread() {
+ if (animationActive)
+ return;
+
+ stopAnimation = false;
+
+ final Display display = viewer == null ? Display.getDefault() : viewer.getControl().getDisplay();
+ final int SLEEP = 200;
+ final Runnable[] animator = new Runnable[1];
+ animator[0] = new Runnable() {
+ public void run() {
+ if (!stopAnimation) {
+ try {
+ int size = 0;
+ String[] servers;
+ synchronized (starting) {
+ size = starting.size();
+ servers = new String[size];
+ starting.toArray(servers);
+ }
+
+ for (int i = 0; i < size; i++) {
+ IServer server = ServerCore.findServer(servers[i]);
+ if (server != null ) {
+ ServerDecorator.animate();
+ updateServerLabel(server);
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Error in Servers view animation", e);
+ }
+ display.timerExec(SLEEP, animator[0]);
+ }
+ }
+ };
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ display.timerExec(SLEEP, animator[0]);
+ }
+ });
+ }
+
+ protected void stopThread() {
+ stopAnimation = true;
+ }}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerDecorator.java (from rev 13054, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerDecorator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerDecorator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerDecorator.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - Base Code
+ * Red Hat - Refactor for CNF
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.ImageResource;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
+import org.eclipse.wst.server.ui.internal.provisional.UIDecoratorManager;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+
+public class ServerDecorator extends LabelProvider implements ILightweightLabelDecorator {
+
+ public static final String[] syncState = new String[] {
+ Messages.viewSyncOkay,
+ Messages.viewSyncRestart,
+ Messages.viewSyncPublish,
+ Messages.viewSyncRestartPublish,
+ Messages.viewSyncPublishing};
+
+ public static final String[] syncStateUnmanaged = new String[] {
+ Messages.viewSyncOkay2,
+ Messages.viewSyncRestart2,
+ Messages.viewSyncPublish2,
+ Messages.viewSyncRestartPublish2,
+ Messages.viewSyncPublishing2};
+
+ public static final String[] modulePublishState = new String[] {
+ "",
+ Messages.viewSyncOkay,
+ Messages.viewSyncPublish,
+ Messages.viewSyncPublish};
+
+ private static ServerDecorator instance;
+ public static ServerDecorator getDefault() {
+ return instance;
+ }
+
+ private static int count = 0;
+ public static void animate() {
+ count = (count + 1)%3;
+ }
+ public static int getCount() {
+ return count;
+ }
+
+ public ServerDecorator() {
+ instance = this;
+ }
+
+ public void decorate(Object element, IDecoration decoration) {
+ if( element instanceof IServer ) {
+ String state = getServerStateLabel((IServer)element);
+ String status = getServerStatusLabel((IServer)element);
+ decoration.addSuffix(combine(state, status));
+ } else if( element instanceof ModuleServer ) {
+ String state = getModuleStateText((ModuleServer)element);
+ String status = getModuleStatusText((ModuleServer)element);
+ decoration.addSuffix(combine(state, status));
+ }
+ }
+
+ protected String combine(String state, String status) {
+ if(isEmpty(state) && isEmpty(status))
+ return "";
+ if( isEmpty(state))
+ return " [" + status + "]";
+ if( isEmpty(status))
+ return " [" + state + "]";
+ return " [" + state + ", " + status + "]";
+ }
+
+ protected boolean isEmpty(String s) {
+ return (s == null || "".equals(s));
+ }
+
+ public void redecorate(IServer server) {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(this));
+ }
+
+
+
+ /*
+ * Utility methods
+ */
+ public static Image getServerImage(IServer server) {
+ return server == null ? null :
+ server.getServerType() == null ? null :
+ ImageResource.getImage(server.getServerType().getId());
+ }
+
+ public static String getServerStateLabel(IServer server) {
+ return server == null ? null :
+ server.getServerType() == null ? null :
+ getStateLabel(server.getServerType(), server.getServerState(), server.getMode());
+ }
+
+ public static String getStateLabel(IServerType serverType, int state, String mode) {
+ return serverType == null ? null :
+ UIDecoratorManager.getUIDecorator(serverType).getStateLabel(state, mode, count);
+ }
+
+ public static String getServerStatusLabel(IServer server) {
+ IStatus status = ((Server) server).getServerStatus();
+ if (status != null)
+ return status.getMessage();
+
+ if (server.getServerType() == null)
+ return "";
+
+ if (server.getServerState() == IServer.STATE_UNKNOWN)
+ return "";
+
+ String serverId = server.getId();
+ if (ServerContentProvider.publishing.contains(serverId))
+ return ServerDecorator.syncState[4];
+
+ // republish
+ int i = 0;
+ if (server.shouldPublish()) {
+ if (((Server)server).isPublishUnknown())
+ return "";
+ i += 2;
+ }
+
+ if (server.shouldRestart())
+ i = 1;
+
+ return syncState[i];
+ }
+
+ public static Image getServerStateImage(IServer server) {
+ return server == null ? null :
+ getStateImage(server.getServerType(), server.getServerState(), server.getMode());
+ }
+
+ public static Image getStateImage(IServerType serverType, int state, String mode) {
+ return serverType == null ? null :
+ UIDecoratorManager.getUIDecorator(serverType).getStateImage(state, mode, getCount());
+ }
+
+ public static String getModuleText(ModuleServer ms ) {
+ if (ms == null || ms.module == null)
+ return "";
+ int size = ms.module.length;
+ return ms.module[size - 1].getName();
+ }
+
+ public static Image getModuleImage(ModuleServer ms) {
+ if( ms != null ) {
+ ILabelProvider labelProvider = ServerUICore.getLabelProvider();
+ Image image = labelProvider.getImage(ms.module[ms.module.length - 1]);
+ labelProvider.dispose();
+ return image;
+ }
+ return null;
+ }
+
+ public static String getModuleStateText(ModuleServer ms) {
+ return "";
+ }
+
+ public static String getModuleStatusText(ModuleServer ms) {
+ if( ms != null && ms.server != null && ms.module != null ) {
+ IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
+ if (status != null)
+ return status.getMessage();
+
+ return modulePublishState[ms.server.getModulePublishState(ms.module)];
+ }
+ return "";
+ }
+
+ public static Image getModuleStatusImage(ModuleServer ms) {
+ IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
+ if (status != null) {
+ ISharedImages sharedImages = ServerUIPlugin.getInstance().getWorkbench().getSharedImages();
+ if (status.getSeverity() == IStatus.ERROR)
+ return sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ else if (status.getSeverity() == IStatus.WARNING)
+ return sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ else if (status.getSeverity() == IStatus.INFO)
+ return sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+ }
+ return null;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerDecorator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerLabelProvider.java (from rev 13054, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServerLabelProvider.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerLabelProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerLabelProvider.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - Base Code
+ * Red Hat - Refactor for CNF
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.ImageResource;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+/**
+ * Server table label provider.
+ */
+public class ServerLabelProvider extends LabelProvider {
+
+ /**
+ * ServerTableLabelProvider constructor comment.
+ */
+ public ServerLabelProvider() {
+ super();
+ }
+
+ public String getText(Object element) {
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ if (ms.module == null)
+ return "";
+ int size = ms.module.length;
+ String name = ms.module[size - 1].getName();
+ return name;
+ }
+
+ if( element instanceof IServer ) {
+ IServer server = (IServer) element;
+ return notNull(server.getName());
+ }
+
+ if( element == ServerContentProvider.INITIALIZING)
+ return Messages.viewInitializing;
+
+ return "-";
+ }
+ public Image getImage(Object element) {
+ Image image = null;
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ ILabelProvider labelProvider = ServerUICore.getLabelProvider();
+ image = labelProvider.getImage(ms.module[ms.module.length - 1]);
+ labelProvider.dispose();
+ } else if( element instanceof IServer ) {
+ IServer server = (IServer) element;
+ if (server.getServerType() != null) {
+ image = ImageResource.getImage(server.getServerType().getId());
+ }
+ }
+ return image;
+ }
+
+ protected String notNull(String s) {
+ if (s == null)
+ return "";
+ return s;
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerLabelProvider.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersDropAdapter.java (from rev 13180, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersDropAdapter.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersDropAdapter.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,321 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ * ken.ryall(a)nokia.com - 157506 drop from external sources does not work on Linux/Mac
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.ui.internal.navigator.NavigatorPlugin;
+import org.eclipse.ui.internal.navigator.dnd.CommonDropAdapterDescriptor;
+import org.eclipse.ui.internal.navigator.dnd.CommonDropDescriptorManager;
+import org.eclipse.ui.internal.navigator.dnd.NavigatorPluginDropAction;
+import org.eclipse.ui.navigator.CommonDragAdapter;
+import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
+import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.INavigatorContentService;
+import org.eclipse.ui.navigator.INavigatorDnDService;
+import org.eclipse.ui.part.PluginDropAdapter;
+import org.eclipse.ui.part.PluginTransfer;
+
+/*
+ * THIS CLASS IS A CLONE of CommonDropAdapter.
+ * It is necessary because dragged items must be acceptable children.
+ * Stupid restriction
+ *
+ * I use a delegate and push all methods to the delegate,
+ * even the ones I override.
+ *
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261606
+ *
+ * Maybe one day they'll fix that ;)
+ */
+
+/**
+ * Provides an implementation of {@link PluginDropAdapter} which uses the
+ * extensions provided by the associated {@link INavigatorContentService}.
+ *
+ * <p>
+ * Clients should not need to create an instance of this class unless they are
+ * creating their own custom viewer. Otherwise, {@link CommonViewer} configures
+ * its drop adapter automatically.
+ * </p>
+ *
+ *
+ * @see INavigatorDnDService
+ * @see CommonDragAdapter
+ * @see CommonDragAdapterAssistant
+ * @see CommonDropAdapterAssistant
+ * @see CommonViewer
+ * @since 3.2
+ */
+public final class ServersDropAdapter extends PluginDropAdapter {
+ private static final Transfer[] SUPPORTED_DROP_TRANSFERS = new Transfer[] {
+ LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(),
+ PluginTransfer.getInstance() };
+ private final INavigatorContentService contentService;
+ private final INavigatorDnDService dndService;
+
+ public ServersDropAdapter(INavigatorContentService aContentService,
+ StructuredViewer aStructuredViewer) {
+ super(aStructuredViewer);
+ contentService = aContentService;
+ dndService = contentService.getDnDService();
+ }
+
+ public Transfer[] getSupportedDropTransfers() {
+ return SUPPORTED_DROP_TRANSFERS;
+ }
+
+ public void dragEnter(DropTargetEvent event) {
+ super.dragEnter(event);
+
+ for (int i = 0; i < event.dataTypes.length; i++) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(
+ event.dataTypes[i])) {
+ event.currentDataType = event.dataTypes[i];
+ return;
+ }
+ }
+
+ for (int i = 0; i < event.dataTypes.length; i++) {
+ if (FileTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
+ event.currentDataType = event.dataTypes[i];
+ event.detail = DND.DROP_COPY;
+ return;
+ }
+ }
+
+ for (int i = 0; i < event.dataTypes.length; i++) {
+ if (PluginTransfer.getInstance()
+ .isSupportedType(event.dataTypes[i])) {
+ event.currentDataType = event.dataTypes[i];
+ return;
+ }
+ }
+
+ event.detail = DND.DROP_NONE;
+
+ }
+
+ public void dragLeave(DropTargetEvent event) {
+ super.dragLeave(event);
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(
+ event.currentDataType)) {
+ event.data = NavigatorPluginDropAction
+ .createTransferData(contentService);
+ }
+ }
+
+ /*
+ * Changed from CommonDropAdapter to extract the findCommonDropAdapterAssistant section
+ * since I do not like the impl in dnd service
+ */
+ public void drop(DropTargetEvent event) {
+ // Must validate the drop here because on some platforms (Linux, Mac) the event
+ // is not populated with the correct currentDataType until the drop actually
+ // happens, and validateDrop sets the currentTransfer based on that. The
+ // call to validateDrop in dragAccept is too early.
+ validateDrop(getCurrentTarget(), getCurrentOperation(), event.currentDataType);
+ if (PluginTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ super.drop(event);
+ } else {
+
+ Object target = getCurrentTarget() != null ?
+ getCurrentTarget() : getViewer().getInput();
+
+ CommonDropAdapterAssistant[] assistants =
+ findCommonDropAdapterAssistants(target, getCurrentTransfer());
+ IStatus valid = null;
+ for (int i = 0; i < assistants.length; i++) {
+ try {
+ valid = assistants[i].validateDrop(getCurrentTarget(),
+ getCurrentOperation(), getCurrentTransfer());
+ if (valid != null && valid.isOK()) {
+ assistants[i].handleDrop(null, event,
+ getCurrentTarget());
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ } catch (Throwable t) {
+ NavigatorPlugin.logError(0, t.getMessage(), t);
+ }
+ }
+ event.detail = DND.DROP_NONE;
+ }
+ }
+
+ /*
+ * Changed from CommonDropAdapter to extract the findCommonDropAdapterAssistant section
+ * since I do not like the impl in dnd service
+ */
+ public boolean validateDrop(Object aDropTarget, int theDropOperation,
+ TransferData theTransferData) {
+ boolean result = false;
+ IStatus valid = null;
+ if (super.validateDrop(aDropTarget, theDropOperation, theTransferData)) {
+ result = true;
+ } else {
+ Object target = aDropTarget != null ? aDropTarget : getViewer().getInput();
+ CommonDropAdapterAssistant[] assistants =
+ findCommonDropAdapterAssistants(target,
+ theTransferData);
+ for (int i = 0; i < assistants.length; i++) {
+ try {
+ valid = assistants[i].validateDrop(target,
+ theDropOperation, theTransferData);
+ } catch (Throwable t) {
+ NavigatorPlugin.logError(0, t.getMessage(), t);
+ }
+ if (valid != null && valid.isOK()) {
+ result = true;
+ break;
+ }
+ }
+ }
+ setScrollExpandEnabled(true);
+ return result;
+
+ }
+
+ public Rectangle getBounds(Item item) {
+ return super.getBounds(item);
+ }
+
+ public int getCurrentLocation() {
+ return super.getCurrentLocation();
+ }
+
+ public int getCurrentOperation() {
+ return super.getCurrentOperation();
+ }
+
+ public Object getCurrentTarget() {
+ return super.getCurrentTarget();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.PluginDropAdapter#getCurrentTransfer()
+ */
+ public TransferData getCurrentTransfer() {
+ return super.getCurrentTransfer();
+ }
+
+ /**
+ * Returns the position of the given event's coordinates relative to its target.
+ * The position is determined to be before, after, or on the item, based on
+ * some threshold value.
+ *
+ * @param event the event
+ * @return one of the <code>LOCATION_* </code>constants defined in this class
+ */
+ protected int determineLocation(DropTargetEvent event) {
+ if (!(event.item instanceof Item)) {
+ return LOCATION_NONE;
+ }
+ return LOCATION_ON;
+ }
+
+
+ private CommonDropAdapterAssistant[] findCommonDropAdapterAssistants(
+ Object aDropTarget, TransferData theTransferType) {
+ CommonDropAdapterAssistant[] result =
+ findCommonDropAdapterAssistants2(aDropTarget, theTransferType);
+ return result;
+ }
+
+
+
+ /*
+ * Stolen from DND Service
+ */
+
+ private static final CommonDropAdapterAssistant[] NO_ASSISTANTS = new CommonDropAdapterAssistant[0];
+ private final Map dropAssistants = new HashMap();
+
+ public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants2(
+ Object aDropTarget, TransferData aTransferType) {
+
+ // TODO Make sure descriptors are sorted by priority
+ CommonDropAdapterDescriptor[] descriptors = CommonDropDescriptorManager
+ .getInstance().findCommonDropAdapterAssistants(aDropTarget,
+ contentService);
+
+ if (descriptors.length == 0) {
+ return NO_ASSISTANTS;
+ }
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType)
+ && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) {
+ return getAssistants(descriptors);
+ }
+ return getAssistantsByTransferData(descriptors, aTransferType);
+ }
+
+ private CommonDropAdapterAssistant[] getAssistants(CommonDropAdapterDescriptor[] descriptors) {
+ Set assistants = new LinkedHashSet();
+ for (int i = 0; i < descriptors.length; i++) {
+ assistants.add(getAssistant(descriptors[i]));
+ }
+ return (CommonDropAdapterAssistant[]) assistants
+ .toArray(new CommonDropAdapterAssistant[assistants.size()]);
+ }
+
+ private CommonDropAdapterAssistant[] getAssistantsByTransferData(
+ CommonDropAdapterDescriptor[] descriptors,
+ TransferData aTransferType) {
+
+ Set assistants = new LinkedHashSet();
+ for (int i = 0; i < descriptors.length; i++) {
+ CommonDropAdapterAssistant asst = getAssistant(descriptors[i]);
+ if (asst.isSupportedType(aTransferType)) {
+ assistants.add(asst);
+ }
+ }
+ return (CommonDropAdapterAssistant[]) assistants
+ .toArray(new CommonDropAdapterAssistant[assistants.size()]);
+
+ }
+
+ private CommonDropAdapterAssistant getAssistant(
+ CommonDropAdapterDescriptor descriptor) {
+ CommonDropAdapterAssistant asst = (CommonDropAdapterAssistant) dropAssistants
+ .get(descriptor);
+ if (asst != null) {
+ return asst;
+ }
+ synchronized (dropAssistants) {
+ asst = (CommonDropAdapterAssistant) dropAssistants.get(descriptor);
+ if (asst == null) {
+ dropAssistants.put(descriptor, (asst = descriptor
+ .createDropAssistant()));
+ asst.init(contentService);
+ }
+ }
+ return asst;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersDropAdapter.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersView.java (from rev 13179, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersView.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersView.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersView.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - Code taken from Superclass
+ * Red Hat Inc - Refactor
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.navigator.CommonDragAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
+/**
+ * A view of servers, their modules, and status.
+ */
+public class ServersView extends CommonNavigator {
+
+ /**
+ * ServersView constructor comment.
+ */
+ public ServersView() {
+ super();
+ }
+
+ /*
+ * Stuff that shouldn't even be here but CNF is kinda lame
+ * Must override currently to overcome the bug below:
+ *
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261606
+ */
+ private IMemento memento;
+
+ public void init(IViewSite aSite, IMemento aMemento)
+ throws PartInitException {
+ this.memento = memento;
+ super.init(aSite, aMemento);
+ }
+
+ protected CommonViewer createCommonViewer(Composite aParent) {
+ CommonViewer aViewer = new CommonViewerExtension(getViewSite().getId(), aParent,
+ SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ initListeners(aViewer);
+ aViewer.getNavigatorContentService().restoreState(memento);
+ return aViewer;
+ }
+
+
+ public class CommonViewerExtension extends CommonViewer {
+ public CommonViewerExtension(String aViewerId, Composite aParent, int aStyle) {
+ super(aViewerId, aParent, aStyle);
+ }
+
+ protected void initDragAndDrop() {
+ /* Handle Drag and Drop */
+ int operations = DND.DROP_COPY | DND.DROP_MOVE;
+
+ CommonDragAdapter dragAdapter = new CommonDragAdapter(
+ getNavigatorContentService(), this);
+ addDragSupport(operations, dragAdapter.getSupportedDragTransfers(),
+ dragAdapter);
+
+ ServersDropAdapter dropAdapter = new ServersDropAdapter(
+ getNavigatorContentService(), this);
+ addDropSupport(operations, dropAdapter.getSupportedDropTransfers(),
+ dropAdapter);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersView.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersViewDropAdapterAssistant.java (from rev 13179, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersViewDropAdapterAssistant.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersViewDropAdapterAssistant.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersViewDropAdapterAssistant.java 2009-01-22 13:52:15 UTC (rev 13185)
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * 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 - Initial Implementation
+ *******************************************************************************/
+package org.jboss.tools.as.wst.server.ui.xpl;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.activities.WorkbenchActivityHelper;
+import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
+import org.eclipse.ui.part.ResourceTransfer;
+import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.ui.internal.EclipseUtil;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
+import org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate;
+
+public class ServersViewDropAdapterAssistant extends CommonDropAdapterAssistant {
+
+ @SuppressWarnings("unchecked") private List fElements;
+
+ public ServersViewDropAdapterAssistant() {
+ super();
+ }
+ protected void doInit() {
+ }
+
+ public IStatus validatePluginTransferDrop(
+ IStructuredSelection aDragSelection, Object aDropTarget) {
+ initializeSelection(aDragSelection);
+ return internalValidate(aDropTarget, fElements);
+ }
+
+ public IStatus validateDrop(Object target, int operation,
+ TransferData transferType) {
+ if (LocalSelectionTransfer.getInstance().isSupportedType(transferType)) {
+ ISelection s = LocalSelectionTransfer.getInstance().getSelection();
+ initializeSelection(s);
+ return internalValidate(target, fElements);
+ }
+ return Status.CANCEL_STATUS;
+ }
+
+ protected void initializeSelection(ISelection s) {
+ if (fElements != null)
+ return;
+ if (!(s instanceof IStructuredSelection)) {
+ fElements= Collections.EMPTY_LIST;
+ return;
+ }
+ fElements = ((IStructuredSelection) s).toList();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected IStatus internalValidate(Object target, List elements) {
+ if( target instanceof IServer ) {
+ IServer server = (IServer)target;
+ Object next;
+ if( elements != null ) {
+ Iterator i = elements.iterator();
+ while(i.hasNext() ) {
+ next = i.next();
+ IModuleArtifact[] moduleArtifacts = ServerPlugin.getModuleArtifacts(next);
+ if (moduleArtifacts != null && moduleArtifacts.length > 0 ) {
+ for( int j = 0; j < moduleArtifacts.length; j++ ) {
+ if( moduleArtifacts[j] != null && moduleArtifacts[j].getModule() != null ) {
+ IModuleType[] moduleTypes = server.getServerType().getRuntimeType().getModuleTypes();
+ if (ServerUtil.isSupportedModule(moduleTypes, moduleArtifacts[j].getModule().getModuleType())) {
+ return Status.OK_STATUS;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ clear();
+ return Status.CANCEL_STATUS;
+ }
+
+ public IStatus handleDrop(CommonDropAdapter dropAdapter,
+ DropTargetEvent dropTargetEvent, Object target) {
+ return internalHandleDrop(target, fElements);
+ }
+
+ public IStatus handlePluginTransferDrop(
+ IStructuredSelection aDragSelection, Object aDropTarget) {
+ return internalHandleDrop(aDropTarget, fElements);
+ }
+
+ protected IStatus internalHandleDrop(Object target, List elements) {
+ boolean b = false;
+ if( target instanceof IServer ) {
+ b = true;
+ if( fElements != null ) {
+ Iterator iterator = elements.iterator();
+ while (iterator.hasNext()) {
+ Object data2 = iterator.next();
+ if (!doSel((IServer)target, data2))
+ b = false;
+ }
+ }
+ }
+ clear();
+ return b ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ }
+
+ private void clear() {
+ fElements = null;
+ }
+
+ protected boolean doSel(IServer server, Object data) {
+ // check if the selection is a project (module) that we can add to the server
+ IProject project = (IProject) Platform.getAdapterManager().getAdapter(data, IProject.class);
+ if (project != null) {
+ IModule[] modules = ServerUtil.getModules(project);
+ if (modules != null && modules.length == 1) {
+ try {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ IModule[] parents = wc.getRootModules(modules[0], null);
+ if (parents == null || parents.length == 0)
+ return false;
+
+ if (ServerUtil.containsModule(server, parents[0], null))
+ return false;
+
+ IModule[] add = new IModule[] { parents[0] };
+ if (wc.canModifyModules(add, null, null).getSeverity() != IStatus.ERROR) {
+ wc.modifyModules(modules, null, null);
+ wc.save(false, null);
+ return true;
+ }
+ } catch (final CoreException ce) {
+ final Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ shell.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ EclipseUtil.openError(shell, ce.getLocalizedMessage());
+ }
+ });
+ return true;
+ }
+ }
+ }
+
+ // otherwise, try Run on Server
+ final IServer finalServer = server;
+ RunOnServerActionDelegate ros = new RunOnServerActionDelegate() {
+ public IServer getServer(IModule module, IModuleArtifact moduleArtifact, IProgressMonitor monitor) throws CoreException {
+ if (!ServerUIPlugin.isCompatibleWithLaunchMode(finalServer, launchMode))
+ return null;
+
+ if (!ServerUtil.containsModule(finalServer, module, monitor)) {
+ IServerWorkingCopy wc = finalServer.createWorkingCopy();
+ try {
+ ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor);
+ wc.save(false, monitor);
+ } catch (CoreException ce) {
+ throw ce;
+ }
+ }
+
+ return finalServer;
+ }
+ };
+ Action action = new Action() {
+ //
+ };
+ ros.selectionChanged(action, new StructuredSelection(data));
+
+ ros.run(action);
+ return true;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServersViewDropAdapterAssistant.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-01-22 11:01:21 UTC (rev 13184)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-01-22 13:52:15 UTC (rev 13185)
@@ -266,7 +266,7 @@
id="org.jboss.ide.eclipse.as.ui.views.JBossServerView"
name="%ViewName_JBossServerView"
category="org.eclipse.wst.server.ui"
- class="org.jboss.tools.as.wst.server.ui.ServersView"
+ class="org.jboss.tools.as.wst.server.ui.xpl.ServersView"
icon="icons/jboss.gif"/>
<view
category="org.eclipse.wst.server.ui"
@@ -280,7 +280,7 @@
<extension point="org.eclipse.ui.decorators">
<decorator
- class="org.jboss.tools.as.wst.server.ui.ServerDecorator"
+ class="org.jboss.tools.as.wst.server.ui.xpl.ServerDecorator"
icon="icons/cview16/servers_view.gif"
id="org.jboss.tools.as.wst.server.ui.navigatorDecorator"
label="Server State Decorator"
@@ -303,10 +303,10 @@
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
activeByDefault="true"
- contentProvider="org.jboss.tools.as.wst.server.ui.ServerContentProvider"
+ contentProvider="org.jboss.tools.as.wst.server.ui.xpl.ServerContentProvider"
icon="icons/cview16/servers_view.gif"
id="org.jboss.tools.as.wst.server.ui.ServersView.content.root"
- labelProvider="org.jboss.tools.as.wst.server.ui.ServerLabelProvider"
+ labelProvider="org.jboss.tools.as.wst.server.ui.xpl.ServerLabelProvider"
name="Servers View Default Content"
priority="highest">
<triggerPoints>
@@ -324,7 +324,7 @@
</instanceof>
</or></possibleChildren>
<actionProvider
- class="org.jboss.tools.as.wst.server.ui.ServerActionProvider"
+ class="org.jboss.tools.as.wst.server.ui.xpl.ServerActionProvider"
id="org.jboss.tools.as.wst.server.ui.ServersView.ServerActionProvider"
priority="highest">
<enablement>
@@ -348,7 +348,7 @@
</enablement>
</actionProvider>
<dropAssistant
- class="org.jboss.tools.as.wst.server.ui.ServersViewDropAdapterAssistant"
+ class="org.jboss.tools.as.wst.server.ui.xpl.ServersViewDropAdapterAssistant"
id="org.jboss.tools.as.wst.server.ui.ServersView.DropAssistant">
<possibleDropTargets>
<instanceof
15 years, 11 months
JBoss Tools SVN: r13184 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2009-01-22 06:01:21 -0500 (Thu, 22 Jan 2009)
New Revision: 13184
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3542
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2009-01-22 09:54:10 UTC (rev 13183)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2009-01-22 11:01:21 UTC (rev 13184)
@@ -589,7 +589,9 @@
(SimpleContentProposalProvider)contentAssistAdapter.getContentProposalProvider();
proposalProvider.setProposals(classCombo.getItems());
} else {
- cssModel.init(currentFile);
+ // FOR https://jira.jboss.org/jira/browse/JBIDE-3542
+ // cssModel.init(currentFile);
+ // styleComposite.revertPreview();
}
}
// update current class style value
@@ -600,7 +602,7 @@
applyButton.setEnabled(true);
classCombo.add(currentClassStyle);
}
- styleComposite.revertPreview();
+
updateStyleComposite();
styleAttributes.setCssSelector(currentClassStyle);
styleComposite.updatePreview(currentClassStyle);
15 years, 11 months
JBoss Tools SVN: r13183 - in vpe/plugins/org.jboss.tools.xulrunner: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-01-22 04:54:10 -0500 (Thu, 22 Jan 2009)
New Revision: 13183
Added:
vpe/plugins/org.jboss.tools.xulrunner/.project
vpe/plugins/org.jboss.tools.xulrunner/META-INF/
vpe/plugins/org.jboss.tools.xulrunner/META-INF/MANIFEST.MF
vpe/plugins/org.jboss.tools.xulrunner/about.html
vpe/plugins/org.jboss.tools.xulrunner/about.ini
vpe/plugins/org.jboss.tools.xulrunner/about.mappings
vpe/plugins/org.jboss.tools.xulrunner/about.properties
vpe/plugins/org.jboss.tools.xulrunner/build.properties
vpe/plugins/org.jboss.tools.xulrunner/plugin.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3468
Added: vpe/plugins/org.jboss.tools.xulrunner/.project
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/.project (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/.project 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.xulrunner</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: vpe/plugins/org.jboss.tools.xulrunner/META-INF/MANIFEST.MF
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/META-INF/MANIFEST.MF (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/META-INF/MANIFEST.MF 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.xulrunner;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: %BundleVendor
+Bundle-Localization: plugin
+Bundle-ActivationPolicy: lazy
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: vpe/plugins/org.jboss.tools.xulrunner/about.html
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/about.html (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/about.html 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>XULRunner</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>XULRunner</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a href="http://www.jboss.org/tools">JBoss Tools project page</a></p>
+
+<p>
+This software is distributed under the terms of the Mozilla Public License - v 1.1
+(see <a href="http://www.mozilla.org/MPL">Mozilla Public License - Version 1.1</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/about.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: vpe/plugins/org.jboss.tools.xulrunner/about.ini
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/about.ini (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/about.ini 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+#featureImage=
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which the
+# welcome page is to be opened.
+# optional
+
+
+
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/about.ini
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: vpe/plugins/org.jboss.tools.xulrunner/about.mappings
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/about.mappings (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/about.mappings 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: vpe/plugins/org.jboss.tools.xulrunner/about.properties
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/about.properties (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/about.properties 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,6 @@
+blurb=XULRunner\n\
+\n\
+Version: {featureVersion}\n\
+\n\
+Copyright (C) 2007-2008 Mozilla and others
+
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/about.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: vpe/plugins/org.jboss.tools.xulrunner/build.properties
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/build.properties (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/build.properties 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,8 @@
+bin.includes = META-INF/,\
+ about.properties,\
+ about.mappings,\
+ about.ini,\
+ about.html,\
+ jboss_about.png,\
+ plugin.properties
+jars.compile.order =
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: vpe/plugins/org.jboss.tools.xulrunner/plugin.properties
===================================================================
--- vpe/plugins/org.jboss.tools.xulrunner/plugin.properties (rev 0)
+++ vpe/plugins/org.jboss.tools.xulrunner/plugin.properties 2009-01-22 09:54:10 UTC (rev 13183)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.xulrunner.initializer
+BundleVendor=JBoss, a division of Red Hat
+BundleName=XULRunner
\ No newline at end of file
Property changes on: vpe/plugins/org.jboss.tools.xulrunner/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
JBoss Tools SVN: r13181 - in trunk/esb/plugins/org.jboss.tools.esb.project.ui: src/org/jboss/tools/esb/project/ui/wizards/pages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2009-01-22 04:37:35 -0500 (Thu, 22 Jan 2009)
New Revision: 13181
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
Log:
JBIDE-3609:Warning message should disappear after select ESB runtime from drop-down list in ESB Project creation wizard
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2009-01-22 08:24:49 UTC (rev 13180)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2009-01-22 09:37:35 UTC (rev 13181)
@@ -35,3 +35,4 @@
org.eclipse.jdt.ui;bundle-version="3.4.1"
Eclipse-LazyStart: true
Bundle-Vendor: %Bundle-Vendor.0
+Export-Package: org.jboss.tools.esb.project.ui
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-01-22 08:24:49 UTC (rev 13180)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-01-22 09:37:35 UTC (rev 13181)
@@ -387,7 +387,8 @@
ESBProjectPlugin.getDefault().getLog().log(e.getStatus());
return false;
}
-
+ // remove the warning message when users change server runtime to a server runtime that contains ESB runtime
+ setMessage(null);
return true;
}
@@ -532,6 +533,10 @@
return;
}else{
setErrorMessage(null);
+ // try to remove the warning message once the target server runtime doesn't contains a ESB runtime.
+ if(btnUserSupplied.getSelection()){
+ setMessage(null);
+ }
hasRuntime = true;
hasValidSrc = true;
hasValidContentFolder = true;
15 years, 11 months
JBoss Tools SVN: r13180 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-01-22 03:24:49 -0500 (Thu, 22 Jan 2009)
New Revision: 13180
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java
Log:
JBIDE-3608 - add DND support to CNF servers view (rogue sysouts. sorry)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java 2009-01-22 08:00:42 UTC (rev 13179)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/ServersDropAdapter.java 2009-01-22 08:24:49 UTC (rev 13180)
@@ -148,13 +148,11 @@
CommonDropAdapterAssistant[] assistants =
findCommonDropAdapterAssistants(target, getCurrentTransfer());
- System.out.println("got " +assistants.length + " assistants: " + assistants);
IStatus valid = null;
for (int i = 0; i < assistants.length; i++) {
try {
valid = assistants[i].validateDrop(getCurrentTarget(),
getCurrentOperation(), getCurrentTransfer());
- System.out.println("assistant " + i + "=" + assistants[i] + " returns " + valid);
if (valid != null && valid.isOK()) {
assistants[i].handleDrop(null, event,
getCurrentTarget());
@@ -188,7 +186,6 @@
try {
valid = assistants[i].validateDrop(target,
theDropOperation, theTransferData);
- System.out.println("assistant " + i + "=" + assistants[i] + " returns " + valid);
} catch (Throwable t) {
NavigatorPlugin.logError(0, t.getMessage(), t);
}
@@ -199,7 +196,6 @@
}
}
setScrollExpandEnabled(true);
- System.out.println("validate returns " + result);
return result;
}
15 years, 11 months