JBoss Tools SVN: r15153 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-05-11 09:28:49 -0400 (Mon, 11 May 2009)
New Revision: 15153
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4277
Can't find a way bypass
https://bugs.eclipse.org/bugs/show_bug.cgi?id=275147
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java 2009-05-11 12:04:34 UTC (rev 15152)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java 2009-05-11 13:28:49 UTC (rev 15153)
@@ -18,8 +18,8 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -81,17 +81,23 @@
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IPath rootLoacation = root.getLocation();
- IPath oldConfigLocation = fLaunchConfiguration.getLocation();
- int matchSegment = oldConfigLocation.matchingFirstSegments(rootLoacation);
- IPath relativePath = oldConfigLocation.removeFirstSegments(matchSegment);
- relativePath = relativePath.setDevice(null).makeAbsolute();
+ IPath oldConfigLocationPath = fLaunchConfiguration.getLocation();
+ if (oldConfigLocationPath == null && fLaunchConfiguration.getFile() != null){
+ oldConfigLocationPath = fLaunchConfiguration.getFile().getFullPath();
+ }
+ if (oldConfigLocationPath != null){
+ int matchSegment = oldConfigLocationPath.matchingFirstSegments(rootLoacation);
+ IPath relativePath = oldConfigLocationPath.removeFirstSegments(matchSegment);
+ relativePath = relativePath.setDevice(null).makeAbsolute();
- if (HibernateRefactoringUtil.isAttributeChanged(relativePath.toOSString(), fOldPath)){
- matchSegment = relativePath.matchingFirstSegments(fOldPath);
- IPath newLaunchPath = fNewPath.append(relativePath.removeFirstSegments(matchSegment));
- IFile[] files = root.findFilesForLocation(rootLoacation.append(newLaunchPath));
- if (files.length > 0){
- fLaunchConfiguration = DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(files[0]);
+ if (HibernateRefactoringUtil.isAttributeChanged(relativePath.toOSString(), fOldPath)){
+ matchSegment = relativePath.matchingFirstSegments(fOldPath);
+ IPath newLaunchPath = fNewPath.append(relativePath.removeFirstSegments(matchSegment));
+ IFile file = root.getFileForLocation(rootLoacation.append(newLaunchPath));
+ if (file != null){
+ fLaunchConfiguration = fLaunchConfiguration.getWorkingCopy();
+ ((ILaunchConfigurationWorkingCopy) fLaunchConfiguration).setContainer(file.getParent());
+ }
}
}
}
15 years, 1 month
JBoss Tools SVN: r15152 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2009-05-11 08:04:34 -0400 (Mon, 11 May 2009)
New Revision: 15152
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java
Log:
fixed nullpointer
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java 2009-05-11 11:20:45 UTC (rev 15151)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java 2009-05-11 12:04:34 UTC (rev 15152)
@@ -84,7 +84,7 @@
selectFileText = new Text(container, SWT.SINGLE | SWT.BORDER);
selectFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
selectFileText.setFont(parent.getFont());
- selectFileText.addModifyListener(this);
+
Button selectFileButton = new Button(container, SWT.NONE);
selectFileButton.setText(WebUIMessages.FILE_SELECT_BUTTON);
@@ -146,6 +146,7 @@
selectFileText.setText(classDescription.getCssFile().getFullPath()
.toString());
+ selectFileText.addModifyListener(this);
setControl(container);
}
15 years, 1 month
JBoss Tools SVN: r15151 - in branches/jbosstools-3.0.x/as/docs/reference: en/images/modules and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2009-05-11 07:20:45 -0400 (Mon, 11 May 2009)
New Revision: 15151
Modified:
branches/jbosstools-3.0.x/as/docs/reference/en/images/modules/modules_3.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/modules/modules_4.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/dnd_toJBossServerView.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/filesets1.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/filesets3.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/filesets4.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_1.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_11.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_12.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_14.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_15.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_16.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_2.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_8.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_1.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_2.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_3.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_5.png
branches/jbosstools-3.0.x/as/docs/reference/en/images/tptp_support/tptp_support_1.png
branches/jbosstools-3.0.x/as/docs/reference/en/modules/modules.xml
branches/jbosstools-3.0.x/as/docs/reference/en/modules/perspective.xml
branches/jbosstools-3.0.x/as/docs/reference/en/modules/quick_start.xml
branches/jbosstools-3.0.x/as/docs/reference/en/modules/runtimes_servers.xml
branches/jbosstools-3.0.x/as/docs/reference/en/modules/webtools.xml
branches/jbosstools-3.0.x/as/docs/reference/pom.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-717 merged changes from trunk are added to the corresponding branch
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/modules/modules_3.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/modules/modules_4.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/dnd_toJBossServerView.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/filesets1.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/filesets3.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/filesets4.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_1.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_11.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_12.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_14.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_15.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_16.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_2.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/perspective/perspective_8.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_1.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_2.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_3.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/quick_start/quick_start_5.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/images/tptp_support/tptp_support_1.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/modules/modules.xml
===================================================================
--- branches/jbosstools-3.0.x/as/docs/reference/en/modules/modules.xml 2009-05-11 09:41:15 UTC (rev 15150)
+++ branches/jbosstools-3.0.x/as/docs/reference/en/modules/modules.xml 2009-05-11 11:20:45 UTC (rev 15151)
@@ -11,7 +11,7 @@
<title>Deploying on the Package Explorer</title>
<para>On the package explorer it is possible to publish either a project to a server or just
- a signal file. Let's look at how to do this.</para>
+ a single file. Let's look at how to do this.</para>
<section id="run_on_server_wizard">
<title>Deploying with Run On Server Wizard</title>
<para> The first WTP method is to right-click on a project, such as a Dynamic Web
@@ -157,8 +157,7 @@
<para>In the <property>Project Archives View</property> you can right-click on any declared
archive and select the <emphasis>
<property>Publish To Server</property>
- </emphasis> element. For more on this subject, see <link linkend="PublishToServer"
- >Publishing to Server</link> in the Project Archives View section.</para>
+ </emphasis> element. For more on this subject, see <link linkend="PublishToServer">Publishing to Server</link> in the Project Archives View section.</para>
<figure>
<title>Publish to Server</title>
<mediaobject>
@@ -176,7 +175,7 @@
<property>.class</property>
</emphasis> file, is to enable the builder for that project. This is done by either
changing the global preferences for the <property>Archives View</property>, or by
- enabling project-specific preferences and ensuring the builder is on.</para>
+ enabling project-specific preferences and ensuring the builder is on.</para>
<para>The last chapter covers a variety of methods on how you can deploy needed modules onto a
server.</para>
</section>
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/modules/perspective.xml
===================================================================
--- branches/jbosstools-3.0.x/as/docs/reference/en/modules/perspective.xml 2009-05-11 09:41:15 UTC (rev 15150)
+++ branches/jbosstools-3.0.x/as/docs/reference/en/modules/perspective.xml 2009-05-11 11:20:45 UTC (rev 15151)
@@ -45,9 +45,9 @@
<section id="jbossserver_view_toolbar">
<title>JBoss Server View Toolbar</title>
<para>In the right top corner of the <property>JBoss Server View</property> there is a
- special toolbar which provides a quick access to starting a server (in debug mode,
- run mode, or profile mode), restarting a server, stopping a server, publishing to a
- server and a possibility to clean a server.</para>
+ special toolbar which provides a quick access to starting a server (in the debug mode,
+ run mode, or profile mode), restarting a server, stopping a server and a possibility to publish to a
+ server.</para>
<figure>
<title>The JBoss Server View Toolbar</title>
@@ -74,12 +74,7 @@
</emphasis> button will republish any modules where it has determined the workspace
is out of sync with the server. It will attempt to do an incremental publish if it
turns out that the module in question is capable of doing one.</para>
-
-
- <para>Press <emphasis>
- <property>Clean</property>
- </emphasis> if you need to clean projects published on the server, i.e. remove
- invalid resources from the server.</para>
+
</section>
<section id="jbossserver_view_structure">
@@ -249,22 +244,13 @@
<para>Publish</para>
</entry>
<entry>
- <para>The action for synching the publish information between the
- server and workspace</para>
+ <para>The action for synchronizing the publish information between
+ the server and workspace</para>
</entry>
</row>
<row>
<entry>
- <para>Clean</para>
- </entry>
- <entry>
- <para>The option for complete redeploying the resources</para>
- </entry>
- </row>
-
- <row>
- <entry>
<para>Explore</para>
</entry>
<entry>
@@ -405,7 +391,7 @@
</emphasis> category allows you to quickly browse to descriptor files in your
server's deploy directory and check or change the values. Basically, <emphasis>
<property>XML Configuration</property>
- </emphasis> includes XML XPaths where a xpath is a path used to access some
+ </emphasis> includes XML XPaths where an xpath is a path used to access some
specific part of an xml document. </para>
<note>
@@ -485,7 +471,7 @@
<para>The goal here is to get an end result where the XPath matches up with a
necessary property. With that in mind, let's look how it works. If the
property you want to reach is the value of the <emphasis>name</emphasis>
- attribute in the element <emphasis><mbean></emphasis>, then your <emphasis>
+ attribute in the element <code><mbean></code>, then your <emphasis>
<property>XPath Patten</property>
</emphasis>should end with <emphasis>mbean</emphasis> and your <emphasis>
<property>Attribute Name</property>
@@ -523,7 +509,7 @@
</tip>
<para>Then, on the other hand, if your desired field is the text of an element
- <emphasis><description></emphasis>, your <emphasis>
+ <code><description></code>, your <emphasis>
<property>XPath Patten</property>
</emphasis> should end with <emphasis>description</emphasis> and <emphasis>
<property>Attribute Name</property>
@@ -548,8 +534,8 @@
<para>Starting from 2.0.0.CR2 version of <property>JBoss AS Tools</property> the
<property>JBoss Server View</property> supports drag-n-drop of deployable and
- runnable projects/resources.</para>
-
+ runnable projects/resources.</para>
+
<figure>
<title>Dragging to the JBoss Server View</title>
<mediaobject>
@@ -558,9 +544,9 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>With drag-n-drop the following actions can be performed:</para>
-
+
<itemizedlist>
<listitem>
<para>dragging a project to a server will deploy it to the server and run it by
@@ -578,9 +564,9 @@
<listitem>
<para>dragging a deployable resource (i.e. a datasource (<emphasis>
- <property>-ds.xml</property></emphasis>) file that has
- been made deployable) will simply deploy that resource directly to the
- server</para>
+ <property>-ds.xml</property>
+ </emphasis>) file that has been made deployable) will simply deploy that
+ resource directly to the server</para>
</listitem>
</itemizedlist>
@@ -704,9 +690,9 @@
<tip>
<title>Tip:</title>
<para>On the figure you can see that a username/password is available in the UI when
- configuring the server. If you get an SecurityException when trying to launch
- the server, it is most likely because your server is protected and hence you
- need to fill the username/password fields with appropriate values.</para>
+ configuring the server. If you get a SecurityException when trying to launch the
+ server, it is most likely because your server is protected and hence you need to
+ fill the username/password fields with appropriate values.</para>
</tip>
<para>It should be pointed out that our server adapter by default tries to automatically
@@ -754,7 +740,8 @@
modify the server's launch configuration. It's just after clicking <emphasis>
<property>Open launch configuration</property>
</emphasis> link. In the open window there are the tabs for setting command line
- arguments and other things that are relevant to launching the server.</para>
+ arguments, classpaths and other things that are relevant to launching the
+ server.</para>
<figure>
<title>Launch Configuration Properties</title>
@@ -769,6 +756,49 @@
url="http://docs.jboss.org/jbossas/guides/installguide/r1/en/html/start-stop.html"
>here</ulink> to find parameters which can be specified for <property>JBoss
Server</property>.</para>
+
+ <note>
+ <title>Note:</title>
+ <para>Please note, that the Launch Configurations for JBoss Servers are enough
+ strict in enforcing the configured values in the server in order to avoid
+ inconsistencies between server's and their configured runtime.</para>
+
+ <para>For example, if you change the launch configuration program arguments to
+ <emphasis>"-c myConfig"</emphasis> but do not change the
+ targeted runtime configuration, then your program arguments will be ignored. The
+ server runtime "wins" so to speak. This ensures consistency
+ and if you change the location of the runtime, your launch configurations will
+ automatically pick that up.</para>
+
+ <para>Values are not controlled by the server and its runtime setup will be passed
+ on unaltered.</para>
+ </note>
+
+ <para>Until 3.0.0.GA release of <property>JBoss Tools</property>, the servers classpath was readonly, but that caused
+ problems for users wanting to add their own jars in the startup classpath. That is
+ relevant if you need to patch the server, add a custom charset or other tweaks that
+ require early access to the classpath.</para>
+
+ <para>Now all servers have a custom 'server runtime classpath
+ container', which is there by default and point to the default jars in
+ JBoss. You can now adjust the classpath. Then just make sure this container is there
+ if you want the classpath to be picked up.</para>
+
+ <figure>
+ <title>Server Classpaths</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/perspective/server_classpaths.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>If for some reason you have a launch configuration without this container, <emphasis>
+ <property>Restore
+ Default Entries</property></emphasis> should add it properly. Also, <emphasis>
+ <property>Restore
+ Default Entries</property></emphasis> will also remove any
+ extra entries you added yourself.</para>
</section>
<section>
@@ -982,11 +1012,11 @@
pattern. As you type in either of these fields, the preview viewer should update
itself with which files are matched.</para>
- <para>You can create a Fileset with flattenning or without it. Look at the
- difference on the figure below.</para>
+ <para>You can create a Fileset with flattening or without it. Look at the difference
+ on the figure below.</para>
<figure>
- <title>The FileSet with flattenning and without it</title>
+ <title>The FileSet with flattening and without it</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/perspective/perspective_24a.png"/>
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/modules/quick_start.xml
===================================================================
--- branches/jbosstools-3.0.x/as/docs/reference/en/modules/quick_start.xml 2009-05-11 09:41:15 UTC (rev 15150)
+++ branches/jbosstools-3.0.x/as/docs/reference/en/modules/quick_start.xml 2009-05-11 11:20:45 UTC (rev 15151)
@@ -23,11 +23,9 @@
<property>stop</property>
</emphasis> it or <emphasis>
<property>restart</property>
- </emphasis> it, <emphasis>
+ </emphasis> it and <emphasis>
<property>publish</property>
- </emphasis> to the server, <emphasis>
- <property>clean</property>
- </emphasis> the server.</para>
+ </emphasis> to the server.</para>
<figure>
<title>JBoss Server Toolbar</title>
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/modules/runtimes_servers.xml
===================================================================
--- branches/jbosstools-3.0.x/as/docs/reference/en/modules/runtimes_servers.xml 2009-05-11 09:41:15 UTC (rev 15150)
+++ branches/jbosstools-3.0.x/as/docs/reference/en/modules/runtimes_servers.xml 2009-05-11 11:20:45 UTC (rev 15151)
@@ -150,7 +150,7 @@
<row>
<entry>
- <para>jRE</para>
+ <para>JRE</para>
</entry>
<entry>
<para>The proper Java Runtime Environment. Because of the open-source nature of
@@ -263,7 +263,10 @@
<property>Finish</property>
</emphasis> to complete the process of the server creation.</para>
<para>Now that we've created our runtimes and servers, we can dwell on all services
- and tools that JBoss Server Manager provides.</para>
+ and tools that JBoss Server Manager provides.</para>
+
+ <para>We hope, this guide helped you to get started with the JBoss Tools server manager. Besides, for additional information you are welcome on <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=201">JBoss forum</ulink>.</para>
</section>
</section>
Modified: branches/jbosstools-3.0.x/as/docs/reference/en/modules/webtools.xml
===================================================================
--- branches/jbosstools-3.0.x/as/docs/reference/en/modules/webtools.xml 2009-05-11 09:41:15 UTC (rev 15150)
+++ branches/jbosstools-3.0.x/as/docs/reference/en/modules/webtools.xml 2009-05-11 11:20:45 UTC (rev 15151)
@@ -57,7 +57,7 @@
<para> The first page of most WTP projects allows you to target a specific runtime,
representing a server's library location. It will also provide you the ability to add
- this project to an EAR project, and select a pre-selected default set of facets, called
+ this project to an EAR project, and select a preselected default set of facets, called
a configuration, rather than manually select each facet you might want.</para>
<para> Selecting the runtime, again, allows the project to install the proper classpaths to
the project so it knows what code to compile against.</para>
Modified: branches/jbosstools-3.0.x/as/docs/reference/pom.xml
===================================================================
--- branches/jbosstools-3.0.x/as/docs/reference/pom.xml 2009-05-11 09:41:15 UTC (rev 15150)
+++ branches/jbosstools-3.0.x/as/docs/reference/pom.xml 2009-05-11 11:20:45 UTC (rev 15151)
@@ -88,6 +88,12 @@
<version>1.1.0</version>
<type>jdocbook-style</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>fop</artifactId>
+ <version>0.95</version>
+ </dependency>
+
</dependencies>
<configuration>
15 years, 1 month
JBoss Tools SVN: r15150 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-11 05:41:15 -0400 (Mon, 11 May 2009)
New Revision: 15150
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
Log:
JBIDE-4301
done
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-11 09:39:14 UTC (rev 15149)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-11 09:41:15 UTC (rev 15150)
@@ -54,6 +54,7 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.model.common.AbstractAnyType;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
/**
@@ -162,9 +163,25 @@
.getAdapterFactory()));
smooksTreeViewer.setLabelProvider(new DecoratingLabelProvider(new AdapterFactoryLabelProvider(editingDomain
- .getAdapterFactory()),
- SmooksConfigurationActivator.getDefault().getWorkbench()
- .getDecoratorManager().getLabelDecorator()));
+ .getAdapterFactory()) {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider#
+ * getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object object) {
+ Object obj = AdapterFactoryEditingDomain.unwrap(object);
+ if (obj instanceof AbstractAnyType) {
+ return super.getText(obj);
+ }
+ return super.getText(object);
+ }
+
+ }, SmooksConfigurationActivator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
smooksTreeViewer.setFilters(new ViewerFilter[] { new TextEObjectModelFilter() });
Object smooksModel = ((SmooksMultiFormEditor) this.formEditor).getSmooksModel();
if (smooksModel != null) {
15 years, 1 month
JBoss Tools SVN: r15149 - in trunk/smooks/plugins: org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-11 05:39:14 -0400 (Mon, 11 May 2009)
New Revision: 15149
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/AddSmooksResourceAction.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java
Log:
JBIDE-4298
1.change some labels
2.reorder the popmenu actions position
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties 2009-05-11 09:09:42 UTC (rev 15148)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties 2009-05-11 09:39:14 UTC (rev 15149)
@@ -90,7 +90,7 @@
_UI_ParamType_type = Param
_UI_ProfilesType_type = Profiles
_UI_ProfileType_type = Profile
-_UI_ReaderType_type = Reader
+_UI_ReaderType_type = Custome Reader
_UI_ResourceConfigType_type = Resource Config
_UI_ResourceType_type = Resource
_UI_SetOffType_type = Set Off
@@ -218,8 +218,8 @@
_UI_WiringType_setterMethod_feature = Setter Method
_UI_WiringType_wireOnElement_feature = Wire On Element
_UI_WiringType_wireOnElementNS_feature = Wire On Element NS
-_UI_Xsl_type = Xsl
-_UI_DocumentRoot_xsl_feature = Xsl
+_UI_Xsl_type = XSL
+_UI_DocumentRoot_xsl_feature = XSL
_UI_Xsl_template_feature = Template
_UI_Xsl_use_feature = Use
_UI_Xsl_param_feature = Param
@@ -227,7 +227,7 @@
_UI_Xsl_applyOnElement_feature = Apply On Element
_UI_Xsl_applyOnElementNS_feature = Apply On Element NS
-_UI_DocumentRoot_outputStream_feature = Output Stream
+_UI_DocumentRoot_outputStream_feature = File Router
_UI_HighWaterMark_mark_feature = Mark
_UI_HighWaterMark_pollFrequency_feature = Poll Frequency
_UI_HighWaterMark_timeout_feature = Timeout
@@ -242,7 +242,7 @@
_UI_OutputStream_resourceName_feature = Resource Name
_UI_HighWaterMark_type = High Water Mark
-_UI_OutputStream_type = Output Stream
+_UI_OutputStream_type = File Router
# CSV
_UI_CsvDocumentRoot_type = Document Root
@@ -259,12 +259,12 @@
# DB routing
-_UI_Executor_type = Executor
+_UI_Executor_type = Database Router
_UI_ResultSet_type = Result Set
_UI_ResultSetRowSelector_type = Result Set Row Selector
-_UI_DocumentRoot_executor_feature = Executor
-_UI_DocumentRoot_resultSetRowSelector_feature = Result Set Row Selector
+_UI_DocumentRoot_executor_feature = Database Router
+_UI_DocumentRoot_resultSetRowSelector_feature = Resultset Row Selector
_UI_Executor_statement_feature = Statement
_UI_Executor_resultSet_feature = Result Set
_UI_Executor_datasource_feature = Datasource
@@ -306,7 +306,7 @@
_UI_HighWaterMark_type = High Water Mark
_UI_Jndi_type = Jndi
_UI_Message_type = Message
-_UI_JmsRouter_type = Jms Router
+_UI_JmsRouter_type = JMS Router
_UI_Session_type = Session
_UI_Connection_factory_feature = Factory
@@ -355,7 +355,7 @@
_UI_JsonDocumentRoot_type = Document Root
_UI_Key_type = Key
_UI_KeyMap_type = Key Map
-_UI_JsonReader_type =Json Reader
+_UI_JsonReader_type =JSON Reader
_UI_JsonDocumentRoot_mixed_feature = Mixed
_UI_JsonDocumentRoot_xMLNSPrefixMap_feature = XMLNS Prefix Map
@@ -387,7 +387,7 @@
# Data Source
_UI_Direct_type = Direct
_UI_DataSourceDocumentRoot_type = Data Source Document Root
-_UI_DataSourceJndi_type = Data Source Jndi
+_UI_DataSourceJndi_type = JNDI
_UI_AbstractReader_type = Abstract Reader
_UI_Direct_autoCommit_feature = Auto Commit
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/AddSmooksResourceAction.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/AddSmooksResourceAction.java 2009-05-11 09:09:42 UTC (rev 15148)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/AddSmooksResourceAction.java 2009-05-11 09:39:14 UTC (rev 15149)
@@ -10,11 +10,14 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.actions;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.action.CreateChildAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.smooks.model.smooks.AbstractReader;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -24,17 +27,17 @@
public AddSmooksResourceAction(EditingDomain editingDomain, ISelection selection, Object descriptor) {
super(editingDomain, selection, descriptor);
- // TODO Auto-generated constructor stub
+ resetActionText();
}
public AddSmooksResourceAction(IEditorPart editorPart, ISelection selection, Object descriptor) {
super(editorPart, selection, descriptor);
- // TODO Auto-generated constructor stub
+ resetActionText();
}
public AddSmooksResourceAction(IWorkbenchPart workbenchPart, ISelection selection, Object descriptor) {
super(workbenchPart, selection, descriptor);
- // TODO Auto-generated constructor stub
+ resetActionText();
}
public Object getDescriptor() {
@@ -44,4 +47,22 @@
public void setDescriptor(Object descriptor) {
this.descriptor = descriptor;
}
+
+ protected void resetActionText(){
+ if(descriptor instanceof CommandParameter){
+ CommandParameter parameter = (CommandParameter)descriptor;
+ if(parameter.getValue() != null){
+ Object value = AdapterFactoryEditingDomain.unwrap(parameter.getValue());
+ if(value instanceof AbstractReader){
+// if(value instanceof JsonReader){
+// setText("JSON Reader");
+// }
+//
+// if(value instanceof ReaderType){
+// setText("Custome Reader");
+// }
+ }
+ }
+ }
+ }
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java 2009-05-11 09:09:42 UTC (rev 15148)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java 2009-05-11 09:39:14 UTC (rev 15149)
@@ -62,7 +62,6 @@
import org.jboss.tools.smooks.model.fileRouting.OutputStream;
import org.jboss.tools.smooks.model.freemarker.Freemarker;
import org.jboss.tools.smooks.model.groovy.Groovy;
-import org.jboss.tools.smooks.model.iorouting.IORouter;
import org.jboss.tools.smooks.model.javabean.BindingsType;
import org.jboss.tools.smooks.model.jmsrouting.JmsRouter;
import org.jboss.tools.smooks.model.medi.EdiMap;
@@ -70,6 +69,7 @@
import org.jboss.tools.smooks.model.medi.MEdiPackage;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
+import org.jboss.tools.smooks.model.smooks.ReaderType;
import org.jboss.tools.smooks.model.smooks.SmooksFactory;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
@@ -205,7 +205,7 @@
* @generated
*/
protected IMenuManager createSiblingMenuManager;
-
+
private ValidateSmooksAction validateSmooksAction;
/**
@@ -218,7 +218,7 @@
super(ADDITIONS_LAST_STYLE);
// loadResourceAction = new LoadResourceAction();
validateAction = new ValidateAction();
-// controlAction = new ControlAction();
+ // controlAction = new ControlAction();
}
protected void addMapNode() {
@@ -349,10 +349,10 @@
public void init(IActionBars actionBars) {
super.init(actionBars);
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
+
validateSmooksAction = new ValidateSmooksAction();
validateSmooksAction.setText("Validate");
-
+
cutAction = new CutAction() {
public void runWithEvent(Event event) {
@@ -447,7 +447,7 @@
EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain();
newChildDescriptors = domain.getNewChildDescriptors(object, null);
-
+
validateSmooksAction.setResource(domain.getResourceSet().getResources().get(0));
validateSmooksAction.setEditingDomain(domain);
// newSiblingDescriptors = domain.getNewChildDescriptors(null,
@@ -586,23 +586,23 @@
public void menuAboutToShow(IMenuManager menuManager) {
menuManager.add(new Separator("edit"));
menuManager.add(new ActionContributionItem(undoAction));
- menuManager.add(new ActionContributionItem(redoAction));
- menuManager.add(new Separator());
- menuManager.add(new ActionContributionItem(deleteAction));
- menuManager.add(new Separator());
- menuManager.add(new ActionContributionItem(cutAction));
- menuManager.add(new ActionContributionItem(copyAction));
- menuManager.add(new ActionContributionItem(pasteAction));
- menuManager.add(new Separator());
+ menuManager.add(new ActionContributionItem(redoAction));
+ menuManager.add(new Separator());
+ menuManager.add(new ActionContributionItem(deleteAction));
+ menuManager.add(new Separator());
+ menuManager.add(new ActionContributionItem(cutAction));
+ menuManager.add(new ActionContributionItem(copyAction));
+ menuManager.add(new ActionContributionItem(pasteAction));
+ menuManager.add(new Separator());
-// if ((style & ADDITIONS_LAST_STYLE) != 0)
-// {
-// menuManager.add(new Separator("additions"));
-// menuManager.add(new Separator());
-// }
- // Add our other standard marker.
- //
- menuManager.add(new Separator("additions-end"));
+ // if ((style & ADDITIONS_LAST_STYLE) != 0)
+ // {
+ // menuManager.add(new Separator("additions"));
+ // menuManager.add(new Separator());
+ // }
+ // Add our other standard marker.
+ //
+ menuManager.add(new Separator("additions-end"));
MenuManager submenuManager = null;
updateRootElementAddAction();
@@ -621,7 +621,7 @@
submenuManager = new MenuManager("Add Smooks Resource");
if (isSmooksResourceListElement()) {
- groupActions(submenuManager,createChildActions);
+ groupActions(submenuManager, createChildActions);
} else {
populateManager(submenuManager, createChildActions, null);
}
@@ -631,7 +631,7 @@
populateManager(submenuManager, createSiblingActions, null);
menuManager.insertBefore("edit", submenuManager);
// don't show properties that
-// menuManager.insertAfter("additions-end", showPropertiesViewAction);
+ // menuManager.insertAfter("additions-end", showPropertiesViewAction);
menuManager.insertAfter("additions-end", validateSmooksAction);
this.addGlobalActions(menuManager);
}
@@ -646,8 +646,8 @@
return false;
}
- protected void groupActions(MenuManager manager,Collection<?> createChildActions) {
- MenuManager readers = new MenuManager("Readers");
+ protected void groupActions(MenuManager manager, Collection<?> createChildActions) {
+ MenuManager readers = new MenuManager("Reader");
manager.add(readers);
MenuManager templating = new MenuManager("Templating");
@@ -664,6 +664,9 @@
MenuManager fragmentRouting = new MenuManager("Fragment Routing");
manager.add(fragmentRouting);
+
+ MenuManager database = new MenuManager("Database");
+ manager.add(database);
for (Iterator<?> iterator = createChildActions.iterator(); iterator.hasNext();) {
boolean added = false;
@@ -675,43 +678,123 @@
added = true;
}
if (isTemplate(descriptor)) {
- templating.add(action);added = true;
+ templating.add(action);
+ added = true;
}
if (isJavaBinding(descriptor)) {
- jbinding.add(action);added = true;
+ jbinding.add(action);
+ added = true;
}
if (isDatasources(descriptor)) {
- datasources.add(action);added = true;
+ datasources.add(action);
+ added = true;
}
+
+ if(isDatabaseDescriptor(descriptor)){
+ database.add(action);
+ added = true;
+ }
if (isScripting(descriptor)) {
- scripting.add(action);added = true;
+ scripting.add(action);
+ added = true;
}
if (isFragmentRouting(descriptor)) {
- fragmentRouting.add(action);added = true;
+ fragmentRouting.add(action);
+ added = true;
}
- if(!added){
+ if (!added) {
manager.add(action);
}
}
+
+ orderReaderAction(readers);
+ orderTemplateAction(templating);
+ orderJBindingAction(jbinding);
+ orderDatasourceAction(datasources);
+ orderScriptAction(scripting);
+ orderFragmentAction(fragmentRouting);
+ orderDatabaseAction(database);
}
- private boolean isFragmentRouting(Object descriptor) {
- if(descriptor instanceof CommandParameter){
- CommandParameter parameter = (CommandParameter)descriptor;
- if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof JmsRouter){
- return true;
+ protected void orderDatabaseAction(MenuManager database) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void orderScriptAction(MenuManager scripting) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void orderFragmentAction(MenuManager fragmentRouting) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void orderDatasourceAction(MenuManager datasources) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void orderJBindingAction(MenuManager jbinding) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void orderTemplateAction(MenuManager templating) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void orderReaderAction(MenuManager readers) {
+ IContributionItem[] items = readers.getItems();
+ for (int i = 0; i < items.length; i++) {
+ IContributionItem item = items[i];
+ if (item instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem) item).getAction();
+ if (action instanceof AddSmooksResourceAction) {
+ AddSmooksResourceAction action1 = (AddSmooksResourceAction) action;
+ Object descriptor = action1.getDescriptor();
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ Object value = AdapterFactoryEditingDomain.unwrap(parameter.getValue());
+ if (value instanceof ReaderType) {
+ int index = items.length - 1;
+ readers.remove(item);
+ readers.insert(index, item);
+ return;
+ }
+ }
+ }
}
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof OutputStream){
+ }
+ }
+ }
+
+ private boolean isDatabaseDescriptor(Object descriptor) {
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof ResultSetRowSelector) {
return true;
}
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof IORouter){
+ }
+ }
+ return false;
+ }
+
+ private boolean isFragmentRouting(Object descriptor) {
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof JmsRouter) {
return true;
}
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Executor){
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof OutputStream) {
return true;
}
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof ResultSetRowSelector){
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Executor) {
return true;
}
}
@@ -720,10 +803,10 @@
}
private boolean isScripting(Object descriptor) {
- if(descriptor instanceof CommandParameter){
- CommandParameter parameter = (CommandParameter)descriptor;
- if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Groovy){
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Groovy) {
return true;
}
}
@@ -732,13 +815,13 @@
}
private boolean isDatasources(Object descriptor) {
- if(descriptor instanceof CommandParameter){
- CommandParameter parameter = (CommandParameter)descriptor;
- if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof DataSourceJndi){
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof DataSourceJndi) {
return true;
}
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Direct){
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Direct) {
return true;
}
}
@@ -747,10 +830,10 @@
}
private boolean isJavaBinding(Object descriptor) {
- if(descriptor instanceof CommandParameter){
- CommandParameter parameter = (CommandParameter)descriptor;
- if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof BindingsType){
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof BindingsType) {
return true;
}
}
@@ -759,13 +842,13 @@
}
private boolean isTemplate(Object descriptor) {
- if(descriptor instanceof CommandParameter){
- CommandParameter parameter = (CommandParameter)descriptor;
- if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Freemarker){
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Freemarker) {
return true;
}
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Xsl){
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Xsl) {
return true;
}
}
@@ -774,10 +857,10 @@
}
private boolean isReader(Object descriptor) {
- if(descriptor instanceof CommandParameter){
- CommandParameter parameter = (CommandParameter)descriptor;
- if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof AbstractReader){
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter parameter = (CommandParameter) descriptor;
+ if (parameter.getValue() != null) {
+ if (AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof AbstractReader) {
return true;
}
}
@@ -823,13 +906,14 @@
*/
@Override
protected void addGlobalActions(IMenuManager menuManager) {
-// menuManager.insertAfter("additions-end", new Separator("ui-actions"));
-// menuManager.insertAfter("additions-end", showPropertiesViewAction);
+ // menuManager.insertAfter("additions-end", new
+ // Separator("ui-actions"));
+ // menuManager.insertAfter("additions-end", showPropertiesViewAction);
-// refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
-// menuManager.insertAfter("ui-actions", refreshViewerAction);
+ // refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ // menuManager.insertAfter("ui-actions", refreshViewerAction);
-// super.addGlobalActions(menuManager);
+ // super.addGlobalActions(menuManager);
}
/**
15 years, 1 month
JBoss Tools SVN: r15148 - in trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-05-11 05:09:42 -0400 (Mon, 11 May 2009)
New Revision: 15148
Added:
trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/FileUtil.java
Modified:
trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/JMXActivator.java
Log:
Moved a file around
Modified: trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/JMXActivator.java
===================================================================
--- trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/JMXActivator.java 2009-05-11 08:45:42 UTC (rev 15147)
+++ trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/JMXActivator.java 2009-05-11 09:09:42 UTC (rev 15148)
@@ -44,4 +44,13 @@
public static void log(int severity, String message, Throwable e) {
log(new Status(severity, PLUGIN_ID, 0, message, e));
}
+
+
+ public static void log(Throwable e) {
+ log(e.getMessage(), e);
+ }
+
+ public static void log(String message, Throwable e) {
+ log(IStatus.ERROR, message, e);
+ }
}
Added: trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/FileUtil.java
===================================================================
--- trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/FileUtil.java (rev 0)
+++ trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/FileUtil.java 2009-05-11 09:09:42 UTC (rev 15148)
@@ -0,0 +1,664 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jmx.core.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.jboss.tools.jmx.core.JMXActivator;
+
+
+public final class FileUtil {
+
+ public FileUtil() {}
+
+ public static String readFile(File f) {
+ if(!f.isFile()) return "";
+ ReadBytes bs = readBytes(f);
+ if(bs == null) return "";
+ String encoding = getEncoding(bs.bs);
+ if(encoding == null) return new String(bs.bs, 0, bs.length);
+ try {
+ return new String(bs.bs, 0, bs.length, encoding);
+ } catch (UnsupportedEncodingException e) {
+ return new String(bs.bs, 0, bs.length);
+ }
+ }
+
+ public static ReadBytes readBytes(File f) {
+ if(!f.isFile()) return null;
+ BufferedInputStream br = null;
+ try {
+ FileInputStream fr = new FileInputStream(f);
+ br = new BufferedInputStream(fr);
+ int l = (int)f.length();
+ byte[] bs = new byte[l];
+ l = br.read(bs, 0, l);
+ br.close();
+ fr.close();
+ return new ReadBytes(bs, l);
+ } catch (IOException e) {
+ return null;
+ } finally {
+ if(br!=null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ //ignore
+ }
+ }
+ }
+ }
+
+ static class ReadBytes {
+ byte[] bs;
+ int length;
+
+ ReadBytes(byte[] bs, int l) {
+ this.bs = bs;
+ length = l;
+ }
+ }
+
+ public static String readFile(File f, String encoding) {
+ ReadBytes bs = readBytes(f);
+ if(bs == null) return null;
+ try {
+ return new String(bs.bs, 0, bs.length, encoding);
+ } catch (UnsupportedEncodingException e) {
+ return null;
+ }
+ }
+
+ public static boolean isTextFile(File f, int length) {
+ if(!f.isFile()) return false;
+ BufferedReader br = null;
+ try {
+ FileReader fr = new FileReader(f);
+ br = new BufferedReader(fr);
+ int l = (int)f.length();
+ if(l > length) l = length;
+ char[] cs = new char[l];
+ br.read(cs, 0, l);
+ br.close();
+ fr.close();
+ return isText(new String(cs));
+ } catch (IOException e) {
+ return false;
+ } finally {
+ if(br!=null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ public static boolean isText(String body) {
+ if(body == null) return false;
+ int l = body.length();
+ for (int i = 0; i < l; i++) {
+ char c = body.charAt(i);
+ if(((int)c) < 32 && c != '\n' && c != '\r' && c != 't') return false;
+ }
+ return true;
+ }
+
+ public static String readStream(InputStream is) {
+ StringBuffer sb = new StringBuffer("");
+ try {
+ byte[] b = new byte[4096];
+ while(true) {
+ int l = is.read(b, 0, b.length);
+ if(l < 0) break;
+ sb.append(new String(b, 0, l));
+ }
+ is.close();
+ } catch (IOException e) {
+ JMXActivator.log(e);
+ }
+ return sb.toString();
+ }
+
+ public static boolean writeFile(File f, String value) {
+ if(value == null) return false;
+ String encoding = getEncoding(value);
+ if(value.startsWith("<?xml")) {
+ String s = validateEncoding(encoding, "UTF-8");
+ if(encoding == null) {
+ encoding = s;
+ } else if(s == null || !s.equals(encoding)) {
+ return false;
+ }
+ }
+ if(encoding == null) return writeFileDefault(f, value);
+ return writeFile(f, value, encoding);
+ }
+
+ public static boolean writeFileDefault(File f, String value) {
+ try {
+ try {
+ if(f.isFile() && !isSameFile(f)) f.delete();
+ if(!f.exists()) f.createNewFile();
+ } catch (IOException e) {
+ JMXActivator.log("Problem writing to file " + f, e);
+ } catch (SecurityException e) {
+ JMXActivator.log("Problem writing to file " + f, e);
+ }
+ PrintWriter pw = new PrintWriter(new FileWriter(f));
+ pw.print(value);
+ pw.flush();
+ pw.close();
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+
+ public static boolean copyFile(File source, File dest, boolean mkdirs) {
+ return copyFile(source, dest, mkdirs, true);
+ }
+
+ public static boolean copyFile(File source, File dest) {
+ return copyFile(source, dest, false, true);
+ }
+
+ public static boolean copyFile(File source, File dest, boolean mkdirs, boolean overwrite) {
+ if (mkdirs) dest.getParentFile().mkdirs();
+ if(!source.isFile()) return false;
+ if(dest.isFile() && !isSameFile(dest)) dest.delete();
+ if(dest.isFile() && !overwrite) return false;
+ if(!dest.exists())
+ try {
+ dest.createNewFile();
+ } catch (IOException e1) {
+ JMXActivator.log(e1);
+ }
+ InputStream is = null;
+ OutputStream os = null;
+ try {
+ is = new BufferedInputStream(new FileInputStream(source), 16 * 1024);
+ os = new BufferedOutputStream(new FileOutputStream(dest), 16 * 1024);
+ copyStream(is, os);
+ return true;
+ } catch (IOException e) {
+ JMXActivator.log(e);
+ return false;
+ } finally {
+ try {
+ if (is != null) is.close();
+ } catch (IOException e) {
+ JMXActivator.log(e);
+ }
+ try {
+ if (os != null) os.close();
+ } catch (IOException e) {
+ JMXActivator.log(e);
+ }
+ }
+ }
+
+ public static boolean updateFile(File source, File dest, boolean mkdirs) {
+ if(!source.isFile()) return false;
+ if(dest.isFile() && (dest.lastModified()<source.lastModified())) {
+ dest.delete();
+ }
+ return copyFile(source, dest, mkdirs);
+ }
+
+ public static void copyStream(InputStream is, OutputStream os) throws IOException {
+ byte[] buffer = new byte[1<<14];
+ while (true) {
+ int r = is.read(buffer);
+ if (r > 0) {
+ os.write(buffer, 0, r);
+ } else if (r == -1) break;
+ }
+ os.flush();
+ }
+
+ public static void clear(File f) {
+ if(!f.isDirectory()) return;
+ File[] fs = f.listFiles();
+ if(fs != null) for (int i = 0; i < fs.length; i++) remove(fs[i]);
+ }
+
+ public static void remove(File f) {
+ if(f.isFile()) f.delete();
+ if(!f.isDirectory()) return;
+ File[] fs = f.listFiles();
+ if(fs != null) for (int i = 0; i < fs.length; i++) remove(fs[i]);
+ f.delete();
+ }
+
+ public static boolean isSameFile(File f) {
+ if(!f.exists()) return false;
+ String fn = f.getName();
+ try {
+ String cn = f.getCanonicalFile().getName();
+ return fn.equals(cn);
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ public static void copyDir(File from, File to) {
+ copyDir(from, to, false);
+ }
+
+ public static void copyDir(File from, File to, boolean mkdirs) {
+ copyDir(from, to, mkdirs, true);
+ }
+
+ public static void copyDir(File from, File to, boolean mkdirs, boolean includeSubdirs) {
+ copyDir(from, to, includeSubdirs, mkdirs, false);
+ }
+
+ public static void copyDir(File from, boolean includeSubdirs, File to) {
+ copyDir(from, to, includeSubdirs, false, false);
+ }
+
+ public static void copyDir(File from, File to, boolean includeSubdirs, boolean mkdirs, boolean overwriteOnlyOlderFiles) {
+ copyDir(from, to, includeSubdirs, mkdirs, overwriteOnlyOlderFiles, null);
+ }
+
+ public static void copyDir(File from, File to, boolean includeSubdirs, boolean mkdirs, boolean overwriteOnlyOlderFiles, FileFilter filter) {
+ if(filter != null && !filter.accept(from)) return;
+ if (mkdirs) to.mkdirs();
+ if(from == null || !from.isDirectory() || !to.isDirectory()) return;
+ File[] fs = from.listFiles();
+ if(fs == null) return;
+ for (int i = 0; i < fs.length; i++) {
+ String n = fs[i].getName();
+ File c = new File(to, n);
+ if (fs[i].isDirectory() && !includeSubdirs) continue;
+ if(filter != null && !filter.accept(new File(from, n))) continue;
+
+ if(fs[i].isDirectory()) {
+ c.mkdirs();
+ copyDir(fs[i], c, includeSubdirs, mkdirs, overwriteOnlyOlderFiles, filter);
+ } else if (overwriteOnlyOlderFiles && fs[i].isFile() && c.isFile()) {
+ copyFile(fs[i], c, false, c.lastModified() < fs[i].lastModified());
+ } else {
+ copyFile(fs[i], c);
+ }
+ }
+ }
+
+ public static void unjar(File dest, String jar) throws IOException {
+ dest.mkdirs();
+ JarFile jf = new JarFile(jar);
+ try {
+ Enumeration es = jf.entries();
+ while(es.hasMoreElements()) {
+ JarEntry je = (JarEntry)es.nextElement();
+ String n = je.getName();
+ File f = new File(dest, n);
+ if (je.isDirectory()) {
+ f.mkdirs();
+ } else {
+ if (f.exists()) {
+ f.delete();
+ } else {
+ f.getParentFile().mkdirs();
+ }
+ InputStream is = jf.getInputStream(je);
+ FileOutputStream os = new FileOutputStream(f);
+ try {
+ copyStream(is, os);
+ } finally {
+ os.close();
+ }
+ }
+ long time = je.getTime();
+ if (time != -1) f.setLastModified(time);
+ }
+ } finally {
+ jf.close();
+ }
+ }
+
+ public static void unjar(File dest, InputStream is) throws IOException {
+ dest.mkdirs();
+ JarInputStream jis = new JarInputStream(is);
+ try {
+ while(true) {
+ JarEntry je = jis.getNextJarEntry();
+ if (je == null) break;
+ String n = je.getName();
+ File f = new File(dest, n);
+ if (je.isDirectory()) {
+ f.mkdirs();
+ } else {
+ if (f.exists()) {
+ f.delete();
+ } else {
+ f.getParentFile().mkdirs();
+ }
+ FileOutputStream os = new FileOutputStream(f);
+ try {
+ copyStream(jis, os);
+ } finally {
+ os.close();
+ }
+ }
+ long time = je.getTime();
+ if (time != -1) f.setLastModified(time);
+ }
+ } finally {
+ jis.close();
+ }
+ }
+
+ public static void jar(File[] fs, String path) throws IOException {
+ jar(fs, path, null);
+ }
+
+ public static void jar(File[] fs, String path, Manifest mf) throws IOException {
+ File f = new File(path);
+ FileOutputStream fos = new FileOutputStream(f);
+ JarOutputStream jos = mf == null ? new JarOutputStream(fos) : new JarOutputStream(fos, mf);
+ try {
+ for (int i = 0; i < fs.length; i++) add(fs[i].getParentFile(), fs[i], jos);
+ } finally {
+ jos.close();
+ fos.close();
+ }
+ }
+
+ public static void add(File root, File f, JarOutputStream jos) throws IOException {
+ int l = root.getAbsolutePath().length();
+ String en = f.getAbsolutePath().substring(l + 1).replace('\\', '/');
+ add(f, en, jos);
+ }
+
+ public static void add(File f, String name, JarOutputStream jos) throws IOException {
+ String en = name;
+ if(f.isDirectory()) en += "/";
+ JarEntry entry = (en.endsWith("/")) ? null : new JarEntry(en);
+ if(f.isDirectory()) {
+ if("/".equals(en)) en = "";
+ File[] fs = f.listFiles();
+ if(fs != null) for (int i = 0; i < fs.length; i++)
+ add(fs[i], en + fs[i].getName(), jos);
+ } else {
+ try {
+ jos.putNextEntry(entry);
+ } catch (IOException e) {
+ return;
+ }
+ FileInputStream is = new FileInputStream(f);
+ byte[] b = new byte[1024];
+ int q = 0;
+ while((q = is.available()) > 0) {
+ if(q > 1024) q = 1024;
+ q = is.read(b, 0, q);
+ jos.write(b, 0, q);
+ }
+ is.close();
+ }
+ if(entry != null) jos.closeEntry();
+ }
+
+ public static void copy(InputStream f, OutputStream t) throws IOException {
+ try {
+ byte[] b = new byte[1024];
+ int q = 0;
+ while((q = f.read(b, 0, b.length)) > 0) t.write(b, 0, q);
+ } finally {
+ f.close();
+ t.close();
+ }
+ }
+
+ public static void unzip(File dest, String jar) throws IOException {
+ dest.mkdirs();
+ ZipFile zf = new ZipFile(jar);
+ try {
+ Enumeration es = zf.entries();
+ while(es.hasMoreElements()) {
+ ZipEntry je = (ZipEntry)es.nextElement();
+ String n = je.getName();
+ File f = new File(dest, n);
+ if (je.isDirectory()) {
+ f.mkdirs();
+ } else {
+ if (f.exists()) {
+ f.delete();
+ } else {
+ f.getParentFile().mkdirs();
+ }
+ InputStream is = zf.getInputStream(je);
+ FileOutputStream os = new FileOutputStream(f);
+ try {
+ copyStream(is, os);
+ } finally {
+ os.close();
+ }
+ }
+ long time = je.getTime();
+ if (time != -1) f.setLastModified(time);
+ }
+ } finally {
+ zf.close();
+ }
+ }
+
+ public static String fileURLToFilePath(String url) {
+ if(url == null) return null;
+ String resultUrl = url.replace('\\', '/');
+/// if(!url.startsWith("file:/")) return url;
+ if(!resultUrl.startsWith("file:")) return resultUrl;
+ int iLast = resultUrl.lastIndexOf(':'), iFirst = resultUrl.indexOf(':');
+ return (iLast == iFirst) ? resultUrl.substring(5) : resultUrl.substring(iLast - 1);
+ }
+
+ //// Relative path
+
+ public static String getRelativePath(String rootpath, String path) {
+ String[] r = tokenizePath(rootpath);
+ String[] p = tokenizePath(path);
+ if(r.length == 0 || p.length == 0 || !r[0].equalsIgnoreCase(p[0])) return null;
+ int i = 0;
+ while(i < r.length && i < p.length && r[i].equalsIgnoreCase(p[i])) ++i;
+ StringBuffer sb = new StringBuffer();
+ for (int k = i; k < r.length; k++) sb.append("/..");
+ for (int k = i; k < p.length; k++) sb.append("/").append(p[k]);
+ return sb.toString();
+ }
+
+ private static String[] tokenizePath(String path) {
+ String tokenizedPath = path.replace('\\', '/');
+ StringTokenizer st = new StringTokenizer(tokenizedPath, "/");
+ ArrayList l = new ArrayList();
+ while(st.hasMoreTokens()) {
+ String t = st.nextToken();
+ if(t.length() == 0 || t.equals(".")) continue;
+ if(t.equals("..")) {
+ if(l.size() > 0) l.remove(l.size() - 1);
+ continue;
+ }
+ l.add(t);
+ }
+ return (String[])l.toArray(new String[0]);
+ }
+
+ public static String encode(String text, String encoding) {
+ if(true) return text;
+ try {
+ byte[] bs = text.getBytes(System.getProperty("file.encoding"));
+ ByteArrayInputStream is = new ByteArrayInputStream(bs);
+ InputStreamReader r = new InputStreamReader(is, encoding);
+ char[] cs = new char[bs.length];
+ int l = r.read(cs, 0, cs.length);
+ return new String(cs, 0, l);
+ } catch (IOException e) {
+ if("UTF-8".equals(encoding)) return text;
+ return encode(text, "UTF-8");
+ }
+ }
+
+ public static String encodeDefault(String text) {
+ return encode(text, System.getProperties().getProperty("file.encoding"));
+ }
+
+/*
+ public static String decode(String text, String encoding) {
+ if(true) return text;
+ try {
+ byte[] bs = text.getBytes(encoding);
+ ByteArrayInputStream is = new ByteArrayInputStream(bs);
+ InputStreamReader r = new InputStreamReader(is, System.getProperties().getProperty("file.encoding"));
+ char[] cs = new char[bs.length];
+ int l = r.read(cs, 0, cs.length);
+ return new String(cs, 0, l);
+ } catch (Exception e) {
+ if("UTF-8".equals(encoding)) return text;
+ return decode(text, "UTF-8");
+ }
+ }
+
+ public static String decodeDefault(String text) {
+ return decode(text, System.getProperties().getProperty("file.encoding"));
+ }
+*/
+
+ public static boolean writeFile(File f, String value, String encoding) {
+ try {
+ try {
+ if(f.isFile() && !isSameFile(f)) f.delete();
+ if(!f.exists()) {
+ f.getParentFile().mkdirs();
+ f.createNewFile();
+ }
+ } catch (IOException e) {
+ JMXActivator.log(e);
+ }
+ FileOutputStream fs = new FileOutputStream(f);
+ OutputStreamWriter osw = new OutputStreamWriter(fs, encoding);
+ PrintWriter pw = new PrintWriter(osw);
+ pw.print(value);
+ pw.flush();
+ pw.close();
+ return true;
+ } catch (FileNotFoundException e) {
+ //ignore
+ return writeFileDefault(f, value);
+ } catch (UnsupportedEncodingException e) {
+ //ignore
+ return writeFileDefault(f, value);
+ }
+ }
+
+
+ public static String getEncoding(String s) {
+ if(s == null) return null;
+ if(s.startsWith("<?xml")) {
+ int i = s.indexOf("encoding=");
+ if(i < 0) return null;
+ i += "encoding=".length() + 1;
+ int j = s.indexOf('\"', i);
+ if(j < 0) return null;
+ return s.substring(i, j);
+ }
+ return null;
+ }
+
+ static Set validEncodings = new HashSet();
+ static Set invalidEncodings = new HashSet();
+
+ public static String validateEncoding(String encoding, String defaultEncoding) {
+ if(encoding == null || encoding.equals(defaultEncoding)) return defaultEncoding;
+ if(validEncodings.contains(encoding)) return encoding;
+ if(invalidEncodings.contains(encoding)) return defaultEncoding;
+ try {
+ if(defaultEncoding.equals("UTF-16")) {
+ new String(XML_16, 0, XML_16.length, encoding);
+ } else {
+ new String(XML_8, 0, XML_8.length, encoding);
+ }
+ validEncodings.add(encoding);
+ return encoding;
+ } catch (UnsupportedEncodingException e) {
+ invalidEncodings.add(encoding);
+ return defaultEncoding;
+ }
+ }
+
+ static byte[] XML_8 = {(byte)'<',(byte)'?',(byte)'x',(byte)'m',(byte)'l'};
+ static byte[] XML_16 = {(byte)-2,(byte)-1,(byte)0,(byte)60,(byte)0,(byte)63,(byte)0,(byte)120,(byte)0,(byte)109,(byte)0,(byte)108};
+
+ public static String getEncoding(byte[] bs) {
+ if(bs.length < 20) return null;
+ if(startsWith(bs, XML_8)) {
+ int i = getIndex(bs, (byte)'?', 5);
+ if(i < 0) return "UTF-8";
+ String encoding = getEncoding(new String(bs, 0, i));
+ return validateEncoding(encoding, "UTF-8");
+ } else if(startsWith(bs, XML_16)) {
+ int i = getIndex(bs, (byte)'?', XML_16.length);
+ if(i < 0) return "UTF-16";
+ try {
+ String encoding = getEncoding(new String(bs, 0, i, "UTF-16"));
+ return validateEncoding(encoding, "UTF-16");
+ } catch (UnsupportedEncodingException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ static boolean startsWith(byte[] bs, byte[] prefix) {
+ for (int i = 0; i < prefix.length; i++) {
+ if(bs[i] != prefix[i]) return false;
+ }
+ return true;
+ }
+
+ static int getIndex(byte[] bs, byte b, int offset) {
+ for (int i = offset; i < bs.length; i++) {
+ if(bs[i] == b) return i;
+ }
+ return -1;
+ }
+
+}
15 years, 1 month
JBoss Tools SVN: r15147 - in trunk/smooks/plugins: org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/dbrouting/impl and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-11 04:45:42 -0400 (Mon, 11 May 2009)
New Revision: 15147
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/impl/CounterImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/dbrouting/impl/ResultSetImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/impl/InlineImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/groovy/impl/GroovyImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/MessageImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/SessionImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/xsl/impl/InlineImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
Log:
JBIDE-4300
1.When user input "null" text , unset the attribute value.
2.When user select blank option of combo box , unset the attribute value
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/impl/CounterImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/impl/CounterImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/impl/CounterImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -195,10 +195,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final CountDirection DIRECTION_EDEFAULT = CountDirection.INCREMENT;
+ protected static final CountDirection DIRECTION_EDEFAULT = null;// CountDirection.INCREMENT;
/**
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/dbrouting/impl/ResultSetImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/dbrouting/impl/ResultSetImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/dbrouting/impl/ResultSetImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -58,10 +58,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getScope()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final ResultSetScopeType SCOPE_EDEFAULT = ResultSetScopeType.EXECUTION;
+ protected static final ResultSetScopeType SCOPE_EDEFAULT = null;// ResultSetScopeType.EXECUTION;
/**
* The cached value of the '{@link #getScope() <em>Scope</em>}' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/impl/InlineImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/impl/InlineImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/impl/InlineImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -37,10 +37,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirective()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final InlineDirective DIRECTIVE_EDEFAULT = InlineDirective.ADDTO;
+ protected static final InlineDirective DIRECTIVE_EDEFAULT = null;// InlineDirective.ADDTO;
/**
* The cached value of the '{@link #getDirective() <em>Directive</em>}' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/groovy/impl/GroovyImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/groovy/impl/GroovyImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/groovy/impl/GroovyImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -157,6 +157,7 @@
*/
protected GroovyImpl() {
super();
+ this.setExecuteBefore(false);
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/MessageImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/MessageImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/MessageImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -61,10 +61,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDeliveryMode()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final DeliveryMode DELIVERY_MODE_EDEFAULT = DeliveryMode.PERSISTENT;
+ protected static final DeliveryMode DELIVERY_MODE_EDEFAULT = null;//DeliveryMode.PERSISTENT;
/**
* The cached value of the '{@link #getDeliveryMode() <em>Delivery Mode</em>}' attribute.
@@ -148,10 +148,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final MessageType TYPE_EDEFAULT = MessageType.TEXT_MESSAGE;
+ protected static final MessageType TYPE_EDEFAULT = null;//MessageType.TEXT_MESSAGE;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/SessionImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/SessionImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/impl/SessionImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -37,10 +37,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAcknowledgeMode()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final AcknowledgeMode ACKNOWLEDGE_MODE_EDEFAULT = AcknowledgeMode.AUTOACKNOWLEDGE;
+ protected static final AcknowledgeMode ACKNOWLEDGE_MODE_EDEFAULT = null;// AcknowledgeMode.AUTOACKNOWLEDGE;
/**
* The cached value of the '{@link #getAcknowledgeMode() <em>Acknowledge Mode</em>}' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -38,6 +38,8 @@
import org.jboss.tools.smooks.model.fileRouting.FileRoutingPackage;
import org.jboss.tools.smooks.model.freemarker.FreemarkerFactory;
import org.jboss.tools.smooks.model.freemarker.FreemarkerPackage;
+import org.jboss.tools.smooks.model.groovy.GroovyFactory;
+import org.jboss.tools.smooks.model.groovy.GroovyPackage;
import org.jboss.tools.smooks.model.iorouting.IoroutingFactory;
import org.jboss.tools.smooks.model.iorouting.IoroutingPackage;
import org.jboss.tools.smooks.model.javabean.JavabeanFactory;
@@ -280,6 +282,11 @@
// for calc
newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP, FeatureMapUtil
.createEntry(CalcPackage.Literals.CALC_DOCUMENT_ROOT__COUNTER, CalcFactory.eINSTANCE.createCounter())));
+
+ // for groovy
+
+ newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP, FeatureMapUtil
+ .createEntry(GroovyPackage.Literals.DOCUMENT_ROOT__GROOVY, GroovyFactory.eINSTANCE.createGroovy())));
// for datasource
newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP, FeatureMapUtil
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/xsl/impl/InlineImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/xsl/impl/InlineImpl.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/xsl/impl/InlineImpl.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -37,10 +37,10 @@
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirective()
- * @generated
+ * @generated not
* @ordered
*/
- protected static final InlineDirective DIRECTIVE_EDEFAULT = InlineDirective.ADDTO;
+ protected static final InlineDirective DIRECTIVE_EDEFAULT = null;// InlineDirective.ADDTO;
/**
* The cached value of the '{@link #getDirective() <em>Directive</em>}' attribute.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -67,34 +67,32 @@
public static final String BINDINGS = "bindings";
- public static EStructuralFeature ATTRIBUTE_PROPERTY = ExtendedMetaData.INSTANCE.demandFeature(
- null, "property", false);
+ public static EStructuralFeature ATTRIBUTE_PROPERTY = ExtendedMetaData.INSTANCE.demandFeature(null, "property",
+ false);
- public static EStructuralFeature ATTRIBUTE_SELECTOR = ExtendedMetaData.INSTANCE.demandFeature(
- null, "selector", false);
+ public static EStructuralFeature ATTRIBUTE_SELECTOR = ExtendedMetaData.INSTANCE.demandFeature(null, "selector",
+ false);
- public static EStructuralFeature ATTRIBUTE_TYPE = ExtendedMetaData.INSTANCE.demandFeature(null,
- "type", false);
+ public static EStructuralFeature ATTRIBUTE_TYPE = ExtendedMetaData.INSTANCE.demandFeature(null, "type", false);
public static EStructuralFeature ELEMENT_BINDING = ExtendedMetaData.INSTANCE.demandFeature(
- "http://www.milyn.org/xsd/smooks-1.0.xsd", "binding", true);
+ "http://www.milyn.org/xsd/smooks-1.0.xsd", "binding", true);
- public static AnyType addBindingTypeToParamType(ParamType param, String property,
- String selector, String type, String uri) {
+ public static AnyType addBindingTypeToParamType(ParamType param, String property, String selector, String type,
+ String uri) {
AnyType binding = createBindingType(property, selector, type, uri);
param.getMixed().add(ELEMENT_BINDING, binding);
return binding;
}
- public static List<Object> getBindingListFromResourceConfigType(
- ResourceConfigType resourceConfig) {
+ public static List<Object> getBindingListFromResourceConfigType(ResourceConfigType resourceConfig) {
List<ParamType> paramList = resourceConfig.getParam();
for (Iterator<ParamType> iterator = paramList.iterator(); iterator.hasNext();) {
ParamType param = iterator.next();
if ("bindings".equals(param.getName())) {
- if (param.eContents().isEmpty()) continue;
- List<Object> bindingList = (List<Object>) param.getMixed().get(
- SmooksModelUtils.ELEMENT_BINDING, false);
+ if (param.eContents().isEmpty())
+ continue;
+ List<Object> bindingList = (List<Object>) param.getMixed().get(SmooksModelUtils.ELEMENT_BINDING, false);
return bindingList;
}
}
@@ -103,17 +101,18 @@
public static boolean isBeanPopulatorResource(ResourceConfigType type) {
ResourceType resource = type.getResource();
- if (resource == null) return false;
+ if (resource == null)
+ return false;
String value = resource.getStringValue();
- if (value != null) value = value.trim();
+ if (value != null)
+ value = value.trim();
if (SmooksModelConstants.BEAN_POPULATOR.equals(value)) {
return true;
}
return false;
}
- public static void setPropertyValueToAnyType(Object value, EStructuralFeature attribute,
- AnyType anyType) {
+ public static void setPropertyValueToAnyType(Object value, EStructuralFeature attribute, AnyType anyType) {
anyType.getAnyAttribute().set(attribute, value);
}
@@ -122,7 +121,8 @@
for (Iterator iterator = bindingList.iterator(); iterator.hasNext();) {
AnyType binding = (AnyType) iterator.next();
String pro = getAttributeValueFromAnyType(binding, ATTRIBUTE_PROPERTY);
- if (pro != null) pro = pro.trim();
+ if (pro != null)
+ pro = pro.trim();
if (property.equals(pro)) {
return binding;
}
@@ -132,21 +132,26 @@
public static boolean isInnerFileContents(ResourceConfigType resourceConfig) {
ResourceType resource = resourceConfig.getResource();
- if (resource == null) return false;
+ if (resource == null)
+ return false;
String type = resource.getType();
- if (type != null) type = type.trim();
+ if (type != null)
+ type = type.trim();
for (int i = 0; i < TEMPLATE_TYPES.length; i++) {
String type1 = TEMPLATE_TYPES[i];
- if (type1.equalsIgnoreCase(type)) return true;
+ if (type1.equalsIgnoreCase(type))
+ return true;
}
return false;
}
public static boolean isDateTypeSelector(ResourceConfigType type) {
ResourceType resource = type.getResource();
- if (resource == null) return false;
+ if (resource == null)
+ return false;
String value = resource.getStringValue();
- if (value != null) value = value.trim();
+ if (value != null)
+ value = value.trim();
for (int i = 0; i < SmooksModelConstants.DECODER_CLASSES.length; i++) {
String decoderClass = SmooksModelConstants.DECODER_CLASSES[i];
if (decoderClass.equals(value)) {
@@ -158,13 +163,15 @@
public static String getTransformType(ResourceConfigType resourceConfig) {
ParamType typeParam = null;
- if (resourceConfig == null) return "";
+ if (resourceConfig == null)
+ return "";
if (isTransformTypeResourceConfig(resourceConfig)) {
List paramList = resourceConfig.getParam();
for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
ParamType param = (ParamType) iterator.next();
String name = param.getName();
- if (name != null) name = name.trim();
+ if (name != null)
+ name = name.trim();
if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(name)) {
typeParam = param;
break;
@@ -178,7 +185,8 @@
}
public static void setTransformType(ResourceConfigType resourceConfig, String type) {
- if (type == null) type = "";
+ if (type == null)
+ type = "";
if (isTransformTypeResourceConfig(resourceConfig)) {
List paramList = resourceConfig.getParam();
for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
@@ -209,7 +217,8 @@
public static boolean isTransformTypeResourceConfig(ResourceConfigType resourceConfig) {
String selector = resourceConfig.getSelector();
- if (selector != null) selector = selector.trim();
+ if (selector != null)
+ selector = selector.trim();
if (!SmooksModelConstants.GLOBAL_PARAMETERS.equals(selector)) {
return false;
}
@@ -221,7 +230,8 @@
for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
ParamType p = (ParamType) iterator.next();
String paramName = p.getName();
- if (paramName != null) paramName = paramName.trim();
+ if (paramName != null)
+ paramName = paramName.trim();
if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(paramName)) {
return true;
}
@@ -230,14 +240,14 @@
}
}
- public static void setParamText(String paramName, String value,
- ResourceConfigType resourceConfigType) {
+ public static void setParamText(String paramName, String value, ResourceConfigType resourceConfigType) {
List<ParamType> list = resourceConfigType.getParam();
ParamType param = null;
for (Iterator<ParamType> iterator = list.iterator(); iterator.hasNext();) {
ParamType paramType = (ParamType) iterator.next();
String n = paramType.getName();
- if (n == null) continue;
+ if (n == null)
+ continue;
n = n.trim();
if (n.equalsIgnoreCase(paramName)) {
param = paramType;
@@ -257,7 +267,8 @@
for (Iterator iterator = plist.iterator(); iterator.hasNext();) {
ParamType p = (ParamType) iterator.next();
String n = p.getName();
- if (n == null) continue;
+ if (n == null)
+ continue;
n = n.trim();
if (paramName.equalsIgnoreCase(n)) {
return getAnyTypeText(p);
@@ -272,8 +283,7 @@
}
public static String getAnyTypeText(AnyType anyType) {
- Object value = anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT,
- true);
+ Object value = anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true);
if (value != null) {
if (value instanceof List && !((List) value).isEmpty()) {
return ((List) value).get(0).toString().trim();
@@ -284,8 +294,7 @@
}
public static String getAnyTypeCDATA(AnyType anyType) {
- Object value = anyType.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true);
+ Object value = anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true);
if (value != null) {
if (value instanceof List && !((List) value).isEmpty()) {
return ((List) value).get(0).toString().trim();
@@ -296,8 +305,7 @@
}
public static String getAnyTypeComment(AnyType anyType) {
- Object value = anyType.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, true);
+ Object value = anyType.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, true);
if (value != null) {
if (value instanceof List && !((List) value).isEmpty()) {
return ((List) value).get(0).toString().trim();
@@ -307,8 +315,7 @@
return null;
}
- public static AnyType createBindingType(String property, String selector, String type,
- String uri) {
+ public static AnyType createBindingType(String property, String selector, String type, String uri) {
if (uri == null) {
uri = SmooksPackage.eNS_URI;
}
@@ -331,23 +338,19 @@
smooksModel.getMixed().add(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, text);
}
- public static void setTextToSmooksType(EditingDomain editingDomain, AnyType smooksModel,
- String text) {
+ public static void setTextToSmooksType(EditingDomain editingDomain, AnyType smooksModel, String text) {
CompoundCommand ccommand = new CompoundCommand();
- List<String> listValue = new ArrayList<String>();
- listValue.add(text);
- Command addCommand = AddCommand.create(editingDomain, smooksModel,
- XMLTypePackage.Literals.ANY_TYPE__MIXED, FeatureMapUtil.createEntry(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, text));
- Object removeValue = (smooksModel.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true));
+ Command addCommand = null;
+ if (text != null) {
+ addCommand = AddCommand.create(editingDomain, smooksModel, XMLTypePackage.Literals.ANY_TYPE__MIXED,
+ FeatureMapUtil.createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, text));
+ }
+ Object removeValue = (smooksModel.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true));
if (removeValue != null && removeValue instanceof Collection<?>) {
List<Object> rList = new ArrayList<Object>();
- for (Iterator<?> iterator = ((Collection<?>) removeValue).iterator(); iterator
- .hasNext();) {
+ for (Iterator<?> iterator = ((Collection<?>) removeValue).iterator(); iterator.hasNext();) {
Object string = (Object) iterator.next();
- rList.add(FeatureMapUtil.createEntry(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, string));
+ rList.add(FeatureMapUtil.createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, string));
}
Command cc = RemoveCommand.create(editingDomain, smooksModel, null, rList);
if (cc != null && cc.canExecute()) {
@@ -359,24 +362,20 @@
}
editingDomain.getCommandStack().execute(ccommand);
}
-
- public static void setCommentToSmooksType(EditingDomain editingDomain, AnyType smooksModel,
- String cdata) {
+
+ public static void setCommentToSmooksType(EditingDomain editingDomain, AnyType smooksModel, String comment) {
CompoundCommand ccommand = new CompoundCommand();
- List<String> listValue = new ArrayList<String>();
- listValue.add(cdata);
- Command addCommand = AddCommand.create(editingDomain, smooksModel,
- XMLTypePackage.Literals.ANY_TYPE__MIXED, FeatureMapUtil.createEntry(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, cdata));
- Object removeValue = (smooksModel.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, true));
+ Command addCommand = null;
+ if (comment != null) {
+ addCommand = AddCommand.create(editingDomain, smooksModel, XMLTypePackage.Literals.ANY_TYPE__MIXED,
+ FeatureMapUtil.createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, comment));
+ }
+ Object removeValue = (smooksModel.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, true));
if (removeValue != null && removeValue instanceof Collection<?>) {
List<Object> rList = new ArrayList<Object>();
- for (Iterator<?> iterator = ((Collection<?>) removeValue).iterator(); iterator
- .hasNext();) {
+ for (Iterator<?> iterator = ((Collection<?>) removeValue).iterator(); iterator.hasNext();) {
Object string = (Object) iterator.next();
- rList.add(FeatureMapUtil.createEntry(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, string));
+ rList.add(FeatureMapUtil.createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, string));
}
Command cc = RemoveCommand.create(editingDomain, smooksModel, null, rList);
if (cc != null && cc.canExecute()) {
@@ -389,23 +388,19 @@
editingDomain.getCommandStack().execute(ccommand);
}
- public static void setCDATAToSmooksType(EditingDomain editingDomain, AnyType smooksModel,
- String cdata) {
+ public static void setCDATAToSmooksType(EditingDomain editingDomain, AnyType smooksModel, String cdata) {
CompoundCommand ccommand = new CompoundCommand();
- List<String> listValue = new ArrayList<String>();
- listValue.add(cdata);
- Command addCommand = AddCommand.create(editingDomain, smooksModel,
- XMLTypePackage.Literals.ANY_TYPE__MIXED, FeatureMapUtil.createEntry(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, cdata));
- Object removeValue = (smooksModel.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true));
+ Command addCommand = null;
+ if (cdata != null) {
+ addCommand = AddCommand.create(editingDomain, smooksModel, XMLTypePackage.Literals.ANY_TYPE__MIXED,
+ FeatureMapUtil.createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, cdata));
+ }
+ Object removeValue = (smooksModel.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true));
if (removeValue != null && removeValue instanceof Collection<?>) {
List<Object> rList = new ArrayList<Object>();
- for (Iterator<?> iterator = ((Collection<?>) removeValue).iterator(); iterator
- .hasNext();) {
+ for (Iterator<?> iterator = ((Collection<?>) removeValue).iterator(); iterator.hasNext();) {
Object string = (Object) iterator.next();
- rList.add(FeatureMapUtil.createEntry(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, string));
+ rList.add(FeatureMapUtil.createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, string));
}
Command cc = RemoveCommand.create(editingDomain, smooksModel, null, rList);
if (cc != null && cc.canExecute()) {
@@ -433,24 +428,22 @@
}
public static void cleanTextToSmooksType(AnyType smooksModel) {
- Object obj = smooksModel.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true);
+ Object obj = smooksModel.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true);
if (obj instanceof List) {
((List) obj).clear();
}
}
public static void cleanCDATAToSmooksType(AnyType smooksModel) {
- Object obj = smooksModel.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true);
+ Object obj = smooksModel.getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true);
if (obj instanceof List) {
((List) obj).clear();
}
}
public static CommandParameter createTextCommandParamter(Object owner, String value) {
- return createChildParameter(owner, XMLTypePackage.Literals.ANY_TYPE__MIXED, FeatureMapUtil
- .createEntry(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, value));
+ return createChildParameter(owner, XMLTypePackage.Literals.ANY_TYPE__MIXED, FeatureMapUtil.createEntry(
+ XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, value));
}
public static CommandParameter createChildParameter(Object owner, Object feature, Object child) {
@@ -460,8 +453,7 @@
public static void addJavaInput(SmooksGraphicsExtType ext, String className) {
InputType javaInput = SmooksGraphicsExtFactory.eINSTANCE.createInputType();
javaInput.setType(INPUT_TYPE_JAVA);
- org.jboss.tools.smooks.model.graphics.ext.ParamType p = SmooksGraphicsExtFactory.eINSTANCE
- .createParamType();
+ org.jboss.tools.smooks.model.graphics.ext.ParamType p = SmooksGraphicsExtFactory.eINSTANCE.createParamType();
p.setName(PARAM_NAME_CLASS);
p.setValue(className);
javaInput.getParam().add(p);
@@ -471,23 +463,24 @@
public static String getInputPath(InputType input) {
List<org.jboss.tools.smooks.model.graphics.ext.ParamType> list = input.getParam();
if (INPUT_TYPE_JAVA.equals(input.getType()) || INPUT_TYPE_XML.equals(input.getType())
- || INPUT_TYPE_XSD.equals(input.getType())) {
+ || INPUT_TYPE_XSD.equals(input.getType())) {
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
org.jboss.tools.smooks.model.graphics.ext.ParamType paramType = (org.jboss.tools.smooks.model.graphics.ext.ParamType) iterator
- .next();
+ .next();
if ("path".equals(paramType.getName())) {
String value = paramType.getValue();
- if (value != null) value = value.trim();
+ if (value != null)
+ value = value.trim();
return value;
}
}
}
return null;
}
-
- public static List<ConditionType> collectConditionType(SmooksResourceListType resourceList){
+
+ public static List<ConditionType> collectConditionType(SmooksResourceListType resourceList) {
ConditionsType conditions = resourceList.getConditions();
- if(conditions != null){
+ if (conditions != null) {
return conditions.getCondition();
}
return Collections.emptyList();
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksActionBarContributor.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -61,7 +61,7 @@
import org.jboss.tools.smooks.model.dbrouting.ResultSetRowSelector;
import org.jboss.tools.smooks.model.fileRouting.OutputStream;
import org.jboss.tools.smooks.model.freemarker.Freemarker;
-import org.jboss.tools.smooks.model.groovy.ScriptType;
+import org.jboss.tools.smooks.model.groovy.Groovy;
import org.jboss.tools.smooks.model.iorouting.IORouter;
import org.jboss.tools.smooks.model.javabean.BindingsType;
import org.jboss.tools.smooks.model.jmsrouting.JmsRouter;
@@ -669,6 +669,7 @@
boolean added = false;
AddSmooksResourceAction action = (AddSmooksResourceAction) iterator.next();
Object descriptor = action.getDescriptor();
+
if (isReader(descriptor)) {
readers.add(action);
added = true;
@@ -722,7 +723,7 @@
if(descriptor instanceof CommandParameter){
CommandParameter parameter = (CommandParameter)descriptor;
if(parameter.getValue() != null){
- if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof ScriptType){
+ if(AdapterFactoryEditingDomain.unwrap(parameter.getValue()) instanceof Groovy){
return true;
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -135,11 +135,10 @@
protected void createSmooksTreeViewer(FormToolkit tool, final IManagedForm managedForm,
Composite rootMainControl) {
- configurationSection = tool.createSection(rootMainControl, Section.TITLE_BAR
- | Section.DESCRIPTION);
+ configurationSection = tool.createSection(rootMainControl, Section.TITLE_BAR);
configurationSection
.setDescription("Define Smooks elements for configuration file in the following section.");
- configurationSection.setText("Smooks elements");
+ configurationSection.setText("Message Filtering Resources");
sectionPart = new SectionPart(configurationSection);
managedForm.addPart(sectionPart);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-05-11 05:24:57 UTC (rev 15146)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-05-11 08:45:42 UTC (rev 15147)
@@ -164,7 +164,7 @@
labelComposite.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
Control labelControl = null;
-
+
if (!isLink) {
Label label = formToolKit.createLabel(labelComposite, displayName + " :");
label.setForeground(formToolKit.getColors().getColor(IFormColors.TITLE));
@@ -183,7 +183,7 @@
gd.horizontalAlignment = GridData.BEGINNING;
gd.verticalAlignment = GridData.BEGINNING;
notificationComposite.setLayoutData(gd);
-
+
wrapper.setLabelControl(labelControl);
wrapper.setMarker(notificationComposite);
return wrapper;
@@ -473,8 +473,12 @@
return;
}
String text = SmooksModelUtils.getAnyTypeText((AnyType) fm);
- if (!valueText.getText().equals(text)) {
- SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ if (valueText.getText() == null || valueText.getText().length() == 0) {
+ SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm, null);
+ } else {
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ }
}
}
});
@@ -486,8 +490,12 @@
return;
}
String text = SmooksModelUtils.getAnyTypeComment((AnyType) fm);
- if (!valueText.getText().equals(text)) {
- SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ if (valueText.getText() == null || valueText.getText().length() == 0) {
+ SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm, null);
+ } else {
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ }
}
}
});
@@ -499,8 +507,12 @@
return;
}
String text = SmooksModelUtils.getAnyTypeCDATA((AnyType) fm);
- if (!valueText.getText().equals(text)) {
- SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ if (valueText.getText() == null || valueText.getText().length() == 0) {
+ SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm, null);
+ } else {
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ }
}
}
});
@@ -511,8 +523,12 @@
public void modifyText(ModifyEvent e) {
Object editValue = getEditValue(itemPropertyDescriptor, fm);
if (editValue != null) {
- if (!editValue.equals(valueText.getText())) {
- itemPropertyDescriptor.setPropertyValue(fm, valueText.getText());
+ if (valueText.getText() == null || valueText.getText().length() == 0) {
+ itemPropertyDescriptor.setPropertyValue(fm, null);
+ } else {
+ if (!editValue.equals(valueText.getText())) {
+ itemPropertyDescriptor.setPropertyValue(fm, valueText.getText());
+ }
}
} else {
itemPropertyDescriptor.setPropertyValue(fm, valueText.getText());
@@ -614,6 +630,11 @@
Object value = propertyDescriptor.getPropertyValue(model);
if (value != null && value instanceof PropertyValueWrapper) {
Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
+ if (searchComposite.getText().getText() == null
+ || searchComposite.getText().getText().length() == 0) {
+ propertyDescriptor.setPropertyValue(model, null);
+ return;
+ }
if (editValue != null) {
if (!editValue.equals(searchComposite.getText().getText())) {
propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
@@ -825,11 +846,12 @@
style = style | SWT.READ_ONLY;
}
final Combo combo = new Combo(parent, style);
+ combo.add("");
if (items != null) {
for (int i = 0; i < items.length; i++) {
combo.add(items[i]);
if (items[i].equals(editValue)) {
- currentSelect = i;
+ currentSelect = i + 1;
}
}
}
@@ -844,6 +866,10 @@
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String text = combo.getText();
+ if (text == null || text.length() == 0) {
+ fipd.setPropertyValue(fm, null);
+ return;
+ }
Object setValue = text;
if (fp != null) {
setValue = fp.wrapValue(text);
@@ -916,13 +942,17 @@
searchComposite.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Object editValue = getEditValue(propertyDescriptor, model);
- Object value = searchComposite.getText().getText();
- if (editValue != null) {
- if (!editValue.equals(value)) {
+ String value = searchComposite.getText().getText();
+ if (value == null || value.length() == 0) {
+ propertyDescriptor.setPropertyValue(model, null);
+ } else {
+ if (editValue != null) {
+ if (!editValue.equals(value)) {
+ propertyDescriptor.setPropertyValue(model, value);
+ }
+ } else {
propertyDescriptor.setPropertyValue(model, value);
}
- } else {
- propertyDescriptor.setPropertyValue(model, value);
}
}
});
15 years, 1 month
JBoss Tools SVN: r15146 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-05-11 01:24:57 -0400 (Mon, 11 May 2009)
New Revision: 15146
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4271, displaying of arrow icons were fixed, additional check for negative value during restoring sash weights was added.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-05-10 22:08:26 UTC (rev 15145)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-05-11 05:24:57 UTC (rev 15146)
@@ -30,7 +30,6 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.messages.VpeUIMessages;
/**
@@ -274,9 +273,16 @@
Color oldFg = gc.getForeground();
Color oldBg = gc.getBackground();
- drawArrow(gc, currentSashInfo.sashLocs[0], currentSashInfo.cursorOver == 0); // Draw first arrow
- if (currentSashInfo.sashLocs.length > 1)
- drawArrow(gc, currentSashInfo.sashLocs[1], currentSashInfo.cursorOver == 1); // Draw second arrow
+ /*
+ * Draw first arrow
+ */
+ drawArrow(gc, currentSashInfo.sashLocs[0], currentSashInfo.cursorOver == 0);
+ /*
+ * Draw second arrow
+ */
+ if (currentSashInfo.sashLocs.length > 1) {
+ drawArrow(gc, currentSashInfo.sashLocs[1], currentSashInfo.cursorOver == 1);
+ }
if (currentSashInfo.sashBorderLeft)
drawSashBorder(gc, currentSashInfo.sash, true);
@@ -465,154 +471,238 @@
}
});
- recomputeSashInfo(); // Get initial setting
+ recomputeSashInfo(); // Get initial setting
}
}
protected void recomputeSashInfo() {
- if (inMouseClick && currentSashInfo.cursorOver != NO_WEIGHT)
- return; // Don't process because we are in the down mouse button on an arrow.
-
- // We need to refigure size for the sash arrows.
- int[] addArrows = null;
- int[] drawArrows = null;
- int[] weights = getWeights(); // This should be two entries only. We shouldn't of gotton here if there were more than two.
- if (noMaxUp) {
- addArrows = new int[1];
- drawArrows = new int[1];
- if (weights[1] == 0) {
- // Slammed to the bottom
- addArrows[0] = UP_ARROW;
- drawArrows[0] = UP_ARROW;
- currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
- currentSashInfo.sashBorderRight = false;
- } else {
- // Not slammed
- addArrows[0] = DOWN_MAX_ARROW;
- drawArrows[0] = DOWN_ARROW;
- currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
- currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
- currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- }
- } else if (noMaxDown) {
- addArrows = new int[1];
- drawArrows = new int[1];
- if (weights[0] == 0) {
- // Slammed to the top
- addArrows[0] = DOWN_ARROW;
- drawArrows[0] = DOWN_ARROW;
- currentSashInfo.sashBorderLeft = false;
- currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- } else {
- // Not slammed
- addArrows[0] = UP_MAX_ARROW;
- drawArrows[0] = UP_ARROW;
- currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
- currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
- currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- }
+ /*
+ * Don't process because we are in the down mouse button on an arrow.
+ */
+ if (inMouseClick && currentSashInfo.cursorOver != NO_WEIGHT) {
+ return;
+ }
+
+ /*
+ * We need to refigure size for the sash arrows.
+ */
+ int[] addArrows = null;
+ int[] drawArrows = null;
+ /*
+ * This should be two entries only.
+ * We shouldn't of gotton here if there were more than two.
+ */
+ int[] weights = getWeights();
+ /*
+ * Current sash orientation.
+ */
+ int orientation = getOrientation();
+
+ if (noMaxUp) {
+ addArrows = new int[1];
+ drawArrows = new int[1];
+ if (weights[1] == 0) {
+ /*
+ * Slammed to the bottom or to the right
+ */
+ addArrows[0] = UP_ARROW;
+ drawArrows[0] = UP_ARROW;
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = false;
} else {
- addArrows = new int[2];
- drawArrows = new int[2];
- // TODO: SashForm as changed the following is a temporary kludge
- Rectangle sashBounds = currentSashInfo.sash.getBounds();
- Rectangle clientArea = getClientArea();
- final int DRAG_MINIMUM = 20; // TODO: kludge see SashForm.DRAG_MINIMUM
- if (weights[0] == 0 || (currentSashInfo.weight != NO_WEIGHT && sashBounds.y <= DRAG_MINIMUM)) {
- // Slammed to the top.
- addArrows[0] = DOWN_MAX_ARROW;
- drawArrows[0] = DOWN_MAX_ARROW;
- addArrows[1] = DOWN_ARROW;
- drawArrows[1] = DOWN_ARROW;
- currentSashInfo.sashBorderLeft = false;
- currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ /*
+ * Not slammed
+ */
+ addArrows[0] = DOWN_MAX_ARROW;
+ drawArrows[0] = DOWN_ARROW;
+ /*
+ * Since we are in the middle, there is no weight.
+ * We've could of been dragged here.
+ */
+ currentSashInfo.weight = NO_WEIGHT;
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ }
+ } else if (noMaxDown) {
+ addArrows = new int[1];
+ drawArrows = new int[1];
+ if (weights[0] == 0) {
+ /*
+ * Slammed to the top or to the top
+ */
+ addArrows[0] = DOWN_ARROW;
+ drawArrows[0] = DOWN_ARROW;
+ currentSashInfo.sashBorderLeft = false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ } else {
+ /*
+ * Not slammed
+ */
+ addArrows[0] = UP_MAX_ARROW;
+ drawArrows[0] = UP_ARROW;
+ /*
+ * Since we are in the middle, there is no weight.
+ * We've could of been dragged here.
+ */
+ currentSashInfo.weight = NO_WEIGHT;
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ }
+ } else {
+ addArrows = new int[2];
+ drawArrows = new int[2];
+ Rectangle sashBounds = currentSashInfo.sash.getBounds(); // TODO: SashForm as changed the following is a temporary kludge
+ Rectangle clientArea = getClientArea();
+ final int DRAG_MINIMUM = 20; // TODO: kludge see SashForm.DRAG_MINIMUM
+ if (weights[0] == 0
+ || ((currentSashInfo.weight != NO_WEIGHT)
+ && ((orientation == SWT.VERTICAL) && (sashBounds.y <= DRAG_MINIMUM)
+ || (orientation == SWT.HORIZONTAL) && (sashBounds.x <= DRAG_MINIMUM)))) {
+ /*
+ * When maximized to the top or to the left
+ */
+ if (orientation == SWT.VERTICAL) {
+ addArrows[0] = DOWN_MAX_ARROW;
+ drawArrows[0] = DOWN_MAX_ARROW;
+ addArrows[1] = DOWN_ARROW;
+ drawArrows[1] = DOWN_ARROW;
+ } else {
+ addArrows[0] = DOWN_ARROW;
+ drawArrows[0] = DOWN_ARROW;
+ addArrows[1] = DOWN_MAX_ARROW;
+ drawArrows[1] = DOWN_MAX_ARROW;
+ }
+ currentSashInfo.sashBorderLeft = false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- } else if (weights[1] == 0 || (currentSashInfo.weight != NO_WEIGHT && sashBounds.y+sashBounds.height >= clientArea.height-DRAG_MINIMUM)) {
- // Slammed to the bottom
- addArrows[0] = UP_ARROW;
- drawArrows[0] = UP_ARROW;
- addArrows[1] = UP_MAX_ARROW;
- drawArrows[1] = UP_MAX_ARROW;
- currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
- currentSashInfo.sashBorderRight = false;
- } else {
- // Not slammed
- addArrows[0] = UP_MAX_ARROW;
- drawArrows[0] = UP_ARROW;
- addArrows[1] = DOWN_MAX_ARROW;
- drawArrows[1] = DOWN_ARROW;
- currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
- currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
- currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- }
+ } else if ((weights[1] == 0)
+ || ((currentSashInfo.weight != NO_WEIGHT)
+ && (((orientation == SWT.VERTICAL) && (sashBounds.y + sashBounds.height >= clientArea.height - DRAG_MINIMUM))
+ || ((orientation == SWT.HORIZONTAL) && (sashBounds.x + sashBounds.width >= clientArea.width - DRAG_MINIMUM))))) {
+ /*
+ * When maximized to the bottom or to the right
+ */
+ if (orientation == SWT.VERTICAL) {
+ addArrows[0] = UP_ARROW;
+ drawArrows[0] = UP_ARROW;
+ addArrows[1] = UP_MAX_ARROW;
+ drawArrows[1] = UP_MAX_ARROW;
+ } else {
+ addArrows[0] = UP_MAX_ARROW;
+ drawArrows[0] = UP_MAX_ARROW;
+ addArrows[1] = UP_ARROW;
+ drawArrows[1] = UP_ARROW;
+ }
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = false;
+ } else {
+ /*
+ * Not slammed
+ */
+ addArrows[0] = UP_MAX_ARROW;
+ drawArrows[0] = UP_ARROW;
+ addArrows[1] = DOWN_MAX_ARROW;
+ drawArrows[1] = DOWN_ARROW;
+ /*
+ * Since we are in the middle, there is no weight.
+ * We've could of been dragged here.
+ */
+ currentSashInfo.weight = NO_WEIGHT;
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
}
- getNewSashArray(currentSashInfo, addArrows, drawArrows);
-
- currentSashInfo.sash.redraw(); // Need to schedule a redraw because it has already drawn the old ones during the set bounds in super layout.
+ }
+ getNewSashArray(currentSashInfo, addArrows, drawArrows);
+ /*
+ * Need to schedule a redraw
+ * because it has already drawn the old ones
+ * during the set bounds in super layout.
+ */
+ currentSashInfo.sash.redraw();
}
-
+
protected void upClicked(SashInfo sashinfo) {
- // This means restore just the sash below weight and reduce the above weight by the right amount.
+ /*
+ * This means restore just the sash below weight
+ * and reduce the above weight by the right amount.
+ */
int[] weights = getWeights();
-
- weights[0] = 1000-sashinfo.weight; // Assume weights are always in units of 1000.
- weights[1] = sashinfo.weight;
- sashinfo.weight = NO_WEIGHT;
-
- setWeights(weights);
- fireDividerMoved();
+ if (sashinfo.weight != NO_WEIGHT) {
+ weights[0] = 1000-sashinfo.weight; // Assume weights are always in units of 1000
+ weights[1] = sashinfo.weight;
+ sashinfo.weight = NO_WEIGHT; // Set '-1' to weight to show that sash is not slammed.
+ setWeights(weights);
+ fireDividerMoved();
+ }
}
protected void upMaxClicked(SashInfo sashinfo) {
int[] weights = getWeights();
+ /*
+ * Up max, so save the current weight of 1 into the sash info,
+ * and move to the top.
+ */
+ if (currentSashInfo.weight == NO_WEIGHT) {
+ currentSashInfo.weight = weights[1]; // Not currently maxed, save position.
+ }
- // Up max, so save the current weight of 1 into the sash info, and move to the top.
- if (currentSashInfo.weight == NO_WEIGHT)
- currentSashInfo.weight = weights[1]; // Not currently maxed, save position.
-
weights[1] = 1000;
weights[0] = 0;
- // If the upper panel has focus, flip focus to the lower panel because the upper panel is now hidden.
+ /*
+ * If the upper panel has focus,
+ * flip focus to the lower panel
+ * because the upper panel is now hidden.
+ */
Control[] children = getChildren();
boolean upperFocus = isFocusAncestorA(children[0]);
setWeights(weights);
- if (upperFocus)
- children[1].setFocus();
-
+ if (upperFocus) {
+ children[1].setFocus();
+ }
+ recomputeSashInfo();
fireDividerMoved();
}
protected void downClicked(SashInfo sashinfo) {
- // This means restore just the sash below weight and increase the above weight by that amount.
+ /*
+ * This means restore just the sash below weight
+ * and increase the above weight by that amount.
+ */
int[] weights = getWeights();
-
- weights[0] = 1000-sashinfo.weight; // Assume weights are always in units of 1000.
- weights[1] = sashinfo.weight;
- sashinfo.weight = NO_WEIGHT;
-
- setWeights(weights);
- fireDividerMoved();
+ if (sashinfo.weight != NO_WEIGHT) {
+ weights[0] = 1000-sashinfo.weight; // Assume weights are always in units of 1000
+ weights[1] = sashinfo.weight;
+ sashinfo.weight = NO_WEIGHT; // Set '-1' to weight to show that sash is not slammed.
+ setWeights(weights);
+ fireDividerMoved();
+ }
}
protected void downMaxClicked(SashInfo sashinfo) {
int[] weights = getWeights();
-
- // Down max, so save the current weight of 1 into the sash info, and move to the bottom.
- if (currentSashInfo.weight == NO_WEIGHT)
- currentSashInfo.weight = weights[1]; // Not currently maxed, save current weight.
+ /*
+ * Down max, so save the current weight of 1 into the sash info, and move to the bottom.
+ */
+ if (currentSashInfo.weight == NO_WEIGHT) {
+ currentSashInfo.weight = weights[1]; // Not currently maxed, save current weight.
+ }
weights[0] = 1000;
weights[1] = 0;
-
- // If the lower panel has focus, flip focus to the upper panel because the lower panel is now hidden.
+ /*
+ * If the lower panel has focus,
+ * flip focus to the upper panel
+ * because the lower panel is now hidden.
+ */
Control[] children = getChildren();
boolean lowerFocus = isFocusAncestorA(children[1]);
setWeights(weights);
- if (lowerFocus)
- children[0].setFocus();
-
+ if (lowerFocus) {
+ children[0].setFocus();
+ }
+ recomputeSashInfo();
fireDividerMoved();
}
@@ -660,9 +750,9 @@
height = tSize;
}
for (int j=0; j<addArrowTypes.length; j++) {
- if (thisSash[j] == null)
- thisSash[j] = new int[] {addArrowTypes[j], drawArrowTypes[j], x, y, width, height};
- else {
+ if (thisSash[j] == null) {
+ thisSash[j] = new int[] {addArrowTypes[j], drawArrowTypes[j], x, y, width, height};
+ } else {
// Reuse the array
thisSash[j][ARROW_TYPE_INDEX] = addArrowTypes[j];
thisSash[j][ARROW_DRAWN_INDEX] = drawArrowTypes[j];
@@ -695,7 +785,7 @@
}
protected void drawArrow(GC gc, int[] sashLoc, boolean selected) {
- int indent = 0;
+ int indent = 0;
if (selected) {
if (!inMouseClick) {
// Draw the selection box.
15 years, 1 month
JBoss Tools SVN: r15145 - workspace/examples.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-05-10 18:08:26 -0400 (Sun, 10 May 2009)
New Revision: 15145
Added:
workspace/examples/project-examples-3.1.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4180 We should have the projects featured in Seam tutorials available in Project Examples
Added: workspace/examples/project-examples-3.1.xml
===================================================================
--- workspace/examples/project-examples-3.1.xml (rev 0)
+++ workspace/examples/project-examples-3.1.xml 2009-05-10 22:08:26 UTC (rev 15145)
@@ -0,0 +1,93 @@
+<projects>
+ <project>
+ <category>Seam</category>
+ <name>registration</name>
+ <included-projects>
+ registration,registration-ejb,registration-ear,registration-test
+ </included-projects>
+ <shortDescription>Seam Registration Example - EAR (including a test project)</shortDescription>
+ <description>This is a trivial example for the Seam tutorial. It runs on both JBoss AS and Tomcat.
+It includes the registration,registration-ejb,registration-ear,registration-test projects.
+</description>
+ <size>31657984</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ </project>
+
+ <project>
+ <category>Seam</category>
+ <name>registration2</name>
+ <included-projects>
+ registration,registration-ejb,registration-ear
+ </included-projects>
+ <shortDescription>Seam Registration Example - EAR</shortDescription>
+ <description>This is a trivial example for the Seam tutorial. It runs on both JBoss AS and Tomcat.
+The example creates the registration,registration-ejb,registration-ear projects.
+It includes a tutorial.
+</description>
+ <size>8450048</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ <welcome type="cheatsheets" url="/registration/cheatsheets/registration.xml"/>
+ </project>
+
+ <project>
+ <category>Seam</category>
+ <name>messages</name>
+ <included-projects>
+ messages,messages-ejb,messages-ear
+ </included-projects>
+ <shortDescription>Seam Messages Example - EAR</shortDescription>
+ <description>This is a simple example of the use of @DataModel for the Seam tutorial. It runs on JBoss AS as an EAR.
+The example creates the messages,messages-ejb and messages-ear projects.
+It includes a tutorial.
+</description>
+ <size>7680000</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ <welcome type="cheatsheets" url="/messages/cheatsheets/messages.xml"/>
+ </project>
+
+ <project>
+ <category>Seam</category>
+ <name>todo</name>
+ <included-projects>
+ todo,todo-ejb,todo-ear
+ </included-projects>
+ <shortDescription>Seam and jBPM: the todo list example - EAR</shortDescription>
+ <description>This is a simple example for the Seam tutorial, demonstrating the
+use of jBPM-based business process management.
+The example creates the todo,todo-ejb and todo-ear projects.
+It includes a tutorial.
+</description>
+ <size>2183168</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ <welcome type="cheatsheets" url="/todo/cheatsheets/todo.xml"/>
+ </project>
+
+ <project>
+ <category>Seam</category>
+ <name>numberguess</name>
+ <included-projects>
+ numberguess,numberguess-ejb,numberguess-ear
+ </included-projects>
+ <shortDescription>Seam pageflow: the numberguess example - EAR</shortDescription>
+ <description>This is a simple example for the Seam tutorial, demonstrating the use of
+jBPM-based page flow. It runs on both JBoss AS as an EAR and Tomcat with
+Embedded JBoss as an EAR.
+The example creates the numberguess,numberguess-ejb and numberguess-ear projects.
+It includes a tutorial.
+</description>
+ <size>2203648</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ <welcome type="cheatsheets" url="/numberguess/cheatsheets/numberguess.xml"/>
+ </project>
+
+</projects>
15 years, 1 month
JBoss Tools SVN: r15144 - in workspace: snjeza/seam-examples and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-05-10 15:35:59 -0400 (Sun, 10 May 2009)
New Revision: 15144
Added:
workspace/snjeza/seam-examples/numberguess.zip
workspace/snjeza/seam-examples/todo.zip
Modified:
workspace/examples/project-examples-3.0.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4180 We should have the projects featured in Seam tutorials available in Project Examples - the todo and numberguess examples
Modified: workspace/examples/project-examples-3.0.xml
===================================================================
--- workspace/examples/project-examples-3.0.xml 2009-05-09 11:22:20 UTC (rev 15143)
+++ workspace/examples/project-examples-3.0.xml 2009-05-10 19:35:59 UTC (rev 15144)
@@ -176,7 +176,7 @@
</included-projects>
<shortDescription>Seam Messages Example - EAR</shortDescription>
<description>This is a simple example of the use of @DataModel for the Seam tutorial. It runs on JBoss AS as an EAR.
-The example creates the messages,messages-ejb,messages-ear projects.
+The example creates the messages,messages-ejb and messages-ear projects.
It includes a tutorial.
</description>
<size>7680000</size>
@@ -187,6 +187,45 @@
</project>
<project>
+ <category>Seam</category>
+ <name>todo</name>
+ <included-projects>
+ todo,todo-ejb,todo-ear
+ </included-projects>
+ <shortDescription>Seam and jBPM: the todo list example - EAR</shortDescription>
+ <description>This is a simple example for the Seam tutorial, demonstrating the
+use of jBPM-based business process management.
+The example creates the todo,todo-ejb and todo-ear projects.
+It includes a tutorial.
+</description>
+ <size>2183168</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ <welcome type="cheatsheets" url="/todo/cheatsheets/todo.xml"/>
+ </project>
+
+ <project>
+ <category>Seam</category>
+ <name>numberguess</name>
+ <included-projects>
+ numberguess,numberguess-ejb,numberguess-ear
+ </included-projects>
+ <shortDescription>Seam pageflow: the numberguess example - EAR</shortDescription>
+ <description>This is a simple example for the Seam tutorial, demonstrating the use of
+jBPM-based page flow. It runs on both JBoss AS as an EAR and Tomcat with
+Embedded JBoss as an EAR.
+The example creates the numberguess,numberguess-ejb and numberguess-ear projects.
+It includes a tutorial.
+</description>
+ <size>2203648</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ <welcome type="cheatsheets" url="/numberguess/cheatsheets/numberguess.xml"/>
+ </project>
+
+ <project>
<category>Portlet</category>
<name>testjavaportlet</name>
<shortDescription>JBoss Java Portlet Example</shortDescription>
Added: workspace/snjeza/seam-examples/numberguess.zip
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/seam-examples/numberguess.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/seam-examples/todo.zip
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/seam-examples/todo.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 1 month