JBoss Tools SVN: r30270 - in branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user: .settings and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2011-04-04 10:30:43 -0400 (Mon, 04 Apr 2011)
New Revision: 30270
Added:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.project
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.settings/
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.settings/org.eclipse.pde.core.prefs
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/ModeShapeHelpContexts.xml
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.xml
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/pom.xml
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/toc.xml
Log:
JBIDE-6656 Created a documentation-only plugin. Moved the context help pages into this new plugin.
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.project
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.project (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.project 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.modeshape.rest.doc.user</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.settings/org.eclipse.pde.core.prefs
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.settings/org.eclipse.pde.core.prefs (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.settings/org.eclipse.pde.core.prefs 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,4 @@
+#Tue Mar 22 12:35:06 CDT 2011
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/.settings/org.eclipse.pde.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.jboss.tools.modeshape.rest.doc.user;singleton:=true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Vendor: %bundleVendor
+Bundle-Localization: plugin
+Bundle-ActivationPolicy: lazy
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/ModeShapeHelpContexts.xml
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/ModeShapeHelpContexts.xml (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/ModeShapeHelpContexts.xml 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,38 @@
+<!--
+ - See the COPYRIGHT.txt file distributed with this work for information
+ - regarding copyright ownership.
+ -
+ - This software is made available by Red Hat, Inc. 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.
+ -
+ - See the AUTHORS.txt file in the distribution for a full listing of
+ - individual contributors.
+ -->
+<contexts>
+ <context id="serverViewHelpContext" title="ModeShape Server View">
+ <description>The ModeShape Server View shows all registered servers and their repositories and workspaces.</description>
+ <topic href="ServerView.html" label="Server View"/>
+ <topic href="ServerDialog.html" label="Server Dialog"/>
+ </context>
+ <context id="serverDialogHelpContext" title="Server Dialog">
+ <description>The ModeShape Server Dialog allows you to edit or create a server that hosts one or more repositories.</description>
+ <topic href="ServerDialog.html" label="Server Dialog"/>
+ <topic href="ServerView.html" label="Server View"/>
+ </context>
+ <context id="publishDialogHelpContext" title="ModeShape Publish and Unpublish Dialog Help">
+ <description>The Publish/Unpublish Dialog uploads or removes selected resources from the selected server.</description>
+ <topic href="PublishDialog.html" label="Publish/Unpublish Dialog"/>
+ <topic href="ServerDialog.html" label="Create a new server"/>
+ <topic href="ModeShapePreferencesDialog.html" label="ModeShape Preferences"/>
+ </context>
+ <context id="preferencesHelpContext" title="ModeShape Preferences Dialog Help">
+ <description>The ModeShape Preferences Dialog allows you to identify file extensions and folder names that should not be involved in publishing operations.</description>
+ <topic href="ModeShapePreferencesDialog.html" label="ModeShape Preferences"/>
+ <topic href="PublishDialog.html" label="Publish/Unpublish Dialog"/>
+ </context>
+ <context id="messageConsoleHelpContext" title="ModeShape Message Console">
+ <description>The ModeShape Message Console contains the output from the publishing and unpublishing operations.</description>
+ <topic href="ModeShapeMessageConsole.html" label="ModeShape Message Console"/>
+ </context>
+</contexts>
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/ModeShapeHelpContexts.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,13 @@
+bin.includes = META-INF/,\
+ doc.zip,\
+ plugin.properties,\
+ plugin.xml,\
+ toc.xml,\
+ ModeShapeHelpContexts.xml
+src.includes = build.properties,\
+ doc.zip,\
+ toc.xml,\
+ plugin.xml,\
+ META-INF/,\
+ ModeShapeHelpContexts.xml,\
+ plugin.properties
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
===================================================================
(Binary files differ)
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.properties
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.properties (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.properties 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,13 @@
+#
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership.
+#
+# This software is made available by Red Hat, Inc. 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.
+#
+# See the AUTHORS.txt file in the distribution for a full listing of
+# individual contributors.
+#
+bundleName = ModeShape REST Eclipse Publishing Plug-in Guide
+bundleVendor = JBoss by Red Hat
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.xml (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.xml 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<!--
+ - See the COPYRIGHT.txt file distributed with this work for information
+ - regarding copyright ownership.
+ -
+ - This software is made available by Red Hat, Inc. 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.
+ -
+ - See the AUTHORS.txt file in the distribution for a full listing of
+ - individual contributors.
+-->
+
+<plugin>
+
+<!-- Context Help -->
+ <extension point="org.eclipse.help.contexts">
+ <contexts
+ file="ModeShapeHelpContexts.xml"
+ plugin="org.jboss.tools.modeshape.rest">
+ </contexts>
+ </extension>
+
+<!-- Help Table of Contents -->
+ <extension point="org.eclipse.help.toc">
+ <toc file="toc.xml" primary="true" />
+ </extension>
+
+</plugin>
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/plugin.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/pom.xml
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/pom.xml (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/pom.xml 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.modeshape</groupId>
+ <artifactId>org.jboss.tools.modeshape.rest.doc.user</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/toc.xml
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/toc.xml (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/toc.xml 2011-04-04 14:30:43 UTC (rev 30270)
@@ -0,0 +1,20 @@
+<!--
+ - See the COPYRIGHT.txt file distributed with this work for information
+ - regarding copyright ownership.
+ -
+ - This software is made available by Red Hat, Inc. 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.
+ -
+ - See the AUTHORS.txt file in the distribution for a full listing of
+ - individual contributors.
+ -->
+<toc label="ModeShape Publishing">
+ <topic label="Publishing/Unpublishing Dialog" href="docs/PublishDialog.html"/>
+ <topic label="Server View" href="docs/ServerView.html"/>
+ <topic label="Server Dialog" href="docs/ServerDialog.html"/>
+ <topic label="ModeShape Message Console" href="docs/ModeShapeMessageConsole.html"/>
+ <topic label="Published Locations Dialog" href="docs/PublishedLocationsDialog.html"/>
+ <topic label="Resource Context Menu" href="docs/ResourceContextMenu.html"/>
+ <topic label="ModeShape Preferences Dialog" href="docs/ModeShapePreferencesDialog.html"/>
+</toc>
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/toc.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 2 months
JBoss Tools SVN: r30268 - in branches/jbosstools-3.2.x/modeshape: plugins/org.jboss.tools.modeshape.rest and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2011-04-04 10:26:19 -0400 (Mon, 04 Apr 2011)
New Revision: 30268
Added:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/WorkspaceArea.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FileFiltersPreferencePage.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PreferenceInitializer.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/SortedListEditor.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/impl/
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/impl/StaticLoggerBinder.java
Removed:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/StaticLoggerBinder.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/NewItemDialog.java
Modified:
branches/jbosstools-3.2.x/modeshape/features/org.jboss.tools.modeshape.rest.feature/feature.xml
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/log4j.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Activator.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/IUiConstants.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/PublishJob.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/EclipseLogger.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFileExtensionEditor.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFoldersEditor.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/ModeShapePreferencePage.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PrefUtils.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PublishingFileFilter.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/prefs.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishWizard.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerPage.java
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerWizard.java
branches/jbosstools-3.2.x/modeshape/tests/org.jboss.tools.modeshape.rest.test/src/org/jboss/tools/modeshape/rest/MockRestClient.java
Log:
JBDS-1403 The known repository workspace areas are now shown to the user in a ComboBox. The user can choose one of those or enter on of their own.
JBIDE-6656 Created a documentation-only plugin. Moved the context help pages into this new plugin.
JBIDE-8242 Created a preference user can set to version files that are published. At the time of publishing the user can override this preference.
JBIDE-8396 Filter folder and file names preference now doesn't allow duplicates.
JBIDE-8661 SLF4J logging is fixed. Trace logging is mapped to Elipse's "info" messages.
Still need to update to the ModeShape 2.5.0 GA jar when released (using a beta jar now). Also have to update the Eclipse context help images and pages.
Modified: branches/jbosstools-3.2.x/modeshape/features/org.jboss.tools.modeshape.rest.feature/feature.xml
===================================================================
--- branches/jbosstools-3.2.x/modeshape/features/org.jboss.tools.modeshape.rest.feature/feature.xml 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/features/org.jboss.tools.modeshape.rest.feature/feature.xml 2011-04-04 14:26:19 UTC (rev 30268)
@@ -42,4 +42,10 @@
install-size="0"
version="0.0.0"/>
+ <plugin
+ id="org.jboss.tools.modeshape.rest.doc.user"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
</feature>
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.properties
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.properties 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.properties 2011-04-04 14:26:19 UTC (rev 30268)
@@ -14,7 +14,9 @@
contextMenu.label = ModeShape
decorator.description = Decorates objects in the ModeShape View
decorator.label = ModeShape View Decorator
+fileFiltersPreferencePage = File Filters
modeShapeCategory = ModeShape
+preferenceInitializer = Preference Initializer for default values
publishCommand.name = Publish
serverView = ModeShape
showPublishedLocationsCommand.name = Show Published Locations
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml 2011-04-04 14:26:19 UTC (rev 30268)
@@ -199,17 +199,7 @@
</decorator>
</extension>
-<!-- Context Help -->
- <extension point="org.eclipse.help.contexts">
- <contexts file="docs/helpContexts.xml" />
- </extension>
-
-<!-- Help Table of Contents -->
- <extension point="org.eclipse.help.toc">
- <toc file="docs/toc.xml" primary="true" />
- </extension>
-
-<!-- Preference Page -->
+<!-- Main Preference Page -->
<extension
point="org.eclipse.ui.preferencePages">
<page
@@ -218,4 +208,24 @@
id="modeShapePreferencePage">
</page>
</extension>
+
+<!-- File Filters Preference Page -->
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ name="%fileFiltersPreferencePage"
+ category="modeShapePreferencePage"
+ class="org.jboss.tools.modeshape.rest.preferences.FileFiltersPreferencePage"
+ id="modeShapeFileFiltersPreferencePage">
+ </page>
+
+<!-- Preference Initializer -->
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences"
+ id="modeShapeDefaultPreferenceInitializer"
+ name="%preferenceInitializer">
+ <initializer class="org.jboss.tools.modeshape.rest.preferences.PreferenceInitializer" />
+ </extension>
+
</plugin>
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/log4j.properties
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/log4j.properties 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/log4j.properties 2011-04-04 14:26:19 UTC (rev 30268)
@@ -14,8 +14,6 @@
log4j.rootLogger=INFO, LOGFILE
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
-log4j.appender.LOGFILE.File=eclipse.log
log4j.appender.LOGFILE.Append=true
-log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Activator.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Activator.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Activator.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -13,6 +13,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
@@ -35,19 +36,11 @@
*/
public final class Activator extends AbstractUIPlugin implements IUiConstants {
- // ===========================================================================================================================
- // Class Fields
- // ===========================================================================================================================
-
/**
* The shared plugin instance.
*/
private static Activator plugin;
- // ===========================================================================================================================
- // Class Methods
- // ===========================================================================================================================
-
/**
* @return the shared instance or <code>null</code> if not constructed
*/
@@ -55,10 +48,6 @@
return plugin;
}
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* The image used when the requested image cannot be found.
*/
@@ -69,19 +58,15 @@
*/
private ServerManager serverMgr;
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
/**
* @param key the plugin relative path to the image (never <code>null</code>)
* @return the image or an image indicating the requested image could not be found
*/
private ImageDescriptor createImageDescriptor( String key ) {
- CheckArg.isNotNull(key, "key");
+ CheckArg.isNotNull(key, "key"); //$NON-NLS-1$
try {
- URL url = new URL(getBundle().getEntry("/").toString() + key);
+ URL url = new URL(getBundle().getEntry("/").toString() + key); //$NON-NLS-1$
return ImageDescriptor.createFromURL(url);
} catch (final MalformedURLException e) {
log(new Status(Severity.ERROR, RestClientI18n.missingImage.text(key), e));
@@ -106,7 +91,7 @@
* @see ISharedImages
*/
public Image getSharedImage( String imageId ) {
- CheckArg.isNotNull(imageId, "imageId");
+ CheckArg.isNotNull(imageId, "imageId"); //$NON-NLS-1$
Image result = PlatformUI.getWorkbench().getSharedImages().getImage(imageId);
return ((result == null) ? getMissingImage() : result);
}
@@ -117,7 +102,7 @@
* @see ISharedImages
*/
public ImageDescriptor getSharedImageDescriptor( String imageId ) {
- CheckArg.isNotNull(imageId, "imageId");
+ CheckArg.isNotNull(imageId, "imageId"); //$NON-NLS-1$
ImageDescriptor result = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imageId);
if (result != null) {
@@ -208,9 +193,10 @@
* @param status the status being logged (never <code>null</code>)
*/
public void log( Status status ) {
- CheckArg.isNotNull(status, "status");
+ CheckArg.isNotNull(status, "status"); //$NON-NLS-1$
IStatus eclipseStatus = new org.eclipse.core.runtime.Status(Utils.convertSeverity(status.getSeverity()),
- IUiConstants.PLUGIN_ID, status.getMessage(),
+ IUiConstants.PLUGIN_ID,
+ status.getMessage(),
status.getException());
getLog().log(eclipseStatus);
}
@@ -222,11 +208,10 @@
*/
@Override
public void start( BundleContext context ) throws Exception {
-// BasicConfigurator.configure(); // TODO how does logging get configured now
-
super.start(context);
plugin = this;
+ // restore server registry
this.serverMgr = new ServerManager(getStateLocation().toFile().getAbsolutePath());
Status status = this.serverMgr.restoreState();
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/IUiConstants.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/IUiConstants.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/IUiConstants.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -16,97 +16,134 @@
/**
* The Plug-in's identifier.
*/
- String PLUGIN_ID = "org.jboss.tools.modeshape.rest";
+ String PLUGIN_ID = "org.jboss.tools.modeshape.rest"; //$NON-NLS-1$
- String ICON_FOLDER = "icons/";
+ String ICON_FOLDER = "icons/"; //$NON-NLS-1$
//
// /icons/objects/
//
- String OBJECT_ICONS_FOLDER = ICON_FOLDER + "objects/";
+ String OBJECT_ICONS_FOLDER = ICON_FOLDER + "objects/"; //$NON-NLS-1$
- String CHECKMARK_IMAGE = OBJECT_ICONS_FOLDER + "checkmark.gif";
+ String CHECKMARK_IMAGE = OBJECT_ICONS_FOLDER + "checkmark.gif"; //$NON-NLS-1$
- String REPOSITORY_IMAGE = OBJECT_ICONS_FOLDER + "repository.gif";
+ String REPOSITORY_IMAGE = OBJECT_ICONS_FOLDER + "repository.gif"; //$NON-NLS-1$
- String SERVER_IMAGE = OBJECT_ICONS_FOLDER + "server.gif";
+ String SERVER_IMAGE = OBJECT_ICONS_FOLDER + "server.gif"; //$NON-NLS-1$
- String WORKSPACE_IMAGE = OBJECT_ICONS_FOLDER + "workspace.gif";
+ String WORKSPACE_IMAGE = OBJECT_ICONS_FOLDER + "workspace.gif"; //$NON-NLS-1$
//
// /icons/views/
//
- String VIEWS_ICON_FOLDER = ICON_FOLDER + "views/";
+ String VIEWS_ICON_FOLDER = ICON_FOLDER + "views/"; //$NON-NLS-1$
- String BLANK_IMAGE = VIEWS_ICON_FOLDER + "blank.gif";
+ String BLANK_IMAGE = VIEWS_ICON_FOLDER + "blank.gif"; //$NON-NLS-1$
- String COLLAPSE_ALL_IMAGE = VIEWS_ICON_FOLDER + "collapse_all.gif";
+ String COLLAPSE_ALL_IMAGE = VIEWS_ICON_FOLDER + "collapse_all.gif"; //$NON-NLS-1$
- String DELETE_SERVER_IMAGE = VIEWS_ICON_FOLDER + "delete_server.gif";
+ String DELETE_SERVER_IMAGE = VIEWS_ICON_FOLDER + "delete_server.gif"; //$NON-NLS-1$
- String ModeShape_IMAGE_16x = VIEWS_ICON_FOLDER + "modeShape_icon_16x.png";
+ String ModeShape_IMAGE_16x = VIEWS_ICON_FOLDER + "modeShape_icon_16x.png"; //$NON-NLS-1$
- String EDIT_SERVER_IMAGE = VIEWS_ICON_FOLDER + "edit_server.gif";
+ String EDIT_SERVER_IMAGE = VIEWS_ICON_FOLDER + "edit_server.gif"; //$NON-NLS-1$
- String ERROR_OVERLAY_IMAGE = VIEWS_ICON_FOLDER + "error_overlay.gif";
+ String ERROR_OVERLAY_IMAGE = VIEWS_ICON_FOLDER + "error_overlay.gif"; //$NON-NLS-1$
- String NEW_SERVER_IMAGE = VIEWS_ICON_FOLDER + "new_server.gif";
+ String NEW_SERVER_IMAGE = VIEWS_ICON_FOLDER + "new_server.gif"; //$NON-NLS-1$
- String PUBLISH_IMAGE = VIEWS_ICON_FOLDER + "publish.png";
+ String PUBLISH_IMAGE = VIEWS_ICON_FOLDER + "publish.png"; //$NON-NLS-1$
- String PUBLISHED_OVERLAY_IMAGE = VIEWS_ICON_FOLDER + "published_overlay.png";
+ String PUBLISHED_OVERLAY_IMAGE = VIEWS_ICON_FOLDER + "published_overlay.png"; //$NON-NLS-1$
- String REFRESH_IMAGE = VIEWS_ICON_FOLDER + "refresh.gif";
+ String REFRESH_IMAGE = VIEWS_ICON_FOLDER + "refresh.gif"; //$NON-NLS-1$
- String UNPUBLISH_IMAGE = VIEWS_ICON_FOLDER + "unpublish.png";
+ String UNPUBLISH_IMAGE = VIEWS_ICON_FOLDER + "unpublish.png"; //$NON-NLS-1$
//
// /icons/wizards/
//
- String WIZARD_ICONS_FOLDER = ICON_FOLDER + "wizards/";
+ String WIZARD_ICONS_FOLDER = ICON_FOLDER + "wizards/"; //$NON-NLS-1$
- String WIZARD_BANNER_IMAGE = WIZARD_ICONS_FOLDER + "wizard_banner.png";
+ String WIZARD_BANNER_IMAGE = WIZARD_ICONS_FOLDER + "wizard_banner.png"; //$NON-NLS-1$
//
- // Help Contexts
+ // jobs
//
- String HELP_CONTEXT_PREFIX = PLUGIN_ID + '.';
-
- String MESSAGE_CONSOLE_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "messageConsoleHelpContext";
-
- String PREFERENCE_PAGE_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "preferencesHelpContext";
-
- String PUBLISH_DIALOG_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "publishDialogHelpContext";
-
- String SERVER_DIALOG_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "serverDialogHelpContext";
-
- String SERVER_VIEW_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "serverViewHelpContext";
-
- //
- // Jobs
- //
-
/**
* The <code>Job</code> framework job family for the ModeShape publishing and unpublishing operations.
*/
- String PUBLISHING_JOB_FAMILY = "modeshape.publishing.job.family";
+ String PUBLISHING_JOB_FAMILY = "modeshape.publishing.job.family"; //$NON-NLS-1$
- //
- // Preferences
- //
-
/**
- * A preference for a list of file extensions that will not be part of publishing operations.
+ * Constants associated with help contexts.
*/
- String FILTERED_FILE_EXTENSIONS_PREFERENCE = "modeShape.preference.filteredFileExtensions";
+ interface HelpContexts {
+ String HELP_CONTEXT_PREFIX = IUiConstants.PLUGIN_ID + '.';
+
+ /**
+ * The message console help context.
+ */
+ String MESSAGE_CONSOLE_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "messageConsoleHelpContext"; //$NON-NLS-1$
+
+ /**
+ * The preference pages help context.
+ */
+ String PREFERENCE_PAGE_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "preferencesHelpContext"; //$NON-NLS-1$
+
+ /**
+ * The publish and unpublish dialog help context.
+ */
+ String PUBLISH_DIALOG_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "publishDialogHelpContext"; //$NON-NLS-1$
+
+ /**
+ * The server wizard and dialog page help context.
+ */
+ String SERVER_DIALOG_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "serverDialogHelpContext"; //$NON-NLS-1$
+
+ /**
+ * The server view help context.
+ */
+ String SERVER_VIEW_HELP_CONTEXT = HELP_CONTEXT_PREFIX + "serverViewHelpContext"; //$NON-NLS-1$
+
+ }
+
/**
- * A preference for a list of folder names whose contents will not be part of publishing operations.
+ * Constants associated with preferences.
*/
- String FILTERED_FOLDER_NAMES_PREFERENCE = "modeShape.preference.filteredFolderNames";
+ interface Preferences {
+ /**
+ * A preference that indicates if the ModeShape server should use resource versioning. If versioning is not used, only one
+ * copy of the resource will be persisted.
+ */
+ String ENABLE_RESOURCE_VERSIONING = "modeShape.preference.filteredFileExtensions"; //$NON-NLS-1$
+
+ /**
+ * A preference for a list of file extensions that will not be part of publishing operations.
+ */
+ String FILTERED_FILE_EXTENSIONS_PREFERENCE = "modeShape.preference.filteredFileExtensions"; //$NON-NLS-1$
+
+ /**
+ * A preference for a list of folder names whose contents will not be part of publishing operations.
+ */
+ String FILTERED_FOLDER_NAMES_PREFERENCE = "modeShape.preference.filteredFolderNames"; //$NON-NLS-1$
+
+ /**
+ * The file and folder preference page ID.
+ */
+ String FILTERS_PREFERENCE_PAGE_ID = "modeShapeFileFiltersPreferencePage"; //$NON-NLS-1$
+
+ /**
+ * The main ModeShape preference page ID.
+ */
+ String MAIN_PREFERENCE_PAGE_ID = "modeShapePreferencePage"; //$NON-NLS-1$
+
+ }
+
}
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -38,6 +38,12 @@
public static I18n errorRestoringServerRegistry;
public static I18n errorSavingServerRegistry;
+ public static I18n fileFiltersPreferencePageDescription;
+ public static I18n fileFiltersPreferencePageFilteredFileExtensionsLabel;
+ public static I18n fileFiltersPreferencePageFilteredFolderNamesLabel;
+ public static I18n fileFiltersPreferencePageMessage;
+ public static I18n fileFiltersPreferencePageTitle;
+
public static I18n missingImage;
public static I18n newFilteredFileExtensionDialogLabel;
@@ -45,13 +51,12 @@
public static I18n newFilteredFolderNameDialogLabel;
public static I18n newFilteredFolderNameDialogTitle;
+
+ public static I18n newItemDialogValueExists;
public static I18n newServerActionText;
public static I18n newServerActionToolTip;
- public static I18n prefUtilsPropertyFileNotFound;
- public static I18n prefUtilsPropertyNotFound;
-
public static I18n publishedLocationsDialogCopyUrlButton;
public static I18n publishedLocationsDialogCopyUrlButtonToolTip;
public static I18n publishedLocationsDialogFileUrlColumnHeader;
@@ -68,9 +73,13 @@
public static I18n publishingConsoleProblemCreatingHyperlinkMsg;
public static I18n publishingConsoleFilePathNotFoundMsg;
+ public static I18n preferenceDefaultScopeNotFound;
+ public static I18n preferenceFileNotFound;
+ public static I18n preferenceNotFound;
+
public static I18n preferencePageDescription;
- public static I18n preferencePageFilteredFileExtensionsLabel;
- public static I18n preferencePageFilteredFolderNamesLabel;
+ public static I18n preferencePageEnableVersioningEditor;
+ public static I18n preferencePageEnableVersioningEditorToolTip;
public static I18n preferencePageMessage;
public static I18n preferencePageTitle;
@@ -110,6 +119,7 @@
public static I18n publishPageNoAvailableWorkspacesStatusMsg;
public static I18n publishPageNoResourcesToPublishStatusMsg;
public static I18n publishPageNoResourcesToUnpublishStatusMsg;
+ public static I18n publishPageOpenPreferencePageLink;
public static I18n publishPagePublishOkStatusMsg;
public static I18n publishPagePublishResourcesLabel;
public static I18n publishPageRecurseCheckBox;
@@ -119,9 +129,12 @@
public static I18n publishPageRepositoryToolTip;
public static I18n publishPageServerLabel;
public static I18n publishPageServerToolTip;
+ public static I18n publishPageUnableToObtainWorkspaceAreas;
public static I18n publishPageUnpublishOkStatusMsg;
public static I18n publishPageUnpublishResourcesLabel;
public static I18n publishPageUnpublishTitle;
+ public static I18n publishPageVersionCheckBox;
+ public static I18n publishPageVersionCheckBoxToolTip;
public static I18n publishPageWorkspaceLabel;
public static I18n publishPageWorkspacePublishToolTip;
public static I18n publishPageWorkspaceUnpublishToolTip;
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-04-04 14:26:19 UTC (rev 30268)
@@ -29,6 +29,12 @@
errorDialogTitle = Error
errorRestoringServerRegistry = Error trying to restore the server registry from file "{0}"
errorSavingServerRegistry = Error trying to save the server registry to "{0}"
+
+fileFiltersPreferencePageDescription = Add or remove file extensions and folder names. Files with a matching file extension or files that are contained in a folder with a matching name will NOT be published to or unpublished from repositories.
+fileFiltersPreferencePageFilteredFileExtensionsLabel = Filtered File Extensions:
+fileFiltersPreferencePageFilteredFolderNamesLabel = Filtered Folder Names:
+fileFiltersPreferencePageMessage = File Filters
+fileFiltersPreferencePageTitle = File Filters
missingImage = The following image cannot be found "{0}"
@@ -38,11 +44,14 @@
newFilteredFolderNameDialogLabel = Folder name:
newFilteredFolderNameDialogTitle = New Filtered Folder Name
+newItemDialogValueExists = Value already exists
+
newServerActionText = New Server
newServerActionToolTip = Create a new server
-prefUtilsPropertyFileNotFound = The "{0}" property preference file is missing or could not be loaded. All property default values will be used.
-prefUtilsPropertyNotFound = The "{0}" property is missing. Default value of "{1}" will be used.
+preferenceDefaultScopeNotFound = The default scope for plugin "{0}" cannot be found.
+preferenceFileNotFound = The "{0}" preference defaults value file is missing or could not be loaded.
+preferenceNotFound = The "{0}" property is missing. Default value of "{1}" will be used.
publishedLocationsDialogCopyUrlButton = Copy URL
publishedLocationsDialogCopyUrlButtonToolTip = Copy to the clipboard the selected workspace URL where the file is published
@@ -60,11 +69,11 @@
publishingConsoleProblemCreatingHyperlinkMsg = Unexpected problem creating hyperlink in ModeShape Message Console view
publishingConsoleFilePathNotFoundMsg = A hyperlink could not be created in the ModeShape Message Console because the file path of "{0}" could not be found.
-preferencePageDescription = Add or remove file extensions and folder names. Files with a matching file extension or files that are contained in a folder with a matching name will NOT be published to or unpublished from repositories.
-preferencePageFilteredFileExtensionsLabel = Filtered File Extensions:
-preferencePageFilteredFolderNamesLabel = Filtered Folder Names:
+preferencePageDescription = General settings for ModeShape Tools:
+preferencePageEnableVersioningEditor = Enable resource versioning
+preferencePageEnableVersioningEditorToolTip = Inform ModeShape server to keep multiple versions of resources
preferencePageMessage = ModeShape
-preferencePageTitle = ModeShape Preferences
+preferencePageTitle = ModeShape
publishJobCanceled = Job {0} was canceled. See log for details.
publishJobDurationMsg = {0} hour(s), {1} minute(s), {2} second(s)
@@ -97,12 +106,13 @@
publishPageMissingServerStatusMsg = A server must be selected
publishPageMissingWorkspaceStatusMsg = A workspace must be selected
publishPageNewServerButton = New...
-publishPageNoAvailableRepositoriesStatusMsg = There are no repositories available on that server
+publishPageNoAvailableRepositoriesStatusMsg = There are no repositories available on that server, or a \nconnection to the server cannot be made.
publishPageNoAvailableServersStatusMsg = A server must be created first
-publishPageNoAvailableWorkspacesStatusMsg = There are no JCR workspaces available on that server and repository
-publishPageNoResourcesToPublishStatusMsg = There are no files that can be published
+publishPageNoAvailableWorkspacesStatusMsg = There are no JCR workspaces available on that server and repository, or a \nconnection to the server cannot be made.
+publishPageNoResourcesToPublishStatusMsg = There are no files that can be published (may be due to your file filter preference).
publishPageNoResourcesToUnpublishStatusMsg = There are no files that can be unpublished
-publishPagePublishOkStatusMsg = Choose the location of the JCR repository where your local files and folders will be published, and then click "Finish".
+publishPageOpenPreferencePageLink = ( change default in your <a>preferences</a> )
+publishPagePublishOkStatusMsg = Choose the location of the JCR repository where your local files \nand folders will be published, and then click "Finish."
publishPagePublishResourcesLabel = These files were selected and will be published:
publishPageRecurseCheckBox = Recurse folders and projects
publishPageRecurseCheckBoxToolTip = Add all files under folders recursively under selected projects and folders
@@ -111,6 +121,9 @@
publishPageRepositoryToolTip = The JCR repository where the JCR workspace is located
publishPageServerLabel = Server:
publishPageServerToolTip = The server where the JCR repository is located
+publishPageUnableToObtainWorkspaceAreas = Unable to obtain the workspace areas for workspace "{0}"
+publishPageVersionCheckBox = Version the published files
+publishPageVersionCheckBoxToolTip = The published files will be versioned on the ModeShape server.
publishPageUnpublishOkStatusMsg = Choose the location of the JCR repository where the files will be unpublished, and then click "Finish".
publishPageUnpublishResourcesLabel = These files were selected and will be unpublished:
publishPageUnpublishTitle = Unpublish the selected files
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -23,6 +23,7 @@
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+
import javax.jcr.nodetype.NodeType;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -31,11 +32,14 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
+
import org.modeshape.common.util.Base64;
import org.modeshape.common.util.CheckArg;
import org.modeshape.common.util.Logger;
+import org.modeshape.web.jcr.rest.client.IJcrConstants;
import org.modeshape.web.jcr.rest.client.IRestClient;
import org.modeshape.web.jcr.rest.client.Status;
import org.modeshape.web.jcr.rest.client.Status.Severity;
@@ -56,50 +60,42 @@
@ThreadSafe
public final class ServerManager implements IRestClient {
- // ===========================================================================================================================
- // Constants
- // ===========================================================================================================================
-
/**
* The tag used to persist a server's login password.
*/
- private static final String PASSWORD_TAG = "password";
+ private static final String PASSWORD_TAG = "password"; //$NON-NLS-1$
/**
* The file name used when persisting the server registry.
*/
- private static final String REGISTRY_FILE = "serverRegistry.xml";
+ private static final String REGISTRY_FILE = "serverRegistry.xml"; //$NON-NLS-1$
/**
* The name of the system property that is set when at least one server exists. This property is used by the menus extension
* that is responsible for showing the ModeShape context menu items.
*/
- public static final String SERVER_EXISTS_PROPERTY = "org.jboss.tools.modeshape.rest.serverExists";
+ public static final String SERVER_EXISTS_PROPERTY = "org.jboss.tools.modeshape.rest.serverExists"; //$NON-NLS-1$
/**
* The tag used when persisting a server.
*/
- private static final String SERVER_TAG = "server";
+ private static final String SERVER_TAG = "server"; //$NON-NLS-1$
/**
* The server collection tag used when persisting the server registry.
*/
- private static final String SERVERS_TAG = "servers";
+ private static final String SERVERS_TAG = "servers"; //$NON-NLS-1$
/**
* The tag used to persist a server's URL.
*/
- private static final String URL_TAG = "url";
+ private static final String URL_TAG = "url"; //$NON-NLS-1$
/**
* The tag used to persist a server's login user.
*/
- private static final String USER_TAG = "user";
+ private static final String USER_TAG = "user"; //$NON-NLS-1$
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* The listeners registered to receive {@link ServerRegistryEvent server registry events}.
*/
@@ -131,10 +127,6 @@
*/
private final ReadWriteLock serverLock = new ReentrantReadWriteLock();
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
/**
* @param stateLocationPath the directory where the {@link Server} registry} is persisted (may be <code>null</code> if
* persistence is not desired)
@@ -142,7 +134,7 @@
*/
public ServerManager( String stateLocationPath,
IRestClient restClient ) {
- CheckArg.isNotNull(restClient, "restClient");
+ CheckArg.isNotNull(restClient, "restClient"); //$NON-NLS-1$
this.servers = new ArrayList<Server>();
this.stateLocationPath = stateLocationPath;
@@ -160,10 +152,6 @@
this(stateLocationPath, new JsonRestClient());
}
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
/**
* Listeners already registered will not be added again. The new listener will receive events for all existing servers.
*
@@ -171,7 +159,7 @@
* @return <code>true</code> if listener was added
*/
public boolean addRegistryListener( IServerRegistryListener listener ) {
- CheckArg.isNotNull(listener, "listener");
+ CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
boolean result = this.listeners.addIfAbsent(listener);
// inform new listener of registered servers
@@ -189,7 +177,7 @@
* @return a status indicating if the server was added to the registry
*/
public Status addServer( PersistedServer server ) {
- CheckArg.isNotNull(server, "server");
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
return internalAddServer(server, true);
}
@@ -200,8 +188,8 @@
*/
public Server findServer( String url,
String user ) {
- CheckArg.isNotNull(url, "url");
- CheckArg.isNotNull(user, "user");
+ CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
+ CheckArg.isNotNull(user, "user"); //$NON-NLS-1$
for (Server server : getServers()) {
if (url.equals(server.getUrl()) && user.equals(server.getUser())) {
@@ -246,7 +234,7 @@
*/
@Override
public Collection<Repository> getRepositories( Server server ) throws Exception {
- CheckArg.isNotNull(server, "server");
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
try {
this.serverLock.readLock().lock();
@@ -277,6 +265,26 @@
}
/**
+ * @param workspace the workspace whose publishing areas are being requested
+ * @return the workspace areas (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the workspace areas
+ */
+ public WorkspaceArea[] getWorkspaceAreas( Workspace workspace ) throws Exception {
+ final String path = "jcr:path"; //$NON-NLS-1$
+ final String title = "jcr:title"; //$NON-NLS-1$
+ final String statement = "SELECT [" + path + "], " + '[' + title + ']' + " FROM [mode:publishArea]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ List<QueryRow> rows = query(workspace, IJcrConstants.JCR_SQL2, statement);
+ WorkspaceArea[] workspaceAreas = new WorkspaceArea[rows.size()];
+
+ for (int numRows = rows.size(), i = 0; i < numRows; ++i) {
+ QueryRow row = rows.get(i);
+ workspaceAreas[i] = new WorkspaceArea(workspace, (String)row.getValue(path), (String)row.getValue(title));
+ }
+
+ return workspaceAreas;
+ }
+
+ /**
* {@inheritDoc}
*
* @see org.modeshape.web.jcr.rest.client.IRestClient#getWorkspaces(org.modeshape.web.jcr.rest.client.domain.Repository)
@@ -285,7 +293,7 @@
*/
@Override
public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
- CheckArg.isNotNull(repository, "repository");
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
try {
this.serverLock.readLock().lock();
@@ -295,8 +303,7 @@
return Collections.unmodifiableCollection(new ArrayList<Workspace>(workspaces));
}
- // a repository's server must be registered in order to obtain it's
- // workspaces
+ // a repository's server must be registered in order to obtain it's workspaces
String msg = RestClientI18n.serverManagerUnregisteredServer.text(repository.getServer().getShortDescription());
throw new RuntimeException(msg);
} finally {
@@ -331,7 +338,7 @@
if (serverExists == null) {
// value of "true" is coded in the plugin.xml as well
- System.setProperty(SERVER_EXISTS_PROPERTY, "true");
+ System.setProperty(SERVER_EXISTS_PROPERTY, "true"); //$NON-NLS-1$
}
// let listeners know of new server
@@ -395,7 +402,7 @@
* @return <code>true</code> if the server has been registered
*/
public boolean isRegistered( Server server ) {
- CheckArg.isNotNull(server, "server");
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
try {
this.serverLock.readLock().lock();
@@ -471,7 +478,7 @@
* @see #isRegistered(Server)
*/
public Status ping( Server server ) {
- CheckArg.isNotNull(server, "server");
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
try {
this.delegate.getRepositories(server);
@@ -483,8 +490,6 @@
/**
* {@inheritDoc}
- * <p>
- * Only tries to unpublish if the workspace's {@link Server server} is registered.
*
* @see org.modeshape.web.jcr.rest.client.IRestClient#publish(org.modeshape.web.jcr.rest.client.domain.Workspace,
* java.lang.String, java.io.File)
@@ -494,14 +499,28 @@
public Status publish( Workspace workspace,
String path,
File file ) {
- CheckArg.isNotNull(workspace, "workspace");
- CheckArg.isNotNull(path, "path");
- CheckArg.isNotNull(file, "file");
+ return publish(workspace, path, file, false);
+ }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.modeshape.web.jcr.rest.client.IRestClient#publish(org.modeshape.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File, boolean)
+ */
+ @Override
+ public Status publish( Workspace workspace,
+ String path,
+ File file,
+ boolean version ) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+
Server server = workspace.getServer();
if (isRegistered(server)) {
- return this.delegate.publish(workspace, path, file);
+ return this.delegate.publish(workspace, path, file, version);
}
// server must be registered in order to publish
@@ -513,7 +532,7 @@
* @return <code>true</code> if listener was removed
*/
public boolean removeRegistryListener( IServerRegistryListener listener ) {
- CheckArg.isNotNull(listener, "listener");
+ CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
return this.listeners.remove(listener);
}
@@ -522,7 +541,7 @@
* @return a status indicating if the specified server was removed from the registry (never <code>null</code>)
*/
public Status removeServer( Server server ) {
- CheckArg.isNotNull(server, "server");
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
return internalRemoveServer(server, true);
}
@@ -551,7 +570,7 @@
Node userNode = attributeMap.getNamedItem(USER_TAG);
Node passwordNode = attributeMap.getNamedItem(PASSWORD_TAG);
String pswd = ((passwordNode == null) ? null : new String(Base64.decode(passwordNode.getNodeValue()),
- "UTF-8"));
+ "UTF-8")); //$NON-NLS-1$
// add server to registry
addServer(new PersistedServer(urlNode.getNodeValue(), userNode.getNodeValue(), pswd, (pswd != null)));
@@ -599,8 +618,8 @@
StreamResult resultXML = new StreamResult(new FileOutputStream(getStateFileName()));
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
transformer.transform(source, resultXML);
} catch (Exception e) {
return new Status(Severity.ERROR, RestClientI18n.errorSavingServerRegistry.text(getStateFileName()), e);
@@ -637,9 +656,9 @@
public Status unpublish( Workspace workspace,
String path,
File file ) {
- CheckArg.isNotNull(workspace, "workspace");
- CheckArg.isNotNull(path, "path");
- CheckArg.isNotNull(file, "file");
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
Server server = workspace.getServer();
@@ -660,8 +679,8 @@
*/
public Status updateServer( Server previousServerVersion,
Server newServerVersion ) {
- CheckArg.isNotNull(previousServerVersion, "previousServerVersion");
- CheckArg.isNotNull(newServerVersion, "newServerVersion");
+ CheckArg.isNotNull(previousServerVersion, "previousServerVersion"); //$NON-NLS-1$
+ CheckArg.isNotNull(newServerVersion, "newServerVersion"); //$NON-NLS-1$
Status status = null;
@@ -706,18 +725,15 @@
/**
* {@inheritDoc}
- * <p>
- * <strong>This method is unsupported and should not be called.</strong>
*
- * @throws UnsupportedOperationException if this method is called
* @see org.modeshape.web.jcr.rest.client.IRestClient#query(org.modeshape.web.jcr.rest.client.domain.Workspace,
* java.lang.String, java.lang.String)
*/
@Override
- public List<QueryRow> query( Workspace arg0,
- String arg1,
- String arg2 ) throws Exception {
- throw new UnsupportedOperationException();
+ public List<QueryRow> query( Workspace workspace,
+ String language,
+ String statement ) throws Exception {
+ return this.delegate.query(workspace, language, statement);
}
/**
@@ -730,11 +746,11 @@
* java.lang.String, java.lang.String, int, int)
*/
@Override
- public List<QueryRow> query( Workspace arg0,
- String arg1,
- String arg2,
- int arg3,
- int arg4 ) throws Exception {
+ public List<QueryRow> query( Workspace workspace,
+ String language,
+ String statement,
+ int offset,
+ int limit ) throws Exception {
throw new UnsupportedOperationException();
}
@@ -748,12 +764,12 @@
* java.lang.String, java.lang.String, int, int, java.util.Map)
*/
@Override
- public List<QueryRow> query( Workspace arg0,
- String arg1,
- String arg2,
- int arg3,
- int arg4,
- Map<String, String> arg5 ) throws Exception {
+ public List<QueryRow> query( Workspace workspace,
+ String language,
+ String statement,
+ int offset,
+ int limit,
+ Map<String, String> variables ) throws Exception {
throw new UnsupportedOperationException();
}
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/WorkspaceArea.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/WorkspaceArea.java (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/WorkspaceArea.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -0,0 +1,63 @@
+package org.jboss.tools.modeshape.rest;
+
+import org.modeshape.common.util.CheckArg;
+import org.modeshape.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>WorkspaceArea</code> represents a known area in a ModeShape repository where sequencing of resources occurs.
+ */
+public final class WorkspaceArea {
+
+ /**
+ * The path within the workspace where this area is found (never <code>null</code>).
+ */
+ private final String path;
+
+ /**
+ * An optional workspace area title (can be <code>null</code> or empty).
+ */
+ private final String title;
+
+ /**
+ * The workspace where this area is found (never <code>null</code>).
+ */
+ private final Workspace workspace;
+
+ /**
+ * @param workspace the workspace where this area is found (never <code>null</code>)
+ * @param path the workspace path where this area is found (never <code>null</code>)
+ * @param title the workspace area title (can be <code>null</code> or empty)
+ */
+ public WorkspaceArea( Workspace workspace,
+ String path,
+ String title ) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotEmpty(path, "path"); //$NON-NLS-1$
+
+ this.workspace = workspace;
+ this.path = path;
+ this.title = title;
+ }
+
+ /**
+ * @return path the workspace path where this area is found (never <code>null</code>)
+ */
+ public String getPath() {
+ return this.path;
+ }
+
+ /**
+ * @return title the workspace area title (can be <code>null</code> or empty)
+ */
+ public String getTitle() {
+ return this.title;
+ }
+
+ /**
+ * @return workspace the workspace where this area is found (never <code>null</code>)
+ */
+ public Workspace getWorkspace() {
+ return this.workspace;
+ }
+
+}
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/WorkspaceArea.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/PublishJob.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/PublishJob.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/PublishJob.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -13,10 +13,12 @@
import static org.jboss.tools.modeshape.rest.IUiConstants.PLUGIN_ID;
import static org.jboss.tools.modeshape.rest.IUiConstants.PUBLISHING_JOB_FAMILY;
+
import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -36,10 +38,6 @@
*/
public final class PublishJob extends Job {
- // ===========================================================================================================================
- // Constants
- // ===========================================================================================================================
-
/**
* The job type.
*/
@@ -60,10 +58,6 @@
*/
private static final AtomicInteger JOB_ID = new AtomicInteger();
- // ===========================================================================================================================
- // Class Methods
- // ===========================================================================================================================
-
/**
* @param type the job type (never <code>null</code>)
* @param jobId the job identifier
@@ -71,7 +65,7 @@
*/
private static String getJobName( Type type,
int jobId ) {
- CheckArg.isNotNull(type, "type");
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
if (Type.PUBLISH == type) {
return RestClientI18n.publishJobPublishName.text(jobId);
@@ -81,10 +75,6 @@
return RestClientI18n.publishJobUnpublishName.text(jobId);
}
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* The files being published or unpublished.
*/
@@ -101,6 +91,11 @@
private final Type type;
/**
+ * Indicates if published resources should be versioned on the ModeShape server.
+ */
+ private final boolean version;
+
+ /**
* The workspace to use when publishing or unpublishing.
*/
private final Workspace workspace;
@@ -110,32 +105,31 @@
*/
private final String workspaceArea;
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
/**
* @param type the job type (never <code>null</code>)
* @param files the files being published or unpublished (never <code>null</code>)
* @param workspace the workspace to use when publishing or unpublishing (never <code>null</code>)
* @param workspaceArea the path segment prepended to the file project path (maybe be <code>null</code> or empty)
+ * @param version <true> if published resources should be versioned
*/
public PublishJob( Type type,
List<IFile> files,
Workspace workspace,
- String workspaceArea ) {
+ String workspaceArea,
+ boolean version ) {
super(getJobName(type, JOB_ID.incrementAndGet()));
- CheckArg.isNotNull(files, "files");
- CheckArg.isNotNull(workspace, "workspace");
+ CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
this.type = type;
this.files = files;
this.workspace = workspace;
+ this.version = version;
this.jobId = JOB_ID.get();
// setup the workspace area and remove trailing separator if necessary
- String temp = ((workspaceArea == null) ? "" : workspaceArea);
+ String temp = ((workspaceArea == null) ? "" : workspaceArea); //$NON-NLS-1$
if (temp.endsWith(File.separator)) {
this.workspaceArea = temp.substring(0, (temp.length() - 1));
@@ -146,10 +140,6 @@
setUser(true); // allow user to run in background
}
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
/**
* {@inheritDoc}
*
@@ -227,7 +217,7 @@
Status status = null;
if (isPublishing()) {
- status = getServerManager().publish(this.workspace, path, file);
+ status = getServerManager().publish(this.workspace, path, file, this.version);
// set persistent property on resource indicating it has been published
if (!status.isError()) {
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/EclipseLogger.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/EclipseLogger.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/EclipseLogger.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -12,6 +12,7 @@
package org.jboss.tools.modeshape.rest.log;
import java.text.MessageFormat;
+
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
@@ -25,30 +26,14 @@
*/
public final class EclipseLogger implements Logger {
- // ===========================================================================================================================
- // Class Fields
- // ===========================================================================================================================
-
private static ILog LOGGER = Platform.getLog(Platform.getBundle(IUiConstants.PLUGIN_ID));
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
private String name;
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
EclipseLogger( String name ) {
this.name = name;
}
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
/**
* {@inheritDoc}
*
@@ -417,7 +402,7 @@
*/
@Override
public boolean isDebugEnabled() {
- return false;
+ return true;
}
/**
@@ -437,7 +422,7 @@
*/
@Override
public boolean isErrorEnabled() {
- return false;
+ return true;
}
/**
@@ -457,7 +442,7 @@
*/
@Override
public boolean isInfoEnabled() {
- return false;
+ return true;
}
/**
@@ -477,7 +462,7 @@
*/
@Override
public boolean isTraceEnabled() {
- return false;
+ return true;
}
/**
@@ -497,7 +482,7 @@
*/
@Override
public boolean isWarnEnabled() {
- return false;
+ return true;
}
/**
Deleted: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/StaticLoggerBinder.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/StaticLoggerBinder.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/log/StaticLoggerBinder.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -1,77 +0,0 @@
-/*
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.
- *
- * This software is made available by Red Hat, Inc. 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.
- *
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- */
-package org.jboss.tools.modeshape.rest.log;
-
-import org.slf4j.ILoggerFactory;
-import org.slf4j.spi.LoggerFactoryBinder;
-
-public final class StaticLoggerBinder implements LoggerFactoryBinder {
-
- // ===========================================================================================================================
- // Class Fields
- // ===========================================================================================================================
-
- /**
- * The class name of the logger factory.
- */
- private static final String LOGGER_FACTORY_CLASS_NAME = EclipseLoggerFactory.class.getName();
-
- /**
- * The unique instance of this class.
- */
- private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
-
- // ===========================================================================================================================
- // Class Methods
- // ===========================================================================================================================
-
- /**
- * @return the static instance of the logger
- */
- public static final StaticLoggerBinder getSingleton() {
- return SINGLETON;
- }
-
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
- /**
- * The logger factory used.
- */
- private final ILoggerFactory loggerFactory = new EclipseLoggerFactory();
-
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see org.slf4j.spi.LoggerFactoryBinder#getLoggerFactory()
- */
- @Override
- public ILoggerFactory getLoggerFactory() {
- return this.loggerFactory;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.slf4j.spi.LoggerFactoryBinder#getLoggerFactoryClassStr()
- */
- @Override
- public String getLoggerFactoryClassStr() {
- return LOGGER_FACTORY_CLASS_NAME;
- }
-
-}
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FileFiltersPreferencePage.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FileFiltersPreferencePage.java (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FileFiltersPreferencePage.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -0,0 +1,180 @@
+/*
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.
+ *
+ * This software is made available by Red Hat, Inc. 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.
+ *
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ */
+package org.jboss.tools.modeshape.rest.preferences;
+
+import static org.jboss.tools.modeshape.rest.IUiConstants.ModeShape_IMAGE_16x;
+import static org.jboss.tools.modeshape.rest.IUiConstants.HelpContexts.PREFERENCE_PAGE_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.fileFiltersPreferencePageDescription;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.fileFiltersPreferencePageMessage;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.fileFiltersPreferencePageTitle;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.jboss.tools.modeshape.rest.Activator;
+
+/**
+ * The <code>FileFiltersPreferencePage</code> is the UI for managing all file extension and folder name filter preferences.
+ */
+public final class FileFiltersPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ /**
+ * The editor used to manage the list of filtered file extensions.
+ */
+ private FilteredFileExtensionEditor extensionsEditor;
+
+ /**
+ * The editor used to manage the list of filtered folder names.
+ */
+ private FilteredFoldersEditor foldersEditor;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents( Composite parent ) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayout(new GridLayout(2, false));
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // create the filtered extensions editor
+ this.extensionsEditor = new FilteredFileExtensionEditor(panel);
+ this.extensionsEditor.setPreferenceStore(getPreferenceStore());
+ this.extensionsEditor.getListControl(panel).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // populate the extensions editor
+ this.extensionsEditor.load();
+
+ // create the filtered folders editor
+ this.foldersEditor = new FilteredFoldersEditor(panel);
+ this.foldersEditor.setPreferenceStore(getPreferenceStore());
+ this.foldersEditor.getListControl(panel).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // populate the folders editor
+ this.foldersEditor.load();
+
+ // register with the help system
+ IWorkbenchHelpSystem helpSystem = Activator.getDefault().getWorkbench().getHelpSystem();
+ helpSystem.setHelp(panel, PREFERENCE_PAGE_HELP_CONTEXT);
+
+ return panel;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#getDescription()
+ */
+ @Override
+ public String getDescription() {
+ return fileFiltersPreferencePageDescription.text();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#getImage()
+ */
+ @Override
+ public Image getImage() {
+ return Activator.getDefault().getImage(ModeShape_IMAGE_16x);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#getMessage()
+ */
+ @Override
+ public String getMessage() {
+ return fileFiltersPreferencePageMessage.text();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
+ */
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ return PrefUtils.getPreferenceStore();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#getTitle()
+ */
+ @Override
+ public String getTitle() {
+ return fileFiltersPreferencePageTitle.text();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
+ public void init( IWorkbench workbench ) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ @Override
+ protected void performDefaults() {
+ this.extensionsEditor.loadDefault();
+ this.foldersEditor.loadDefault();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ this.extensionsEditor.store();
+ this.foldersEditor.store();
+ return super.performOk();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ */
+ @Override
+ public void setVisible( boolean visible ) {
+ super.setVisible(visible);
+
+ if (visible) {
+ this.extensionsEditor.setFocus();
+ }
+ }
+
+}
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FileFiltersPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFileExtensionEditor.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFileExtensionEditor.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFileExtensionEditor.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -11,17 +11,11 @@
*/
package org.jboss.tools.modeshape.rest.preferences;
-import static org.jboss.tools.modeshape.rest.IUiConstants.FILTERED_FILE_EXTENSIONS_PREFERENCE;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.FILTERED_FILE_EXTENSIONS_PREFERENCE;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.fileFiltersPreferencePageFilteredFileExtensionsLabel;
import static org.jboss.tools.modeshape.rest.RestClientI18n.newFilteredFileExtensionDialogLabel;
import static org.jboss.tools.modeshape.rest.RestClientI18n.newFilteredFileExtensionDialogTitle;
-import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageFilteredFileExtensionsLabel;
-import static org.jboss.tools.modeshape.rest.preferences.PrefUtils.FILE_EXT_DELIMITER;
-import static org.jboss.tools.modeshape.rest.preferences.PrefUtils.FILE_EXT_INVALID_CHARS;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.TreeSet;
-import org.eclipse.jface.preference.ListEditor;
-import org.eclipse.jface.window.Window;
+
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.widgets.Composite;
@@ -30,33 +24,21 @@
/**
* The <code>FilteredFileExtensionEditor</code> is an editor for managing a set of filtered file extensions.
*/
-public final class FilteredFileExtensionEditor extends ListEditor implements VerifyListener {
-
- // =======================================================================================================================
- // Fields
- // =======================================================================================================================
-
+public final class FilteredFileExtensionEditor extends SortedListEditor implements VerifyListener {
+
/**
- * The current set of file extensions.
+ * The filter that removes resources, with specific file extensions, from publishing operations (never <code>null</code>).
*/
- private final Set<String> extensions;
+ private final PublishingFileFilter filter;
- // =======================================================================================================================
- // Constructors
- // =======================================================================================================================
-
/**
* @param parent the parent control
*/
public FilteredFileExtensionEditor( Composite parent ) {
- super(FILTERED_FILE_EXTENSIONS_PREFERENCE, preferencePageFilteredFileExtensionsLabel.text(), parent);
- this.extensions = new TreeSet<String>();
+ super(FILTERED_FILE_EXTENSIONS_PREFERENCE, fileFiltersPreferencePageFilteredFileExtensionsLabel.text(), parent);
+ this.filter = new PublishingFileFilter();
}
- // =======================================================================================================================
- // Methods
- // =======================================================================================================================
-
/**
* {@inheritDoc}
*
@@ -64,31 +46,27 @@
*/
@Override
protected String createList( String[] items ) {
- return Utils.combineTokens(items, FILE_EXT_DELIMITER);
+ return Utils.combineTokens(items, this.filter.getFileExtensionDelimiter());
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
+ * @see org.jboss.tools.modeshape.rest.preferences.SortedListEditor#getNewItemDialogLabel()
*/
@Override
- protected String getNewInputObject() {
- NewItemDialog dialog = new NewItemDialog(getShell(), newFilteredFileExtensionDialogTitle.text(),
- newFilteredFileExtensionDialogLabel.text(), this);
+ protected String getNewItemDialogLabel() {
+ return newFilteredFileExtensionDialogLabel.text();
+ }
- if (dialog.open() == Window.OK) {
- String extension = dialog.getNewItem();
-
- // add new extension
- if (extension != null) {
- this.extensions.add(extension);
- return extension;
- }
- }
-
- // user canceled dialog
- return null;
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.preferences.SortedListEditor#getNewItemDialogTitle()
+ */
+ @Override
+ protected String getNewItemDialogTitle() {
+ return newFilteredFileExtensionDialogTitle.text();
}
/**
@@ -98,12 +76,7 @@
*/
@Override
protected String[] parseString( String stringList ) {
- String[] values = Utils.getTokens(stringList, Character.toString(FILE_EXT_DELIMITER), true);
-
- this.extensions.clear();
- this.extensions.addAll(Arrays.asList(values));
-
- return values;
+ return Utils.getTokens(stringList, Character.toString(this.filter.getFileExtensionDelimiter()), true);
}
/**
@@ -113,7 +86,7 @@
*/
@Override
public void verifyText( VerifyEvent event ) {
- for (char c : FILE_EXT_INVALID_CHARS.toCharArray()) {
+ for (char c : this.filter.getFileExtensionInvalidCharacters().toCharArray()) {
if (c == event.character) {
event.doit = false;
break;
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFoldersEditor.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFoldersEditor.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/FilteredFoldersEditor.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -11,17 +11,11 @@
*/
package org.jboss.tools.modeshape.rest.preferences;
-import static org.jboss.tools.modeshape.rest.IUiConstants.FILTERED_FOLDER_NAMES_PREFERENCE;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.FILTERED_FOLDER_NAMES_PREFERENCE;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.fileFiltersPreferencePageFilteredFolderNamesLabel;
import static org.jboss.tools.modeshape.rest.RestClientI18n.newFilteredFolderNameDialogLabel;
import static org.jboss.tools.modeshape.rest.RestClientI18n.newFilteredFolderNameDialogTitle;
-import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageFilteredFolderNamesLabel;
-import static org.jboss.tools.modeshape.rest.preferences.PrefUtils.FOLDER_NAME_DELIMITER;
-import static org.jboss.tools.modeshape.rest.preferences.PrefUtils.FOLDER_NAME_INVALID_CHARS;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.TreeSet;
-import org.eclipse.jface.preference.ListEditor;
-import org.eclipse.jface.window.Window;
+
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.widgets.Composite;
@@ -30,33 +24,21 @@
/**
* The <code>FilteredFoldersEditor</code> is an editor for managing a set of folder names.
*/
-public final class FilteredFoldersEditor extends ListEditor implements VerifyListener {
+public final class FilteredFoldersEditor extends SortedListEditor implements VerifyListener {
- // =======================================================================================================================
- // Fields
- // =======================================================================================================================
-
/**
- * The current set of folder names.
+ * The filter that removes resources, contained in specific folders, from publishing operations (never <code>null</code>).
*/
- private final Set<String> folderNames;
+ private final PublishingFileFilter filter;
- // =======================================================================================================================
- // Constructors
- // =======================================================================================================================
-
/**
* @param parent the parent control
*/
public FilteredFoldersEditor( Composite parent ) {
- super(FILTERED_FOLDER_NAMES_PREFERENCE, preferencePageFilteredFolderNamesLabel.text(), parent);
- this.folderNames = new TreeSet<String>();
+ super(FILTERED_FOLDER_NAMES_PREFERENCE, fileFiltersPreferencePageFilteredFolderNamesLabel.text(), parent);
+ this.filter = new PublishingFileFilter();
}
- // =======================================================================================================================
- // Methods
- // =======================================================================================================================
-
/**
* {@inheritDoc}
*
@@ -64,31 +46,27 @@
*/
@Override
protected String createList( String[] items ) {
- return Utils.combineTokens(items, FOLDER_NAME_DELIMITER);
+ return Utils.combineTokens(items, this.filter.getFolderNameDelimiter());
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
+ * @see org.jboss.tools.modeshape.rest.preferences.SortedListEditor#getNewItemDialogLabel()
*/
@Override
- protected String getNewInputObject() {
- NewItemDialog dialog = new NewItemDialog(getShell(), newFilteredFolderNameDialogTitle.text(),
- newFilteredFolderNameDialogLabel.text(), this);
+ protected String getNewItemDialogLabel() {
+ return newFilteredFolderNameDialogLabel.text();
+ }
- if (dialog.open() == Window.OK) {
- String folderName = dialog.getNewItem();
-
- // add new folder name
- if (folderName != null) {
- this.folderNames.add(folderName);
- return folderName;
- }
- }
-
- // user canceled dialog
- return null;
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.preferences.SortedListEditor#getNewItemDialogTitle()
+ */
+ @Override
+ protected String getNewItemDialogTitle() {
+ return newFilteredFolderNameDialogTitle.text();
}
/**
@@ -98,12 +76,7 @@
*/
@Override
protected String[] parseString( String stringList ) {
- String[] values = Utils.getTokens(stringList, Character.toString(FOLDER_NAME_DELIMITER), true);
-
- this.folderNames.clear();
- this.folderNames.addAll(Arrays.asList(values));
-
- return values;
+ return Utils.getTokens(stringList, Character.toString(this.filter.getFolderNameDelimiter()), true);
}
/**
@@ -113,7 +86,7 @@
*/
@Override
public void verifyText( VerifyEvent event ) {
- for (char c : FOLDER_NAME_INVALID_CHARS.toCharArray()) {
+ for (char c : this.filter.getFolderNameInvalidCharacters().toCharArray()) {
if (c == event.character) {
event.doit = false;
break;
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/ModeShapePreferencePage.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/ModeShapePreferencePage.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/ModeShapePreferencePage.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -12,10 +12,15 @@
package org.jboss.tools.modeshape.rest.preferences;
import static org.jboss.tools.modeshape.rest.IUiConstants.ModeShape_IMAGE_16x;
-import static org.jboss.tools.modeshape.rest.IUiConstants.PREFERENCE_PAGE_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.IUiConstants.HelpContexts.PREFERENCE_PAGE_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.ENABLE_RESOURCE_VERSIONING;
import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageDescription;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageEnableVersioningEditor;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageEnableVersioningEditorToolTip;
import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageMessage;
import static org.jboss.tools.modeshape.rest.RestClientI18n.preferencePageTitle;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
@@ -30,29 +35,16 @@
import org.jboss.tools.modeshape.rest.Activator;
/**
- * The <code>ModeShapePreferencePage</code> is the UI for managing all ModeShape-related preferences.
+ * The <code>ModeShapePreferencePage</code> is the UI for managing general ModeShape-related preferences.
*/
public final class ModeShapePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
- * The editor used to manage the list of filtered file extensions.
+ * The editor used to enable and disable versioning in ModeShape.
*/
- private FilteredFileExtensionEditor extensionsEditor;
+ private BooleanFieldEditor enableVersioningEditor;
/**
- * The editor used to manage the list of filtered folder names.
- */
- private FilteredFoldersEditor foldersEditor;
-
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
- /**
* {@inheritDoc}
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
@@ -63,22 +55,16 @@
panel.setLayout(new GridLayout(2, false));
panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- // create the filtered extensions editor
- this.extensionsEditor = new FilteredFileExtensionEditor(panel);
- this.extensionsEditor.setPreferenceStore(getPreferenceStore());
- this.extensionsEditor.getListControl(panel).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ // create the field editor
+ this.enableVersioningEditor = new BooleanFieldEditor(ENABLE_RESOURCE_VERSIONING,
+ preferencePageEnableVersioningEditor.text(),
+ panel);
+ this.enableVersioningEditor.setPreferenceStore(getPreferenceStore());
+ this.enableVersioningEditor.getDescriptionControl(panel).setToolTipText(preferencePageEnableVersioningEditorToolTip.text());
- // populate the extensions editor
- this.extensionsEditor.load();
+ // populate the editor with current preference value
+ this.enableVersioningEditor.load();
- // create the filtered folders editor
- this.foldersEditor = new FilteredFoldersEditor(panel);
- this.foldersEditor.setPreferenceStore(getPreferenceStore());
- this.foldersEditor.getListControl(panel).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- // populate the folders editor
- this.foldersEditor.load();
-
// register with the help system
IWorkbenchHelpSystem helpSystem = Activator.getDefault().getWorkbench().getHelpSystem();
helpSystem.setHelp(panel, PREFERENCE_PAGE_HELP_CONTEXT);
@@ -153,8 +139,7 @@
*/
@Override
protected void performDefaults() {
- this.extensionsEditor.loadDefault();
- this.foldersEditor.loadDefault();
+ this.enableVersioningEditor.loadDefault();
super.performDefaults();
}
@@ -165,9 +150,22 @@
*/
@Override
public boolean performOk() {
- this.extensionsEditor.store();
- this.foldersEditor.store();
+ this.enableVersioningEditor.store();
return super.performOk();
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ */
+ @Override
+ public void setVisible( boolean visible ) {
+ super.setVisible(visible);
+
+ if (visible) {
+ this.enableVersioningEditor.setFocus();
+ }
+ }
}
Deleted: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/NewItemDialog.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/NewItemDialog.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/NewItemDialog.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -1,190 +0,0 @@
-/*
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.
- *
- * This software is made available by Red Hat, Inc. 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.
- *
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- */
-package org.jboss.tools.modeshape.rest.preferences;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.modeshape.common.util.CheckArg;
-
-/**
- * A <code>NewItemDialog</code> allows the user to enter a new file extension or new folder name that they wish to be filtered out
- * of all publishing operations.
- */
-public final class NewItemDialog extends Dialog implements ModifyListener {
-
- // =======================================================================================================================
- // Fields
- // =======================================================================================================================
-
- /**
- * The label describing the new item.
- */
- private final String label;
-
- /**
- * The contents of the new item text field.
- */
- private String newItem;
-
- /**
- * The dialog title.
- */
- private final String title;
-
- /**
- * The listener verifying input characters.
- */
- private final VerifyListener verifyListener;
-
- // =======================================================================================================================
- // Constructors
- // =======================================================================================================================
-
- /**
- * @param parentShell the parent shell (may be <code>null</code>)
- * @param title the localized dialog title (never <code>null</code>)
- * @param label the localized label (never <code>null</code>)
- * @param verifyListener a listener that validates input characters (may be <code>null</code>)
- */
- public NewItemDialog( Shell parentShell,
- String title,
- String label,
- VerifyListener verifyListener ) {
- super(parentShell);
-
- CheckArg.isNotNull(title, "title");
- CheckArg.isNotNull(label, "label");
-
- this.title = title;
- this.label = label;
- this.verifyListener = verifyListener;
-
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- // =======================================================================================================================
- // Methods
- // =======================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- @Override
- protected void configureShell( Shell newShell ) {
- newShell.setText(this.title);
- super.configureShell(newShell);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean)
- */
- @Override
- protected Button createButton( Composite parent,
- int id,
- String label,
- boolean defaultButton ) {
- Button button = super.createButton(parent, id, label, defaultButton);
-
- // disable OK button initially
- if (id == OK) {
- button.setEnabled(false);
- }
-
- return button;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createDialogArea( Composite parent ) {
- Composite panel = (Composite)super.createDialogArea(parent);
- Composite pnlEditor = new Composite(panel, SWT.NONE);
- pnlEditor.setLayout(new GridLayout(2, false));
- pnlEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label label = new Label(pnlEditor, SWT.NONE);
- label.setText(this.label);
-
- Text textField = new Text(pnlEditor, SWT.BORDER);
- textField.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
- textField.addModifyListener(this);
-
- // add listener if necessary
- if (this.verifyListener != null) {
- textField.addVerifyListener(this.verifyListener);
- }
-
- return panel;
- }
-
- /**
- * @return the new item or <code>null</code> if the dialog was canceled
- */
- public String getNewItem() {
- if (getReturnCode() == OK) {
- return this.newItem;
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
- */
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
-
- // resize shell to be twice the width needed for the title (without this the title maybe cropped)
- int width = (2 * convertWidthInCharsToPixels(this.title.length()));
- Rectangle rectangle = getShell().getBounds();
- getShell().setBounds(rectangle.x, rectangle.y, width, rectangle.height);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText( ModifyEvent event ) {
- // disable OK button if text field does not have any characters
- this.newItem = ((Text)event.widget).getText();
- boolean enable = (this.newItem.length() != 0);
-
- if (getButton(OK).getEnabled() != enable) {
- getButton(OK).setEnabled(enable);
- }
- }
-
-}
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PrefUtils.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PrefUtils.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PrefUtils.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -11,18 +11,10 @@
*/
package org.jboss.tools.modeshape.rest.preferences;
-import static org.jboss.tools.modeshape.rest.IUiConstants.FILTERED_FILE_EXTENSIONS_PREFERENCE;
-import static org.jboss.tools.modeshape.rest.IUiConstants.FILTERED_FOLDER_NAMES_PREFERENCE;
-import static org.jboss.tools.modeshape.rest.RestClientI18n.prefUtilsPropertyFileNotFound;
-import static org.jboss.tools.modeshape.rest.RestClientI18n.prefUtilsPropertyNotFound;
-import java.io.InputStream;
-import java.util.Properties;
import org.eclipse.jface.preference.IPreferenceStore;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.Utils;
import org.modeshape.common.util.CheckArg;
-import org.modeshape.web.jcr.rest.client.Status;
-import org.modeshape.web.jcr.rest.client.Status.Severity;
/**
* The <code>PrefUtils</code> class provides common utilities relating to preferences. This class assumes the Eclipse runtime
@@ -30,155 +22,7 @@
*/
public final class PrefUtils {
- // =======================================================================================================================
- // Constants
- // =======================================================================================================================
-
/**
- * The name of the properties file located in this package.
- */
- private static final String PREFERENCES_FILE = "prefs.properties";
-
- /**
- * The preference name for the delimiter that separates filtered file extensions when the preference value is stored.
- */
- private static final String FILE_EXT_DELIMITER_PREF_NAME = "fileExtension.delimiter";
-
- /**
- * The delimiter that separates filtered file extensions when the preference value is stored.
- */
- public static final char FILE_EXT_DELIMITER;
-
- /**
- * The preference name for characters that are <strong>NOT</strong> allowed to appear in a file extension.
- */
- private static final String FILE_EXT_INVALID_CHARS_PREF_NAME = "fileExtension.invalidChars";
-
- /**
- * The characters that are <strong>NOT</strong> allowed to appear in a file extension.
- */
- public static final String FILE_EXT_INVALID_CHARS;
-
- /**
- * The preference name for the delimiter that separates filtered folder names when the preference value is stored.
- */
- private static final String FOLDER_NAME_DELIMITER_PREF_NAME = "folderName.delimiter";
-
- /**
- * The delimiter that separates filtered folder names when the preference value is stored.
- */
- public static final char FOLDER_NAME_DELIMITER;
-
- /**
- * The preference name for characters that are <strong>NOT</strong> allowed to appear in a folder name.
- */
- private static final String FOLDER_NAME_INVALID_CHARS_PREF_NAME = "folderName.invalidChars";
-
- /**
- * The characters that are <strong>NOT</strong> allowed to appear in a folder name.
- */
- public static final String FOLDER_NAME_INVALID_CHARS;
-
- // =======================================================================================================================
- // Class Initializer
- // =======================================================================================================================
-
- static {
- InputStream is = null;
- Properties preferenceProperties = new Properties();
-
- // get the properties file
- try {
- is = PrefUtils.class.getResourceAsStream(PREFERENCES_FILE);
- } catch (Exception e) {
- Activator.getDefault().log(new Status(Severity.ERROR, e.getMessage(), e));
- }
-
- if (is == null) {
- Activator.getDefault().log(new Status(Severity.ERROR, prefUtilsPropertyFileNotFound.text(), null));
- } else {
- // load the properties file
- try {
- preferenceProperties.load(is);
- } catch (Exception e) {
- Activator.getDefault().log(new Status(Severity.ERROR, e.getMessage(), e));
- } finally {
- try {
- is.close();
- } catch (Exception e) {
- Activator.getDefault().log(new Status(Severity.ERROR, e.getMessage(), e));
- }
- }
- }
-
- // file extensions delimiter
- String temp = preferenceProperties.getProperty(FILE_EXT_DELIMITER_PREF_NAME);
-
- if ((temp != null) && (temp.length() > 0)) {
- FILE_EXT_DELIMITER = temp.charAt(0);
- } else {
- // make sure preference has a value
- FILE_EXT_DELIMITER = ',';
- Activator.getDefault().log(new Status(Severity.ERROR, prefUtilsPropertyNotFound.text(FILE_EXT_DELIMITER_PREF_NAME),
- null));
- }
-
- // file extension invalid characters
- temp = preferenceProperties.getProperty(FILE_EXT_INVALID_CHARS_PREF_NAME);
-
- if ((temp != null) && (temp.length() > 0)) {
- FILE_EXT_INVALID_CHARS = temp;
- } else {
- // make sure preference has a value
- FILE_EXT_INVALID_CHARS = "*?<>|/\\:;.";
- Activator.getDefault().log(new Status(Severity.ERROR,
- prefUtilsPropertyNotFound.text(FILE_EXT_INVALID_CHARS_PREF_NAME), null));
- }
-
- // folder names delimiter
- temp = preferenceProperties.getProperty(FOLDER_NAME_DELIMITER_PREF_NAME);
-
- if ((temp != null) && (temp.length() > 0)) {
- FOLDER_NAME_DELIMITER = temp.charAt(0);
- } else {
- // make sure preference has a value
- FOLDER_NAME_DELIMITER = ',';
- Activator.getDefault().log(new Status(Severity.ERROR,
- prefUtilsPropertyNotFound.text(FOLDER_NAME_DELIMITER_PREF_NAME), null));
- }
-
- // folder name invalid characters
- temp = preferenceProperties.getProperty(FOLDER_NAME_INVALID_CHARS_PREF_NAME);
-
- if ((temp != null) && (temp.length() > 0)) {
- FOLDER_NAME_INVALID_CHARS = temp;
- } else {
- // make sure preference has a value
- FOLDER_NAME_INVALID_CHARS = "*?<>|/\\:;";
- Activator.getDefault().log(new Status(Severity.ERROR,
- prefUtilsPropertyNotFound.text(FOLDER_NAME_INVALID_CHARS_PREF_NAME), null));
- }
- }
-
- // =======================================================================================================================
- // Class Methods
- // =======================================================================================================================
-
- /**
- * @return the file extensions being filtered out of publishing operations (never null)
- */
- public static String[] getFilteredFileExtensions() {
- return getListPropertyValue(FILTERED_FILE_EXTENSIONS_PREFERENCE, FILE_EXT_DELIMITER, true);
- }
-
- /**
- * @return the folder names being filtered out of publishing operations (never null)
- */
- public static String[] getFilteredFolderNames() {
- return getListPropertyValue(FILTERED_FOLDER_NAMES_PREFERENCE, FOLDER_NAME_DELIMITER, true);
- }
-
- /**
* @param propertyId the property name whose list values are being requested (never <code>null</code>)
* @param delimiter the character separating the items in the property value
* @param removeDuplicates a flag indicating if duplicate items should be removed
@@ -187,7 +31,7 @@
public static String[] getListPropertyValue( String propertyId,
char delimiter,
boolean removeDuplicates ) {
- CheckArg.isNotNull(propertyId, "propertyId");
+ CheckArg.isNotNull(propertyId, "propertyId"); //$NON-NLS-1$
return Utils.getTokens(getPreferenceStore().getString(propertyId), Character.toString(delimiter), removeDuplicates);
}
@@ -206,15 +50,11 @@
public static void setListPropertyValue( String propertyId,
String[] items,
char delimiter ) {
- CheckArg.isNotNull(propertyId, "propertyId");
- CheckArg.isNotNull(items, "items");
+ CheckArg.isNotNull(propertyId, "propertyId"); //$NON-NLS-1$
+ CheckArg.isNotNull(items, "items"); //$NON-NLS-1$
getPreferenceStore().setValue(propertyId, Utils.combineTokens(items, delimiter));
}
- // =======================================================================================================================
- // Constructors
- // =======================================================================================================================
-
/**
* Don't allow construction.
*/
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PreferenceInitializer.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PreferenceInitializer.java (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PreferenceInitializer.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+ *
+ * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+ */
+package org.jboss.tools.modeshape.rest.preferences;
+
+import static org.jboss.tools.modeshape.rest.IUiConstants.PLUGIN_ID;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.preferenceDefaultScopeNotFound;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.preferenceFileNotFound;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.jboss.tools.modeshape.rest.Activator;
+import org.modeshape.web.jcr.rest.client.Status;
+import org.modeshape.web.jcr.rest.client.Status.Severity;
+
+/**
+ *
+ */
+public final class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * The name of the preferences default values properties file located in this package.
+ */
+ private static final String PREFERENCES_FILE = "prefs.properties"; //$NON-NLS-1$
+
+ /**
+ * The default preference values.
+ */
+ private Properties preferenceDefaults;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences defaultValues = new DefaultScope().getNode(PLUGIN_ID);
+
+ if (defaultValues == null) {
+ // would only happen if PLUGIN_ID is wrong
+ Activator.getDefault().log(new Status(Severity.ERROR, preferenceDefaultScopeNotFound.text(PLUGIN_ID), null));
+ } else {
+ load();
+
+ // set default values
+ for (String property : this.preferenceDefaults.stringPropertyNames()) {
+ defaultValues.put(property, this.preferenceDefaults.getProperty(property));
+ }
+ }
+ }
+
+ private void load() {
+ this.preferenceDefaults = new Properties();
+ InputStream input = null;
+
+ try {
+ input = getClass().getResource(PREFERENCES_FILE).openStream();
+
+ if (input == null) {
+ Activator.getDefault().log(new Status(Severity.ERROR, preferenceFileNotFound.text(PREFERENCES_FILE), null));
+ } else {
+ this.preferenceDefaults.load(input);
+ }
+ } catch (IOException e) {
+ Activator.getDefault().log(new Status(Severity.ERROR, preferenceFileNotFound.text(PREFERENCES_FILE), null));
+ } finally {
+ try {
+ if (input != null) {
+ input.close();
+ }
+ } catch (IOException e) {
+ Activator.getDefault().log(new Status(Severity.ERROR, e.getMessage(), e));
+ }
+ }
+ }
+
+}
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PreferenceInitializer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PublishingFileFilter.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PublishingFileFilter.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/PublishingFileFilter.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -11,58 +11,56 @@
*/
package org.jboss.tools.modeshape.rest.preferences;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.FILTERED_FILE_EXTENSIONS_PREFERENCE;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.FILTERED_FOLDER_NAMES_PREFERENCE;
+import static org.jboss.tools.modeshape.rest.RestClientI18n.preferenceNotFound;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.jboss.tools.modeshape.rest.Activator;
import org.modeshape.common.util.CheckArg;
+import org.modeshape.web.jcr.rest.client.Status;
+import org.modeshape.web.jcr.rest.client.Status.Severity;
/**
* The <code>PublishingFileFilter</code> is a file filter that uses the preferences when filtering files.
*/
public final class PublishingFileFilter {
- // =======================================================================================================================
- // Fields
- // =======================================================================================================================
+ /**
+ * The preference name for the delimiter that separates filtered file extensions when the preference value is stored.
+ */
+ private static final String FILE_EXT_DELIMITER_PREF_NAME = "fileExtension.delimiter"; //$NON-NLS-1$
/**
- * The file extensions that should not be involved in publishing operations.
+ * The preference name for characters that are <strong>NOT</strong> allowed to appear in a file extension.
*/
- private final String[] filteredFileExtensions;
+ private static final String FILE_EXT_INVALID_CHARS_PREF_NAME = "fileExtension.invalidChars"; //$NON-NLS-1$
/**
- * The folder names that should not be involved in publishing operations.
+ * The preference name for the delimiter that separates filtered folder names when the preference value is stored.
*/
- private final String[] filteredFolderNames;
+ private static final String FOLDER_NAME_DELIMITER_PREF_NAME = "folderName.delimiter"; //$NON-NLS-1$
- // =======================================================================================================================
- // Constructors
- // =======================================================================================================================
-
/**
- * Construct a filter using the current preferences.
+ * The preference name for characters that are <strong>NOT</strong> allowed to appear in a folder name.
*/
- public PublishingFileFilter() {
- this.filteredFileExtensions = PrefUtils.getFilteredFileExtensions();
- this.filteredFolderNames = PrefUtils.getFilteredFolderNames();
- }
+ private static final String FOLDER_NAME_INVALID_CHARS_PREF_NAME = "folderName.invalidChars"; //$NON-NLS-1$
- // =======================================================================================================================
- // Methods
- // =======================================================================================================================
-
/**
* @param resource the resource being tested (never <code>null</code>)
* @return <code>true</code> if the resource should be included (i.e., it is not filtered out)
*/
public boolean accept( IResource resource ) {
- CheckArg.isNotNull(resource, "resource");
+ CheckArg.isNotNull(resource, "resource"); //$NON-NLS-1$
- if (resource instanceof IFolder) {
+ if ((resource instanceof IFolder) || (resource instanceof IProject)) {
String name = resource.getName();
// see if folder name has been filtered
- for (String filteredName : this.filteredFolderNames) {
+ for (String filteredName : getFilteredFolderNames()) {
if (filteredName.equals(name)) {
return false;
}
@@ -74,7 +72,7 @@
}
} else if (resource instanceof IFile) {
// see if file extension has been filtered
- for (String extension : this.filteredFileExtensions) {
+ for (String extension : getFilteredFileExtensions()) {
if (resource.getFullPath().toString().endsWith('.' + extension)) {
return false;
}
@@ -86,8 +84,98 @@
}
}
- // must be project
return true;
}
+ /**
+ * The delimiter that separates filtered file extensions when the preference value is stored.
+ *
+ * @return the file extension separator character
+ */
+ public char getFileExtensionDelimiter() {
+ String value = PrefUtils.getPreferenceStore().getDefaultString(FILE_EXT_DELIMITER_PREF_NAME);
+
+ if ((value != null) && (value.length() > 0)) {
+ return value.charAt(0);
+ }
+
+ // no value found so log and give a default value
+ value = ","; //$NON-NLS-1$
+ Activator.getDefault().log(new Status(Severity.ERROR, preferenceNotFound.text(FILE_EXT_DELIMITER_PREF_NAME, value), null));
+ return value.charAt(0);
+ }
+
+ /**
+ * The characters that are <strong>NOT</strong> allowed to appear in a file extension.
+ *
+ * @return the invalid file extension characters (never <code>null</code> or empty)
+ */
+ public String getFileExtensionInvalidCharacters() {
+ String value = PrefUtils.getPreferenceStore().getDefaultString(FILE_EXT_INVALID_CHARS_PREF_NAME);
+
+ if ((value != null) && (value.length() > 0)) {
+ return value;
+ }
+
+ // no value found so log and give a default value
+ value = "*?<>|/\\:;."; //$NON-NLS-1$
+ Activator.getDefault().log(new Status(Severity.ERROR,
+ preferenceNotFound.text(FILE_EXT_INVALID_CHARS_PREF_NAME, value),
+ null));
+ return value;
+ }
+
+ /**
+ * @return the file extensions being filtered out of publishing operations (never <code>null</code> but can be empty)
+ */
+ public String[] getFilteredFileExtensions() {
+ return PrefUtils.getListPropertyValue(FILTERED_FILE_EXTENSIONS_PREFERENCE, getFileExtensionDelimiter(), true);
+ }
+
+ /**
+ * @return the folder names being filtered out of publishing operations (never <code>null</code> but can be empty)
+ */
+ public String[] getFilteredFolderNames() {
+ return PrefUtils.getListPropertyValue(FILTERED_FOLDER_NAMES_PREFERENCE, getFolderNameDelimiter(), true);
+ }
+
+ /**
+ * The delimiter that separates filtered folder names when the preference value is stored.
+ *
+ * @return the folder name separator character
+ */
+ public char getFolderNameDelimiter() {
+ String value = PrefUtils.getPreferenceStore().getDefaultString(FOLDER_NAME_DELIMITER_PREF_NAME);
+
+ if ((value != null) && (value.length() > 0)) {
+ return value.charAt(0);
+ }
+
+ // no value found so log and give a default value
+ value = ","; //$NON-NLS-1$
+ Activator.getDefault()
+ .log(new Status(Severity.ERROR, preferenceNotFound.text(FOLDER_NAME_DELIMITER_PREF_NAME, value), null));
+ return value.charAt(0);
+ }
+
+ /**
+ * The characters that are <strong>NOT</strong> allowed to appear in a folder name (never <code>null</code> but can be empty).
+ *
+ * @return the invalid folder name characters (never <code>null</code> or empty)
+ */
+ public String getFolderNameInvalidCharacters() {
+ String value = PrefUtils.getPreferenceStore().getDefaultString(FOLDER_NAME_INVALID_CHARS_PREF_NAME);
+
+ if ((value != null) && (value.length() > 0)) {
+ return value;
+ }
+
+ // no value found so log and give a default value
+ value = "*?<>|/\\:;"; //$NON-NLS-1$
+ Activator.getDefault().log(new Status(Severity.ERROR,
+ preferenceNotFound.text(FOLDER_NAME_INVALID_CHARS_PREF_NAME, value),
+ null));
+ return value;
+ }
+
}
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/SortedListEditor.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/SortedListEditor.java (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/SortedListEditor.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -0,0 +1,383 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+ *
+ * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+ */
+package org.jboss.tools.modeshape.rest.preferences;
+
+import java.util.Arrays;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.jboss.tools.modeshape.rest.Activator;
+import org.jboss.tools.modeshape.rest.RestClientI18n;
+import org.modeshape.common.util.CheckArg;
+
+/**
+ * A preference list string value editor that sorts its entries each time a
+ * value is added.
+ */
+public abstract class SortedListEditor extends ListEditor {
+
+ /**
+ * Indicates if duplicate values are allowed.
+ */
+ private boolean allowDuplicates;
+
+ /**
+ * The listener verifying input characters.
+ */
+ private VerifyListener verifyListener;
+
+ /**
+ * Duplicate items are not allowed.
+ *
+ * @param name
+ * the name of the preference this field editor works on
+ * @param labelText
+ * the label text of the field editor
+ * @param parent
+ * the parent of the field editor's control
+ */
+ public SortedListEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ private void disableUpDownButtons() {
+ // disable up button
+ Button button = getUpButton();
+
+ if (button.getEnabled()) {
+ button.setEnabled(false);
+ }
+
+ // disable down button
+ button = getDownButton();
+
+ if (button.getEnabled()) {
+ button.setEnabled(false);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#getButtonBoxControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public Composite getButtonBoxControl(Composite parent) {
+ Composite buttonBox = super.getButtonBoxControl(parent);
+ getUpButton().setVisible(false);
+ getDownButton().setVisible(false);
+ disableUpDownButtons();
+ return buttonBox;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
+ */
+ @Override
+ protected final String getNewInputObject() {
+ NewItemDialog dialog = new NewItemDialog(getShell(), getNewItemDialogTitle(), getNewItemDialogLabel(),
+ this.verifyListener);
+ if (!this.allowDuplicates) {
+ dialog.setDisallowedValues(getList().getItems());
+ }
+
+ if (dialog.open() == Window.OK) {
+ String newItem = dialog.getNewItem();
+
+ // add new item, sort, and update list
+ if (newItem != null) {
+ getList().add(newItem);
+ String[] items = getList().getItems();
+ Arrays.sort(items);
+ getList().setItems(items);
+ }
+ }
+
+ // always return null because we have already updated the list
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#selectionChanged()
+ */
+ @Override
+ protected void selectionChanged() {
+ super.selectionChanged();
+ disableUpDownButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#setEnabled(boolean,
+ * org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void setEnabled(boolean enabled, Composite parent) {
+ super.setEnabled(enabled, parent);
+ disableUpDownButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ if ((getList() == null) || getList().getItemCount() == 0) {
+ getAddButton().setFocus();
+ } else {
+ super.setFocus();
+ }
+ }
+
+ /**
+ * @return the localized dialog title used when a new item is added (may not
+ * be <code>null</code>)
+ */
+ protected abstract String getNewItemDialogTitle();
+
+ /**
+ * @return the localized label on the new item dialog that identifies the
+ * type of the new item (may not be <code>null</code>)
+ */
+ protected abstract String getNewItemDialogLabel();
+
+ /**
+ * @param verifyListener
+ * a listener that verifies input from the user of a new item
+ * entry (can be <code>null</code>)
+ */
+ protected void setVerifyListener(VerifyListener verifyListener) {
+ this.verifyListener = verifyListener;
+ }
+
+ /**
+ * A <code>NewItemDialog</code> allows the user to enter a text value.
+ * Caller can optionally furnish a list of disallowed values.
+ */
+ class NewItemDialog extends Dialog implements ModifyListener {
+
+ /**
+ * The label describing the new item.
+ */
+ private final String label;
+
+ /**
+ * A list of disallowed values. If <code>null</code> any non-empty value
+ * is allowed.
+ */
+ private String[] disallowedValues;
+
+ /**
+ * A message for the user.
+ */
+ private CLabel lblMessage;
+
+ /**
+ * The contents of the new item text field.
+ */
+ private String newItem;
+
+ /**
+ * The dialog title.
+ */
+ private final String title;
+
+ /**
+ * The listener verifying input characters.
+ */
+ private final VerifyListener verifyListener;
+
+ /**
+ * @param parentShell
+ * the parent shell (may be <code>null</code>)
+ * @param title
+ * the localized dialog title (never <code>null</code>)
+ * @param label
+ * the localized label (never <code>null</code>)
+ * @param verifyListener
+ * a listener that validates input characters (may be
+ * <code>null</code>)
+ */
+ public NewItemDialog(Shell parentShell, String title, String label, VerifyListener verifyListener) {
+ super(parentShell);
+
+ CheckArg.isNotNull(title, "title"); //$NON-NLS-1$
+ CheckArg.isNotNull(label, "label"); //$NON-NLS-1$
+
+ this.title = title;
+ this.label = label;
+ this.verifyListener = verifyListener;
+
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ newShell.setText(this.title);
+ super.configureShell(newShell);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite,
+ * int, java.lang.String, boolean)
+ */
+ @Override
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ Button button = super.createButton(parent, id, label, defaultButton);
+
+ // disable OK button initially
+ if (id == OK) {
+ button.setEnabled(false);
+ }
+
+ return button;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite panel = (Composite) super.createDialogArea(parent);
+ Composite pnlEditor = new Composite(panel, SWT.NONE);
+ pnlEditor.setLayout(new GridLayout(2, false));
+ pnlEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Label label = new Label(pnlEditor, SWT.NONE);
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false));
+ label.setText(this.label);
+
+ Text textField = new Text(pnlEditor, SWT.BORDER);
+ textField.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ textField.addModifyListener(this);
+
+ // add listener if necessary
+ if (this.verifyListener != null) {
+ textField.addVerifyListener(this.verifyListener);
+ }
+
+ // add image and message labels
+ this.lblMessage = new CLabel(pnlEditor, SWT.NONE);
+ this.lblMessage.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ ((GridData) this.lblMessage.getLayoutData()).horizontalSpan = 2;
+
+ return panel;
+ }
+
+ /**
+ * @return the new item or <code>null</code> if the dialog was canceled
+ */
+ public String getNewItem() {
+ if (getReturnCode() == OK) {
+ return this.newItem;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
+ */
+ @Override
+ protected void initializeBounds() {
+ super.initializeBounds();
+
+ // resize shell to be twice the width needed for the title (without
+ // this the title maybe cropped)
+ int width = (2 * convertWidthInCharsToPixels(this.title.length()));
+ Rectangle rectangle = getShell().getBounds();
+ getShell().setBounds(rectangle.x, rectangle.y, width, rectangle.height);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText(ModifyEvent event) {
+ // clear message
+ this.lblMessage.setImage(null);
+ this.lblMessage.setText(""); //$NON-NLS-1$
+
+ // enable/disable OK button
+ this.newItem = ((Text) event.widget).getText();
+
+ // make sure at least one character entered
+ boolean enable = (this.newItem.length() != 0);
+
+ // make sure value is not a disallowed value
+ if (enable && (this.disallowedValues != null)) {
+ for (String disallowedValue : this.disallowedValues) {
+ if (this.newItem.equals(disallowedValue)) {
+ enable = false;
+ this.lblMessage
+ .setImage(Activator.getDefault().getSharedImage(ISharedImages.IMG_OBJS_INFO_TSK));
+ this.lblMessage.setText(RestClientI18n.newItemDialogValueExists.text());
+ break;
+ }
+ }
+ }
+
+ // set enabled state if different than current state
+ if (getButton(OK).getEnabled() != enable) {
+ getButton(OK).setEnabled(enable);
+ }
+ }
+
+ /**
+ * A list of values that are not allowed as an input.
+ *
+ * @param disallowedValues
+ * the list of values which are not allowed (can be
+ * <code>null</code> or empty)
+ */
+ public void setDisallowedValues(String[] disallowedValues) {
+ if ((disallowedValues == null) || (disallowedValues.length == 0)) {
+ this.disallowedValues = null;
+ } else {
+ this.disallowedValues = disallowedValues;
+ }
+ }
+
+ }
+}
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/SortedListEditor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/prefs.properties
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/prefs.properties 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/preferences/prefs.properties 2011-04-04 14:26:19 UTC (rev 30268)
@@ -10,11 +10,14 @@
# individual contributors.
#
-# This properties file is read in by PrefUtils. The delimiter values are used when the preference values are stored and the
-# valid character values are used by the editors when they validate user input.
+# This properties file is read in by PreferenceInitializer and contains preference default values. The delimiter values are used
+# when the preference values are stored and the valid character values are used by the field editors when they validate user input.
fileExtension.delimiter = ,
fileExtension.invalidChars = *?<>|/\:;.
folderName.delimiter = ,
-folderName.invalidChars = *?<>|/\:;
\ No newline at end of file
+folderName.invalidChars = *?<>|/\:;
+
+# indicates if ModeShape server should version resources
+enableVersioning = false
\ No newline at end of file
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -12,7 +12,8 @@
package org.jboss.tools.modeshape.rest.views;
import static org.jboss.tools.modeshape.rest.IUiConstants.COLLAPSE_ALL_IMAGE;
-import static org.jboss.tools.modeshape.rest.IUiConstants.SERVER_VIEW_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.IUiConstants.HelpContexts.SERVER_VIEW_HELP_CONTEXT;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
@@ -53,10 +54,6 @@
*/
public final class ServerView extends ViewPart implements IServerRegistryListener {
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* Collapses all tree nodes.
*/
@@ -89,10 +86,6 @@
private TreeViewer viewer;
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
private void constructActions() {
// the collapse all action is always enabled
this.collapseAllAction = new Action() {
@@ -325,7 +318,7 @@
* @param selection the current viewer selection (never <code>null</code>)
*/
private void updateStatusLine( IStructuredSelection selection ) {
- String msg = (selection.size() != 1 ? "" : ((IModeShapeObject)selection.getFirstElement()).getShortDescription());
+ String msg = (selection.size() != 1 ? "" : ((IModeShapeObject)selection.getFirstElement()).getShortDescription()); //$NON-NLS-1$
getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
}
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -11,13 +11,17 @@
*/
package org.jboss.tools.modeshape.rest.wizards;
-import static org.jboss.tools.modeshape.rest.IUiConstants.PUBLISH_DIALOG_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.IUiConstants.HelpContexts.PUBLISH_DIALOG_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.ENABLE_RESOURCE_VERSIONING;
+import static org.jboss.tools.modeshape.rest.IUiConstants.Preferences.MAIN_PREFERENCE_PAGE_ID;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -41,13 +45,16 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.IServerRegistryListener;
+import org.jboss.tools.modeshape.rest.IUiConstants;
import org.jboss.tools.modeshape.rest.RestClientI18n;
import org.jboss.tools.modeshape.rest.ServerManager;
import org.jboss.tools.modeshape.rest.ServerRegistryEvent;
+import org.jboss.tools.modeshape.rest.WorkspaceArea;
import org.jboss.tools.modeshape.rest.actions.NewServerAction;
import org.jboss.tools.modeshape.rest.jobs.PublishJob.Type;
import org.jboss.tools.modeshape.rest.preferences.PublishingFileFilter;
@@ -59,998 +66,1147 @@
import org.modeshape.web.jcr.rest.client.domain.Workspace;
/**
- * The <code>PublishPage</code> is a UI for publishing or unpublishing one or more files to a repository.
+ * The <code>PublishPage</code> is a UI for publishing or unpublishing one or
+ * more files to a repository.
*/
public final class PublishPage extends WizardPage implements IServerRegistryListener, ModifyListener {
- // ===========================================================================================================================
- // Constants
- // ===========================================================================================================================
+ /**
+ * The default repository workspace area where files are published.
+ */
+ private static final String DEFAULT_WORKSPACE_AREA = "/files"; //$NON-NLS-1$
- /**
- * The default repository workspace area where files are published.
- */
- private static final String DEFAULT_WORKSPACE_AREA = "/files";
+ /**
+ * The key in the wizard <code>IDialogSettings</code> for the recurse flag.
+ */
+ private static final String RECURSE_KEY = "recurse"; //$NON-NLS-1$
- /**
- * The key in the wizard <code>IDialogSettings</code> for the recurse flag.
- */
- private static final String RECURSE_KEY = "recurse";
+ /**
+ * The key in the wizard <code>IDialogSettings</code> for the workspace area
+ * path segment.
+ */
+ private static final String WORKSPACE_AREA_KEY = "workspaceArea"; //$NON-NLS-1$
- /**
- * The key in the wizard <code>IDialogSettings</code> for the workspace area path segment.
- */
- private static final String WORKSPACE_AREA_KEY = "workspaceArea";
+ /**
+ * Indicates if the file filter should be used.
+ */
+ private static boolean filterFiles = true;
- // ===========================================================================================================================
- // Class Fields
- // ===========================================================================================================================
+ /**
+ * @param container
+ * the project or folder whose files are being requested
+ * @param recurse
+ * the flag indicating if child containers should be traversed
+ * @param filter
+ * the file filter or <code>null</code> if not used
+ * @return the list of files contained in the specified container (never
+ * <code>null</code>)
+ * @throws CoreException
+ * if there is a problem finding the files
+ */
+ private static List<IFile> findFiles(IContainer container, boolean recurse, PublishingFileFilter filter)
+ throws CoreException {
+ List<IFile> result = new ArrayList<IFile>();
- /**
- * Indicates if the file filter should be used.
- */
- private static boolean filterFiles = true;
+ if (((container instanceof IProject) && !((IProject) container).isOpen())
+ || ((filter != null) && !filter.accept(container))) {
+ return result;
+ }
- // ===========================================================================================================================
- // Class Methods
- // ===========================================================================================================================
+ // process container members
+ for (IResource member : container.members()) {
+ if (recurse && (member instanceof IContainer)) {
+ // don't select closed projects
+ if ((member instanceof IProject) && !((IProject) member).isOpen()) {
+ continue;
+ }
- /**
- * @param container the project or folder whose files are being requested
- * @param recurse the flag indicating if child containers should be traversed
- * @param filter the file filter or <code>null</code> if not used
- * @return the list of files contained in the specified container (never <code>null</code>)
- * @throws CoreException if there is a problem finding the files
- */
- private static List<IFile> findFiles( IContainer container,
- boolean recurse,
- PublishingFileFilter filter ) throws CoreException {
- List<IFile> result = new ArrayList<IFile>();
+ result.addAll(findFiles((IContainer) member, recurse, filter));
+ } else if ((member instanceof IFile) && ((IFile) member).getLocation().toFile().exists()) {
+ if ((filter == null) || filter.accept(member)) {
+ result.add((IFile) member);
+ }
+ }
+ }
- for (IResource member : container.members()) {
- if (recurse && (member instanceof IContainer)) {
- // don't select closed projects
- if ((member instanceof IProject) && !((IProject)member).isOpen()) {
- continue;
- }
+ return result;
+ }
- result.addAll(findFiles((IContainer)member, recurse, filter));
- } else if ((member instanceof IFile) && ((IFile)member).getLocation().toFile().exists()) {
- if ((filter == null) || filter.accept(member)) {
- result.add((IFile)member);
- }
- }
- }
+ /**
+ * Processes the specified list of files and for (1) each file found adds it
+ * to the result and (2) for each project or folder adds all contained
+ * files. For projects and folders processing will be recursive based on
+ * saved wizard settings.
+ *
+ * @param resources
+ * the resources being processed (never <code>null</code>)
+ * @param recurse
+ * the flag indicating if child containers should be traversed
+ * @param filter
+ * the file filter or <code>null</code> if not used
+ * @return the files being published or unpublished (never <code>null</code>
+ * )
+ * @throws CoreException
+ * if there is a problem processing the resources
+ */
+ private static List<IFile> processResources(List<IResource> resources, boolean recurse, PublishingFileFilter filter)
+ throws CoreException {
+ assert (resources != null);
+ List<IFile> result = new ArrayList<IFile>();
- return result;
- }
+ // Project Map - the outer map. Its keys are IProjects and its values
+ // are a Parent Map
+ // Parent Map - the inner map. Its keys are IContainers (IProject,
+ // IFolder) and its values are a list of files
+ Map<IProject, Map<IContainer, List<IFile>>> projectMap = new HashMap<IProject, Map<IContainer, List<IFile>>>();
- /**
- * Processes the specified list of files and for (1) each file found adds it to the result and (2) for each project or folder
- * adds all contained files. For projects and folders processing will be recursive based on saved wizard settings.
- *
- * @param resources the resources being processed (never <code>null</code>)
- * @param recurse the flag indicating if child containers should be traversed
- * @param filter the file filter or <code>null</code> if not used
- * @return the files being published or unpublished (never <code>null</code>)
- * @throws CoreException if there is a problem processing the resources
- */
- private static List<IFile> processResources( List<IResource> resources,
- boolean recurse,
- PublishingFileFilter filter ) throws CoreException {
- assert (resources != null);
- List<IFile> result = new ArrayList<IFile>();
+ // Step 1: Process resources
+ // - For each file make sure there is a project entry and parent entry
+ // then add the file to the Parent Map.
+ // - For each folder make sure there is a project entry then add folder
+ // entry.
+ // - For each project make sure there is a project entry.
+ //
+ // Step 2: Process maps
+ // - In the Project Map, when the recurse flag is set, entries for
+ // projects that have a null value (parent map) will be
+ // traversed finding all child files and them to results.
+ // - In the internal parent map, when the recurse flag is set, entries
+ // for parents that have a null value (child
+ // collection) will be traversed finding all child files and add them to
+ // results.
+ //
+ // Step 3: Add files from Step 1 to results
- // Project Map - the outer map. Its keys are IProjects and its values are a Parent Map
- // Parent Map - the inner map. Its keys are IContainers (IProject, IFolder) and its values are a list of files
- Map<IProject, Map<IContainer, List<IFile>>> projectMap = new HashMap<IProject, Map<IContainer, List<IFile>>>();
+ // Step 1 (see above for processing description)
+ for (IResource resource : resources) {
+ IFile file = null;
+ IProject project = null;
+ List<IFile> files = null;
+ Map<IContainer, List<IFile>> parentMap = null;
- // Step 1: Process resources
- // - For each file make sure there is a project entry and parent entry then add the file to the Parent Map.
- // - For each folder make sure there is a project entry then add folder entry.
- // - For each project make sure there is a project entry.
- //
- // Step 2: Process maps
- // - In the Project Map, when the recurse flag is set, entries for projects that have a null value (parent map) will be
- // traversed finding all child files and them to results.
- // - In the internal parent map, when the recurse flag is set, entries for parents that have a null value (child
- // collection) will be traversed finding all child files and add them to results.
- //
- // Step 3: Add files from Step 1 to results
+ // see if resource is filtered
+ if ((filter != null) && !filter.accept(resource)) {
+ continue;
+ }
- // Step 1 (see above for processing description)
- for (IResource resource : resources) {
- IFile file = null;
- IProject project = null;
- List<IFile> files = null;
- Map<IContainer, List<IFile>> parentMap = null;
+ if (resource instanceof IFile) {
+ IContainer parent = null; // project or folder
+ file = (IFile) resource;
+ parent = file.getParent();
+ project = file.getProject();
- // see if resource is filtered
- if ((filter != null) && !filter.accept(resource)) {
- continue;
- }
+ // make sure there is a project entry
+ if (!projectMap.containsKey(project)) {
+ projectMap.put(project, null);
+ }
- if (resource instanceof IFile) {
- IContainer parent = null; // project or folder
- file = (IFile)resource;
- parent = file.getParent();
- project = file.getProject();
+ parentMap = projectMap.get(project);
- // make sure there is a project entry
- if (!projectMap.containsKey(project)) {
- projectMap.put(project, null);
- }
+ // make sure there is a parent entry
+ if (parentMap == null) {
+ parentMap = new HashMap<IContainer, List<IFile>>();
+ projectMap.put(project, parentMap);
+ }
- parentMap = projectMap.get(project);
+ files = parentMap.get(parent);
- // make sure there is a parent entry
- if (parentMap == null) {
- parentMap = new HashMap<IContainer, List<IFile>>();
- projectMap.put(project, parentMap);
- }
+ // make sure there is a files collection
+ if (files == null) {
+ files = new ArrayList<IFile>();
+ parentMap.put(parent, files);
+ }
- files = parentMap.get(parent);
+ // add file
+ files.add(file);
+ } else if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
+ project = folder.getProject();
- // make sure there is a files collection
- if (files == null) {
- files = new ArrayList<IFile>();
- parentMap.put(parent, files);
- }
+ // make sure there is a project entry
+ if (!projectMap.containsKey(project)) {
+ projectMap.put(project, null);
+ }
- // add file
- files.add(file);
- } else if (resource instanceof IFolder) {
- IFolder folder = (IFolder)resource;
- project = folder.getProject();
+ parentMap = projectMap.get(project);
- // make sure there is a project entry
- if (!projectMap.containsKey(project)) {
- projectMap.put(project, null);
- }
+ // make sure there is a folder entry
+ if (parentMap == null) {
+ parentMap = new HashMap<IContainer, List<IFile>>();
+ projectMap.put(project, parentMap);
+ }
- parentMap = projectMap.get(project);
+ // add folder only if not already there
+ if (!parentMap.containsKey(folder)) {
+ parentMap.put(folder, null);
+ }
+ } else if (resource instanceof IProject) {
+ project = (IProject) resource;
- // make sure there is a folder entry
- if (parentMap == null) {
- parentMap = new HashMap<IContainer, List<IFile>>();
- projectMap.put(project, parentMap);
- }
+ // if map does not have entry create one
+ if (!projectMap.containsKey(project)) {
+ projectMap.put(project, null);
+ }
+ }
+ }
- // add folder only if not already there
- if (!parentMap.containsKey(folder)) {
- parentMap.put(folder, null);
- }
- } else if (resource instanceof IProject) {
- project = (IProject)resource;
+ // Step 2 (see above for processing description)
+ // Process projects that have nothing under them selected
+ for (IProject project : projectMap.keySet()) {
+ Map<IContainer, List<IFile>> parentMap = projectMap.get(project);
- // if map does not have entry create one
- if (!projectMap.containsKey(project)) {
- projectMap.put(project, null);
- }
- }
- }
+ if (parentMap == null) {
+ result.addAll(findFiles(project, recurse, filter));
+ } else {
+ // process folders with no folder entries
+ for (IContainer folder : parentMap.keySet()) {
+ List<IFile> files = parentMap.get(folder);
- // Step 2 (see above for processing description)
- // Process projects that have nothing under them selected
- for (IProject project : projectMap.keySet()) {
- Map<IContainer, List<IFile>> parentMap = projectMap.get(project);
+ if (files == null) {
+ result.addAll(findFiles(folder, recurse, filter));
+ }
+ }
+ }
+ }
- if (parentMap == null) {
- result.addAll(findFiles(project, recurse, filter));
- } else {
- // process folders with no folder entries
- for (IContainer folder : parentMap.keySet()) {
- List<IFile> files = parentMap.get(folder);
+ // Step 3 (see above for processing description)
+ for (IProject project : projectMap.keySet()) {
+ Map<IContainer, List<IFile>> parentMap = projectMap.get(project);
- if (files == null) {
- result.addAll(findFiles(folder, recurse, filter));
- }
- }
- }
- }
+ if (parentMap != null) {
+ for (Entry<IContainer, List<IFile>> entry : parentMap.entrySet()) {
+ if (entry.getValue() != null) {
+ result.addAll(entry.getValue());
+ }
+ }
+ }
+ }
- // Step 3 (see above for processing description)
- for (IProject project : projectMap.keySet()) {
- Map<IContainer, List<IFile>> parentMap = projectMap.get(project);
+ return result;
+ }
- if (parentMap != null) {
- for (Entry<IContainer, List<IFile>> entry : parentMap.entrySet()) {
- if (entry.getValue() != null) {
- result.addAll(entry.getValue());
- }
- }
- }
- }
+ /**
+ * The repository chooser control.
+ */
+ private Combo cbxRepository;
- return result;
- }
+ /**
+ * The server chooser control.
+ */
+ private Combo cbxServer;
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
+ /**
+ * The workspace chooser control.
+ */
+ private Combo cbxWorkspace;
- /**
- * The repository chooser control.
- */
- private Combo cbxRepository;
+ /**
+ * The workspace area chooser control.
+ */
+ private Combo cbxWorkspaceAreas;
- /**
- * The server chooser control.
- */
- private Combo cbxServer;
+ /**
+ * The files being published or unpublished (never <code>null</code>).
+ */
+ private List<IFile> files;
- /**
- * The workspace chooser control.
- */
- private Combo cbxWorkspace;
+ /**
+ * The filter used to determine if a file should be included in publishing
+ * operations (may be <code>null</code>).
+ */
+ private PublishingFileFilter filter;
- /**
- * The files being published or unpublished (never <code>null</code>).
- */
- private List<IFile> files;
+ /**
+ * The control containing all the files being published or unpublished.
+ */
+ private org.eclipse.swt.widgets.List lstResources;
- /**
- * The filter used to determine if a file should be included in publishing operations (may be <code>null</code>).
- */
- private PublishingFileFilter filter;
+ /**
+ * Indicates if resources should be found recursively.
+ */
+ private boolean recurse = true;
- /**
- * The control containing all the files being published or unpublished.
- */
- private org.eclipse.swt.widgets.List lstResources;
+ /**
+ * A collection of repositories for the selected server (never
+ * <code>null</code>).
+ */
+ private List<Repository> repositories;
- /**
- * Indicates if resources should be found recursively.
- */
- private boolean recurse = true;
+ /**
+ * The repository where the workspace is located.
+ */
+ private Repository repository;
- /**
- * A collection of repositories for the selected server (never <code>null</code>).
- */
- private List<Repository> repositories;
+ /**
+ * The collection of resources selected by the user to be published or
+ * unpublished.
+ */
+ private final List<IResource> resources;
- /**
- * The repository where the workspace is located.
- */
- private Repository repository;
+ /**
+ * The server where the repository is located.
+ */
+ private Server server;
- /**
- * The collection of resources selected by the user to be published or unpublished.
- */
- private final List<IResource> resources;
+ /**
+ * A collection of servers from the server registry (never <code>null</code>
+ * ).
+ */
+ private List<Server> servers;
- /**
- * The server where the repository is located.
- */
- private Server server;
+ /**
+ * The current validation status.
+ */
+ private Status status;
- /**
- * A collection of servers from the server registry (never <code>null</code>).
- */
- private List<Server> servers;
+ /**
+ * Indicates if publishing or unpublishing is being done.
+ */
+ private final Type type;
- /**
- * The current validation status.
- */
- private Status status;
+ /**
+ * Indicates if versioning of published resources should be done.
+ */
+ private boolean versioning = true;
- /**
- * Indicates if publishing or unpublishing is being done.
- */
- private final Type type;
+ /**
+ * The workspace where the resources are being published/unpublished (may be
+ * <code>null</code>).
+ */
+ private Workspace workspace;
- /**
- * The workspace where the resources are being published/unpublished (may be <code>null</code>).
- */
- private Workspace workspace;
+ /**
+ * The path segment prepended to the resource project path.
+ */
+ private String workspaceArea;
- /**
- * The path segment prepended to the resource project path.
- */
- private String workspaceArea;
+ /**
+ * A collection of workspaces for the selected server repository (never
+ * <code>null</code>).
+ */
+ private List<Workspace> workspaces;
- /**
- * A collection of workspaces for the selected server repository (never <code>null</code>).
- */
- private List<Workspace> workspaces;
+ /**
+ * @param type
+ * indicates if publishing or unpublishing is being done
+ * @param resources
+ * the resources being published or unpublished (never
+ * <code>null</code>)
+ * @throws CoreException
+ * if there is a problem processing the input resources
+ */
+ public PublishPage(Type type, List<IResource> resources) throws CoreException {
+ super(PublishPage.class.getSimpleName());
+ CheckArg.isNotNull(resources, "resources"); //$NON-NLS-1$
+ setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text()
+ : RestClientI18n.publishPageUnpublishTitle.text());
+ setPageComplete(false);
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
+ this.type = type;
+ this.resources = resources;
- /**
- * @param type indicates if publishing or unpublishing is being done
- * @param resources the resources being published or unpublished (never <code>null</code>)
- * @throws CoreException if there is a problem processing the input resources
- */
- public PublishPage( Type type,
- List<IResource> resources ) throws CoreException {
- super(PublishPage.class.getSimpleName());
- CheckArg.isNotNull(resources, "resources");
- setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text()
- : RestClientI18n.publishPageUnpublishTitle.text());
- setPageComplete(false);
+ // filter should not be cached as preferences may change
+ this.filter = (filterFiles ? new PublishingFileFilter() : null);
+ }
- this.type = type;
- this.resources = resources;
+ private void constructLocationPanel(Composite parent) {
+ Group pnl = new Group(parent, SWT.NONE);
+ pnl.setText(RestClientI18n.publishPageLocationGroupTitle.text());
+ pnl.setLayout(new GridLayout(2, false));
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- // filter should not be cached as preferences may change
- this.filter = (filterFiles ? new PublishingFileFilter() : null);
- }
+ // row 1: label combobox button
+ // row 2: label combobox
+ // row 3: label combobox
+ // row 4: label textbox
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
+ { // row 1: server row
+ Composite pnlServer = new Composite(pnl, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ pnlServer.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gd.horizontalSpan = 2;
+ pnlServer.setLayoutData(gd);
- private void constructLocationPanel( Composite parent ) {
- Group pnl = new Group(parent, SWT.NONE);
- pnl.setText(RestClientI18n.publishPageLocationGroupTitle.text());
- pnl.setLayout(new GridLayout(2, false));
- pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ Label lblServer = new Label(pnlServer, SWT.LEFT);
+ lblServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblServer.setText(RestClientI18n.publishPageServerLabel.text());
- // row 1: label combobox button
- // row 2: label combobox
- // row 3: label combobox
- // row 4: label textbox
+ this.cbxServer = new Combo(pnlServer, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxServer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxServer.setToolTipText(RestClientI18n.publishPageServerToolTip.text());
- { // row 1: server row
- Composite pnlServer = new Composite(pnl, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- pnlServer.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
- gd.horizontalSpan = 2;
- pnlServer.setLayoutData(gd);
+ final IAction action = new NewServerAction(this.getShell(), getServerManager());
+ final Button btnNewServer = new Button(pnlServer, SWT.PUSH);
+ btnNewServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ btnNewServer.setText(RestClientI18n.publishPageNewServerButton.text());
+ btnNewServer.setToolTipText(action.getToolTipText());
+ btnNewServer.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ action.run();
+ }
+ });
- Label lblServer = new Label(pnlServer, SWT.LEFT);
- lblServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblServer.setText(RestClientI18n.publishPageServerLabel.text());
+ // update page message first time selected to get rid of initial
+ // message by forcing validation
+ btnNewServer.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateInitialMessage();
+ btnNewServer.removeSelectionListener(this);
+ }
+ });
+ }
- this.cbxServer = new Combo(pnlServer, SWT.DROP_DOWN | SWT.READ_ONLY);
- this.cbxServer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- this.cbxServer.setToolTipText(RestClientI18n.publishPageServerToolTip.text());
+ { // row 2: repository row
+ Label lblRepository = new Label(pnl, SWT.LEFT);
+ lblRepository.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblRepository.setText(RestClientI18n.publishPageRepositoryLabel.text());
- final IAction action = new NewServerAction(this.getShell(), getServerManager());
- final Button btnNewServer = new Button(pnlServer, SWT.PUSH);
- btnNewServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- btnNewServer.setText(RestClientI18n.publishPageNewServerButton.text());
- btnNewServer.setToolTipText(action.getToolTipText());
- btnNewServer.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- action.run();
- }
- });
+ this.cbxRepository = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxRepository.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxRepository.setToolTipText(RestClientI18n.publishPageRepositoryToolTip.text());
+ }
- // update page message first time selected to get rid of initial message by forcing validation
- btnNewServer.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- updateInitialMessage();
- btnNewServer.removeSelectionListener(this);
- }
- });
- }
+ { // row 3: workspace row
+ Label lblWorkspace = new Label(pnl, SWT.LEFT);
+ lblWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblWorkspace.setText(RestClientI18n.publishPageWorkspaceLabel.text());
- { // row 2: repository row
- Label lblRepository = new Label(pnl, SWT.LEFT);
- lblRepository.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblRepository.setText(RestClientI18n.publishPageRepositoryLabel.text());
+ this.cbxWorkspace = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxWorkspace.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- this.cbxRepository = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
- this.cbxRepository.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- this.cbxRepository.setToolTipText(RestClientI18n.publishPageRepositoryToolTip.text());
- }
+ if (type == Type.PUBLISH) {
+ this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspacePublishToolTip.text());
+ } else {
+ this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspaceUnpublishToolTip.text());
+ }
+ }
- { // row 3: workspace row
- Label lblWorkspace = new Label(pnl, SWT.LEFT);
- lblWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblWorkspace.setText(RestClientI18n.publishPageWorkspaceLabel.text());
+ { // row 4: workspace area
+ Label lblWorkspaceArea = new Label(pnl, SWT.LEFT);
+ lblWorkspaceArea.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblWorkspaceArea.setText(RestClientI18n.publishPageWorkspaceAreaLabel.text());
- this.cbxWorkspace = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
- this.cbxWorkspace.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxWorkspaceAreas = new Combo(pnl, SWT.DROP_DOWN);
+ this.cbxWorkspaceAreas.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxWorkspaceAreas.setToolTipText(RestClientI18n.publishPageWorkspaceAreaToolTip.text());
+ }
+ }
- if (type == Type.PUBLISH) {
- this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspacePublishToolTip.text());
- } else {
- this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspaceUnpublishToolTip.text());
- }
- }
+ private void constructResourcesPanel(Composite parent) {
+ Composite pnl = new Composite(parent, SWT.NONE);
+ pnl.setLayout(new GridLayout());
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- { // row 4: workspace area
- Label lblWorkspaceArea = new Label(pnl, SWT.LEFT);
- lblWorkspaceArea.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblWorkspaceArea.setText(RestClientI18n.publishPageWorkspaceAreaLabel.text());
+ // pnl layout:
+ // row 1: lbl
+ // row 2: lstResources
+ // row 3: recurse chkbox
+ // row 4: versioning chkbox and link (only when publishing)
- Text txtWorkspaceArea = new Text(pnl, SWT.BORDER);
- txtWorkspaceArea.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- txtWorkspaceArea.setToolTipText(RestClientI18n.publishPageWorkspaceAreaToolTip.text());
- txtWorkspaceArea.addModifyListener(new ModifyListener() {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText( ModifyEvent e ) {
- handleWorkspaceAreaModified(((Text)e.widget).getText());
- }
- });
+ { // row 1
+ Label lbl = new Label(pnl, SWT.LEFT);
+ lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- // set the workspace area from the dialog settings
- String temp = getDialogSettings().get(WORKSPACE_AREA_KEY);
- this.workspaceArea = ((temp == null) ? DEFAULT_WORKSPACE_AREA : temp);
- txtWorkspaceArea.setText(this.workspaceArea);
- }
- }
+ if (type == Type.PUBLISH) {
+ lbl.setText(RestClientI18n.publishPagePublishResourcesLabel.text());
+ } else {
+ lbl.setText(RestClientI18n.publishPageUnpublishResourcesLabel.text());
+ }
+ }
- private void constructResourcesPanel( Composite parent ) {
- Composite pnl = new Composite(parent, SWT.NONE);
- pnl.setLayout(new GridLayout());
- pnl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ { // row 2
+ this.lstResources = new org.eclipse.swt.widgets.List(pnl, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.horizontalSpan = 2;
+ gd.minimumHeight = this.lstResources.getItemHeight() * 2; // set min
+ // height
+ gd.heightHint = this.lstResources.getItemHeight() * 10; // set
+ // preferred
+ // height
+ this.lstResources.setLayoutData(gd);
+ final org.eclipse.swt.widgets.List finalLst = this.lstResources;
- // pnl layout:
- // row 1: lbl
- // row 2: lstResources
- // row 3: chkbox
+ // update page message first time selected to get rid of initial
+ // message by forcing validation
+ this.lstResources.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // do the very first time to get rid of initial message then
+ // remove listener
+ updateInitialMessage();
+ finalLst.removeSelectionListener(this);
+ }
+ });
- { // row 1
- Label lbl = new Label(pnl, SWT.LEFT);
- lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ // load list with initial files
+ loadFiles();
+ }
- if (type == Type.PUBLISH) {
- lbl.setText(RestClientI18n.publishPagePublishResourcesLabel.text());
- } else {
- lbl.setText(RestClientI18n.publishPageUnpublishResourcesLabel.text());
- }
- }
+ { // row 3 recurse chkbox
+ Button chkRecurse = new Button(pnl, SWT.CHECK);
+ chkRecurse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ chkRecurse.setText(RestClientI18n.publishPageRecurseCheckBox.text());
+ chkRecurse.setToolTipText(RestClientI18n.publishPageRecurseCheckBoxToolTip.text());
- { // row 2
- this.lstResources = new org.eclipse.swt.widgets.List(pnl, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 2;
- this.lstResources.setLayoutData(gd);
- final org.eclipse.swt.widgets.List finalLst = this.lstResources;
+ // set the recurse flag based on dialog settings
+ if (getDialogSettings().get(RECURSE_KEY) != null) {
+ this.recurse = getDialogSettings().getBoolean(RECURSE_KEY);
+ }
- // update page message first time selected to get rid of initial message by forcing validation
- this.lstResources.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- // do the very first time to get rid of initial message then remove listener
- updateInitialMessage();
- finalLst.removeSelectionListener(this);
- }
- });
+ chkRecurse.setSelection(this.recurse);
+ chkRecurse.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleRecurseChanged(((Button) e.widget).getSelection());
+ }
+ });
- // load list with initial files
- loadFiles();
- }
+ // update page message first time selected to get rid of initial
+ // message by forcing validation
+ chkRecurse.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateInitialMessage();
+ ((Button) e.widget).removeSelectionListener(this);
+ }
+ });
+ }
- { // row 3
- Button chkRecurse = new Button(pnl, SWT.CHECK);
- chkRecurse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- chkRecurse.setText(RestClientI18n.publishPageRecurseCheckBox.text());
- chkRecurse.setToolTipText(RestClientI18n.publishPageRecurseCheckBoxToolTip.text());
+ if (this.type == Type.PUBLISH) {
+ // row 4 versioning chkbox and link to open preference page
+ Composite pnlVersioning = new Composite(pnl, SWT.NONE);
+ pnlVersioning.setLayout(new GridLayout(2, false));
+ ((GridLayout) pnlVersioning.getLayout()).marginWidth = 0;
+ pnlVersioning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
+ ((GridData) pnlVersioning.getLayoutData()).minimumHeight = 30;
- // set the recurse flag based on dialog settings
- if (getDialogSettings().get(RECURSE_KEY) != null) {
- this.recurse = getDialogSettings().getBoolean(RECURSE_KEY);
- }
+ Button chkVersioning = new Button(pnlVersioning, SWT.CHECK);
+ chkVersioning.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ chkVersioning.setText(RestClientI18n.publishPageVersionCheckBox.text());
+ chkVersioning.setToolTipText(RestClientI18n.publishPageVersionCheckBoxToolTip.text());
- chkRecurse.setSelection(this.recurse);
- chkRecurse.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- handleRecurseChanged(((Button)e.widget).getSelection());
- }
- });
+ // set the version flag based on preference
+ this.versioning = Activator.getDefault().getPreferenceStore().getBoolean(ENABLE_RESOURCE_VERSIONING);
- // update page message first time selected to get rid of initial message by forcing validation
- chkRecurse.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- updateInitialMessage();
- ((Button)e.widget).removeSelectionListener(this);
- }
- });
- }
- }
+ chkVersioning.setSelection(this.versioning);
+ chkVersioning.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleVersioningChanged(((Button) e.widget).getSelection());
+ }
+ });
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl( Composite parent ) {
- Composite pnlMain = new Composite(parent, SWT.NONE);
- pnlMain.setLayout(new GridLayout());
- pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- constructLocationPanel(pnlMain);
- constructResourcesPanel(pnlMain);
- setControl(pnlMain);
+ Link link = new Link(pnlVersioning, SWT.WRAP);
+ link.setText(RestClientI18n.publishPageOpenPreferencePageLink.text());
+ link.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ link.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleOpenPreferencePage();
+ }
+ });
+ }
+ }
- // add combobox listeners
- this.cbxRepository.addModifyListener(this);
- this.cbxServer.addModifyListener(this);
- this.cbxWorkspace.addModifyListener(this);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite pnlMain = new Composite(parent, SWT.NONE);
+ pnlMain.setLayout(new GridLayout());
+ pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ constructLocationPanel(pnlMain);
+ constructResourcesPanel(pnlMain);
+ setControl(pnlMain);
- // register with the help system
- IWorkbenchHelpSystem helpSystem = Activator.getDefault().getWorkbench().getHelpSystem();
- helpSystem.setHelp(pnlMain, PUBLISH_DIALOG_HELP_CONTEXT);
+ // add combobox listeners
+ this.cbxRepository.addModifyListener(this);
+ this.cbxServer.addModifyListener(this);
+ this.cbxWorkspace.addModifyListener(this);
+ this.cbxWorkspaceAreas.addModifyListener(this);
- // register to receive server registry events (this will populate the UI)
- getServerManager().addRegistryListener(this);
- }
+ // register with the help system
+ IWorkbenchHelpSystem helpSystem = Activator.getDefault().getWorkbench().getHelpSystem();
+ helpSystem.setHelp(pnlMain, PUBLISH_DIALOG_HELP_CONTEXT);
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- */
- @Override
- public void dispose() {
- getServerManager().removeRegistryListener(this);
- super.dispose();
- }
+ // register to receive server registry events (this will populate the
+ // UI)
+ getServerManager().addRegistryListener(this);
+ }
- /**
- * @return the files to publish or unpublish (never <code>null</code>)
- */
- List<IFile> getFiles() {
- return this.files;
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ getServerManager().removeRegistryListener(this);
+ super.dispose();
+ }
- /**
- * @return the server manager obtained from the wizard
- */
- private ServerManager getServerManager() {
- return ((PublishWizard)getWizard()).getServerManager();
- }
+ /**
+ * @return the files to publish or unpublish (never <code>null</code>)
+ */
+ List<IFile> getFiles() {
+ return this.files;
+ }
- /**
- * @return thw workspace to use when publishing or unpublishing (page must be complete)
- */
- Workspace getWorkspace() {
- assert isPageComplete();
- return this.workspace;
- }
+ /**
+ * @return the server manager obtained from the wizard
+ */
+ private ServerManager getServerManager() {
+ return ((PublishWizard) getWizard()).getServerManager();
+ }
- /**
- * @return the path segment prepended to the resource project path (never <code>null</code> but can be empty)
- */
- String getWorkspaceArea() {
- return this.workspaceArea;
- }
+ /**
+ * @return thw workspace to use when publishing or unpublishing (page must
+ * be complete)
+ */
+ Workspace getWorkspace() {
+ assert isPageComplete();
+ return this.workspace;
+ }
- /**
- * Saves the recurse setting and reloads the files to be published or unpublished.
- *
- * @param selected the flag indicating the new recurse setting
- */
- void handleRecurseChanged( boolean selected ) {
- this.recurse = selected;
+ /**
+ * @return the path segment prepended to the resource project path (never
+ * <code>null</code> but can be empty)
+ */
+ String getWorkspaceArea() {
+ return this.workspaceArea;
+ }
- try {
- this.files = processResources(this.resources, isRecursing(), filter);
- loadFiles();
- } catch (CoreException e) {
- Activator.getDefault().log(new Status(Severity.ERROR, RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
+ /**
+ * Opens the preference page.
+ */
+ void handleOpenPreferencePage() {
+ // open preference page and only allow the pref page where the version
+ // setting is
+ PreferencesUtil.createPreferenceDialogOn(getShell(), MAIN_PREFERENCE_PAGE_ID,
+ new String[] { MAIN_PREFERENCE_PAGE_ID, IUiConstants.Preferences.FILTERS_PREFERENCE_PAGE_ID }, null)
+ .open();
+ }
- if (getControl().isVisible()) {
- MessageDialog.openError(getShell(),
- RestClientI18n.errorDialogTitle.text(),
- RestClientI18n.publishPageRecurseProcessingErrorMsg.text());
- }
- }
- }
+ /**
+ * Saves the recurse setting and reloads the files to be published or
+ * unpublished.
+ *
+ * @param selected
+ * the flag indicating the new recurse setting
+ */
+ void handleRecurseChanged(boolean selected) {
+ this.recurse = selected;
- /**
- * Handler for when the repository control value is modified
- */
- void handleRepositoryModified() {
- int index = this.cbxRepository.getSelectionIndex();
+ try {
+ this.files = processResources(this.resources, isRecursing(), filter);
+ loadFiles();
+ } catch (CoreException e) {
+ Activator.getDefault().log(
+ new Status(Severity.ERROR, RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
- // make sure there is a selection
- if (index != -1) {
- this.repository = this.repositories.get(index);
- }
+ if (getControl().isVisible()) {
+ MessageDialog.openError(getShell(), RestClientI18n.errorDialogTitle.text(),
+ RestClientI18n.publishPageRecurseProcessingErrorMsg.text());
+ }
+ }
+ }
- // clear loaded workspaces
- refreshWorkspaces();
+ /**
+ * Handler for when the repository control value is modified
+ */
+ void handleRepositoryModified() {
+ int index = this.cbxRepository.getSelectionIndex();
- // update page state
- updateState();
- }
+ // make sure there is a selection
+ if (index != -1) {
+ this.repository = this.repositories.get(index);
+ }
- /**
- * Handler for when the server control value is modified
- */
- void handleServerModified() {
- int index = this.cbxServer.getSelectionIndex();
+ // clear loaded workspaces
+ refreshWorkspaces();
- // make sure there is a selection
- if (index != -1) {
- this.server = this.servers.get(index);
- }
+ // update page state
+ updateState();
+ }
- // need to reload repositories since server changed
- refreshRepositories();
+ /**
+ * Handler for when the server control value is modified
+ */
+ void handleServerModified() {
+ int index = this.cbxServer.getSelectionIndex();
- // update page state
- updateState();
- }
+ // make sure there is a selection
+ if (index != -1) {
+ this.server = this.servers.get(index);
+ }
- /**
- * Handler for when the workspace area value is modified.
- *
- * @param workspaceArea the new workspace area (never <code>null</code>)
- */
- void handleWorkspaceAreaModified( String workspaceArea ) {
- this.workspaceArea = workspaceArea.trim();
- }
+ // need to reload repositories since server changed
+ refreshRepositories();
- /**
- * Handler for when the workspace control value is modified.
- */
- void handleWorkspaceModified() {
- int index = this.cbxWorkspace.getSelectionIndex();
+ // update page state
+ updateState();
+ }
- // make sure there is a selection
- if (index != -1) {
- this.workspace = this.workspaces.get(index);
- }
+ /**
+ * Saves the versioning setting.
+ *
+ * @param selected
+ * the flag indicating the new versioning setting
+ */
+ void handleVersioningChanged(boolean selected) {
+ this.versioning = selected;
+ }
- updateState();
- }
+ /**
+ * Handler for when the workspace area value is modified.
+ */
+ void handleWorkspaceAreaModified() {
+ int index = this.cbxWorkspaceAreas.getSelectionIndex();
- /**
- * @return <code>true</code> if resources found recursively under projects and folders should also be published or unpublished
- */
- boolean isRecursing() {
- return this.recurse;
- }
+ if (index == -1) {
+ this.workspaceArea = this.cbxWorkspaceAreas.getText();
+ } else {
+ this.workspaceArea = this.cbxWorkspaceAreas.getItems()[index];
+ }
+ }
- /**
- * Populates the list of files to be published based on the recurse flag and the list of workspace selected resources.
- * Pre-condition is that {@link #processResources(List, boolean, PublishingFileFilter)} has been called.
- */
- private void loadFiles() {
- this.lstResources.removeAll();
+ /**
+ * Handler for when the workspace control value is modified.
+ */
+ void handleWorkspaceModified() {
+ int index = this.cbxWorkspace.getSelectionIndex();
- for (IResource resource : this.files) {
- this.lstResources.add(resource.getFullPath().toString());
- }
- }
+ // make sure there is a selection
+ if (index != -1) {
+ Workspace newWorkspace = this.workspaces.get(index);
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText( ModifyEvent e ) {
- if (e.widget == this.cbxServer) {
- handleServerModified();
- } else if (e.widget == this.cbxRepository) {
- handleRepositoryModified();
- } else if (e.widget == this.cbxWorkspace) {
- handleWorkspaceModified();
- } else {
- assert false; // should not happen
- }
- }
+ if ((this.workspace == null) || !this.workspace.equals(newWorkspace)) {
+ this.workspace = newWorkspace;
- /**
- * Refreshes the repository-related fields and controls based on the server registry. This in turn causes the workspaces to
- * also to be refreshed.
- */
- private void refreshRepositories() {
- this.repository = null;
+ // update workspace areas
+ WorkspaceArea[] workspaceAreas = null;
- if (this.server == null) {
- this.repositories = Collections.emptyList();
- } else {
- try {
- this.repositories = new ArrayList<Repository>(getServerManager().getRepositories(this.server));
- } catch (Exception e) {
- this.repositories = Collections.emptyList();
- String msg = RestClientI18n.serverManagerGetRepositoriesExceptionMsg.text(this.server.getShortDescription());
- Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+ try {
+ workspaceAreas = getServerManager().getWorkspaceAreas(this.workspace);
+ } catch (Exception e) {
+ Activator.getDefault().log(
+ new Status(Severity.ERROR, RestClientI18n.publishPageUnableToObtainWorkspaceAreas
+ .text(this.workspace), e));
+ }
- if (getControl().isVisible()) {
- MessageDialog.openError(getShell(), RestClientI18n.errorDialogTitle.text(), msg);
- }
- }
- }
+ if ((workspaceAreas == null) || (workspaceAreas.length == 0)) {
+ // populate with default area name
+ this.cbxWorkspaceAreas.setItems(new String[] { DEFAULT_WORKSPACE_AREA });
+ } else {
+ String[] areaPaths = new String[workspaceAreas.length];
+ int i = 0;
- // clear items
- this.cbxRepository.removeAll();
+ for (WorkspaceArea area : workspaceAreas) {
+ areaPaths[i++] = area.getPath();
+ }
- // reload
- if (this.repositories.isEmpty()) {
- // disable control if necessary
- if (this.cbxRepository.getEnabled()) {
- this.cbxRepository.setEnabled(false);
- }
- } else if (this.repositories.size() == 1) {
- this.repository = this.repositories.get(0);
- this.cbxRepository.add(this.repository.getName());
- this.cbxRepository.select(0);
+ this.cbxWorkspaceAreas.setItems(areaPaths);
+ }
+ }
+ } else {
+ this.workspaceArea = null;
+ this.cbxWorkspaceAreas.removeAll();
+ }
- // enable control if necessary
- if (!this.cbxRepository.getEnabled()) {
- this.cbxRepository.setEnabled(true);
- }
- } else {
- // add an item for each repository
- for (Repository repository : this.repositories) {
- this.cbxRepository.add(repository.getName());
- }
+ if (this.cbxWorkspaceAreas.getItemCount() != 0) {
+ this.cbxWorkspaceAreas.select(0);
+ }
- // enable control if necessary
- if (!this.cbxRepository.getEnabled()) {
- this.cbxRepository.setEnabled(true);
- }
- }
+ updateState();
+ }
- // must reload workspaces
- refreshWorkspaces();
- }
+ /**
+ * @return <code>true</code> if resources found recursively under projects
+ * and folders should also be published or unpublished
+ */
+ boolean isRecursing() {
+ return this.recurse;
+ }
- /**
- * Refreshes the server-related fields and controls based on the server registry. This in turn causes the repositories and
- * workspaces to also to be refreshed.
- */
- void refreshServers() {
- this.server = null;
- this.servers = new ArrayList<Server>(getServerManager().getServers());
+ /**
+ * @return <code>true</code> if versioning of published resources should be
+ * done
+ */
+ boolean isVersioning() {
+ return this.versioning;
+ }
- // clear server combo
- this.cbxServer.removeAll();
+ /**
+ * Populates the list of files to be published based on the recurse flag and
+ * the list of workspace selected resources. Pre-condition is that
+ * {@link #processResources(List, boolean, PublishingFileFilter)} has been
+ * called.
+ */
+ private void loadFiles() {
+ this.lstResources.removeAll();
- if (this.servers.size() == 0) {
- // disable control if necessary
- if (this.cbxServer.getEnabled()) {
- this.cbxServer.setEnabled(false);
- }
- } else if (this.servers.size() == 1) {
- this.server = this.servers.get(0);
- this.cbxServer.add(this.server.getName());
- this.cbxServer.select(0);
+ for (IResource resource : this.files) {
+ this.lstResources.add(resource.getFullPath().toString());
+ }
+ }
- // enable control if necessary
- if (!this.cbxServer.getEnabled()) {
- this.cbxServer.setEnabled(true);
- }
- } else {
- // add an item for each server
- for (Server server : this.servers) {
- this.cbxServer.add(server.getName());
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (e.widget == this.cbxServer) {
+ handleServerModified();
+ } else if (e.widget == this.cbxRepository) {
+ handleRepositoryModified();
+ } else if (e.widget == this.cbxWorkspace) {
+ handleWorkspaceModified();
+ } else if (e.widget == this.cbxWorkspaceAreas) {
+ handleWorkspaceAreaModified();
+ } else {
+ assert false; // should not happen
+ }
+ }
- // enable control if necessary
- if (!this.cbxServer.getEnabled()) {
- this.cbxServer.setEnabled(true);
- }
- }
+ /**
+ * Refreshes the repository-related fields and controls based on the server
+ * registry. This in turn causes the workspaces to also to be refreshed.
+ */
+ private void refreshRepositories() {
+ this.repository = null;
- // must reload repositories
- refreshRepositories();
- }
+ if (this.server == null) {
+ this.repositories = Collections.emptyList();
+ } else {
+ try {
+ this.repositories = new ArrayList<Repository>(getServerManager().getRepositories(this.server));
+ } catch (Exception e) {
+ this.repositories = Collections.emptyList();
+ String msg = RestClientI18n.serverManagerGetRepositoriesExceptionMsg.text(this.server
+ .getShortDescription());
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+ }
+ }
- /**
- * Refreshes the workspace-related fields and controls based on the server registry.
- */
- private void refreshWorkspaces() {
- this.workspace = null;
+ // clear items
+ this.cbxRepository.removeAll();
- if (this.repository == null) {
- this.workspaces = Collections.emptyList();
- } else {
- try {
- this.workspaces = new ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
- } catch (Exception e) {
- this.workspaces = Collections.emptyList();
- String msg = RestClientI18n.serverManagerGetWorkspacesExceptionMsg.text(this.repository);
- Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+ // reload
+ if (this.repositories.isEmpty()) {
+ // disable control if necessary
+ if (this.cbxRepository.getEnabled()) {
+ this.cbxRepository.setEnabled(false);
+ }
+ } else if (this.repositories.size() == 1) {
+ this.repository = this.repositories.get(0);
+ this.cbxRepository.add(this.repository.getName());
+ this.cbxRepository.select(0);
- if (getControl().isVisible()) {
- MessageDialog.openError(getShell(), RestClientI18n.errorDialogTitle.text(), msg);
- }
- }
- }
+ // enable control if necessary
+ if (!this.cbxRepository.getEnabled()) {
+ this.cbxRepository.setEnabled(true);
+ }
+ } else {
+ // add an item for each repository
+ for (Repository repository : this.repositories) {
+ this.cbxRepository.add(repository.getName());
+ }
- // clear items
- this.cbxWorkspace.removeAll();
+ // enable control if necessary
+ if (!this.cbxRepository.getEnabled()) {
+ this.cbxRepository.setEnabled(true);
+ }
+ }
- // reload
- if (this.workspaces.isEmpty()) {
- // disable control if necessary
- if (this.cbxWorkspace.getEnabled()) {
- this.cbxWorkspace.setEnabled(false);
- }
- } else if (this.workspaces.size() == 1) {
- this.workspace = this.workspaces.get(0);
- this.cbxWorkspace.add(this.workspace.getName());
- this.cbxWorkspace.select(0);
+ // must reload workspaces
+ refreshWorkspaces();
+ }
- // enable control if necessary
- if (!this.cbxWorkspace.getEnabled()) {
- this.cbxWorkspace.setEnabled(true);
- }
- } else {
- // add an item for each workspace
- for (Workspace workspace : this.workspaces) {
- this.cbxWorkspace.add(workspace.getName());
- }
+ /**
+ * Refreshes the server-related fields and controls based on the server
+ * registry. This in turn causes the repositories and workspaces to also to
+ * be refreshed.
+ */
+ void refreshServers() {
+ this.server = null;
+ this.servers = new ArrayList<Server>(getServerManager().getServers());
- // enable control if necessary
- if (!this.cbxWorkspace.getEnabled()) {
- this.cbxWorkspace.setEnabled(true);
- }
- }
- }
+ // clear server combo
+ this.cbxServer.removeAll();
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.tools.modeshape.rest.IServerRegistryListener#serverRegistryChanged(org.jboss.tools.modeshape.rest.ServerRegistryEvent)
- */
- @Override
- public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
- // should only be a new server event
- if (event.isNew()) {
- refreshServers();
- updateState();
- }
+ if (this.servers.size() == 0) {
+ // disable control if necessary
+ if (this.cbxServer.getEnabled()) {
+ this.cbxServer.setEnabled(false);
+ }
+ } else if (this.servers.size() == 1) {
+ this.server = this.servers.get(0);
+ this.cbxServer.add(this.server.getName());
+ this.cbxServer.select(0);
- return null;
- }
+ // enable control if necessary
+ if (!this.cbxServer.getEnabled()) {
+ this.cbxServer.setEnabled(true);
+ }
+ } else {
+ // add an item for each server
+ for (Server server : this.servers) {
+ this.cbxServer.add(server.getName());
+ }
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- @Override
- public void setVisible( boolean visible ) {
- super.setVisible(visible);
+ // enable control if necessary
+ if (!this.cbxServer.getEnabled()) {
+ this.cbxServer.setEnabled(true);
+ }
+ }
- if (visible) {
- // set initial status
- validate();
+ // must reload repositories
+ refreshRepositories();
+ }
- // update OK/Finish button enablement
- setPageComplete(!this.status.isError());
+ /**
+ * Refreshes the workspace-related fields and controls based on the server
+ * registry.
+ */
+ private void refreshWorkspaces() {
+ this.workspace = null;
- // set initial message
- if (this.status.isOk()) {
- String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
- : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
- setMessage(msg, IMessageProvider.NONE);
- } else {
- setMessage(this.status.getMessage(), IMessageProvider.ERROR);
- }
- }
- }
+ if (this.repository == null) {
+ this.workspaces = Collections.emptyList();
+ } else {
+ try {
+ this.workspaces = new ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
+ } catch (Exception e) {
+ this.workspaces = Collections.emptyList();
+ String msg = RestClientI18n.serverManagerGetWorkspacesExceptionMsg.text(this.repository);
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+ }
+ }
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
- */
- @Override
- public void setWizard( IWizard newWizard ) {
- super.setWizard(newWizard);
+ // clear items
+ this.cbxWorkspace.removeAll();
+ this.cbxWorkspaceAreas.removeAll();
- try {
- this.files = processResources(this.resources, isRecursing(), this.filter);
- } catch (CoreException e) {
- Activator.getDefault().log(new Status(Severity.ERROR, RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
- }
- }
+ // reload
+ if (this.workspaces.isEmpty()) {
+ // disable controls if necessary
+ if (this.cbxWorkspace.getEnabled()) {
+ this.cbxWorkspace.setEnabled(false);
+ }
- /**
- * Updates the initial page message.
- */
- void updateInitialMessage() {
- String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
- : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ if (this.cbxWorkspaceAreas.getEnabled()) {
+ this.cbxWorkspaceAreas.setEnabled(false);
+ }
+ } else if (this.workspaces.size() == 1) {
+ Workspace temp = this.workspaces.get(0);
+ this.cbxWorkspace.add(temp.getName());
+ this.cbxWorkspace.select(0);
- if (msg.equals(getMessage())) {
- updateState();
- }
- }
+ // enable controls if necessary
+ if (!this.cbxWorkspace.getEnabled()) {
+ this.cbxWorkspace.setEnabled(true);
+ }
- /**
- * Updates message, message icon, and OK button enablement based on validation results
- */
- void updateState() {
- // get the current state
- validate();
+ if (!this.cbxWorkspaceAreas.getEnabled()) {
+ this.cbxWorkspaceAreas.setEnabled(true);
+ }
+ } else {
+ // add an item for each workspace
+ for (Workspace workspace : this.workspaces) {
+ this.cbxWorkspace.add(workspace.getName());
+ }
- // update OK/Finish button enablement
- setPageComplete(!this.status.isError());
+ // enable controls if necessary
+ if (!this.cbxWorkspace.getEnabled()) {
+ this.cbxWorkspace.setEnabled(true);
+ }
- // update page message
- if (this.status.isError()) {
- setMessage(this.status.getMessage(), IMessageProvider.ERROR);
- } else {
- if (this.status.isWarning()) {
- setMessage(this.status.getMessage(), IMessageProvider.WARNING);
- } else if (this.status.isInfo()) {
- setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
- } else {
- setMessage(this.status.getMessage(), IMessageProvider.NONE);
- }
- }
- }
+ if (!this.cbxWorkspaceAreas.getEnabled()) {
+ this.cbxWorkspaceAreas.setEnabled(true);
+ }
+ }
+ }
- /**
- * Validates all inputs and sets the validation status.
- */
- private void validate() {
- String msg = null;
- Severity severity = Severity.ERROR;
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.IServerRegistryListener#serverRegistryChanged(org.jboss.tools.modeshape.rest.ServerRegistryEvent)
+ */
+ @Override
+ public Exception[] serverRegistryChanged(ServerRegistryEvent event) {
+ // should only be a new server event
+ if (event.isNew()) {
+ refreshServers();
+ updateState();
+ }
- if ((this.resources == null) || this.resources.isEmpty() || this.files.isEmpty()) {
- msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text()
- : RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
- } else if (this.server == null) {
- int count = this.cbxServer.getItemCount();
- msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableServersStatusMsg.text()
- : RestClientI18n.publishPageMissingServerStatusMsg.text());
- } else if (this.repository == null) {
- int count = this.cbxRepository.getItemCount();
- msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text()
- : RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
- } else if (this.workspace == null) {
- int count = this.cbxWorkspace.getItemCount();
- msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text()
- : RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
- } else {
- severity = Severity.OK;
- msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
- : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
- }
+ return null;
+ }
- this.status = new Status(severity, msg, null);
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
- /**
- * Processing done after wizard is finished. Wizard was not canceled.
- */
- void wizardFinished() {
- // update dialog settings
- getDialogSettings().put(RECURSE_KEY, this.recurse);
- getDialogSettings().put(WORKSPACE_AREA_KEY, this.workspaceArea);
- }
+ if (visible) {
+ // set initial status
+ validate();
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
+
+ // set initial message
+ if (this.status.isOk()) {
+ String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ setMessage(msg, IMessageProvider.NONE);
+ } else {
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
+ */
+ @Override
+ public void setWizard(IWizard newWizard) {
+ super.setWizard(newWizard);
+
+ try {
+ this.files = processResources(this.resources, isRecursing(), this.filter);
+ } catch (CoreException e) {
+ Activator.getDefault().log(
+ new Status(Severity.ERROR, RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
+ }
+ }
+
+ /**
+ * Updates the initial page message.
+ */
+ void updateInitialMessage() {
+ String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+
+ if (msg.equals(getMessage())) {
+ updateState();
+ }
+ }
+
+ /**
+ * Updates message, message icon, and OK button enablement based on
+ * validation results
+ */
+ void updateState() {
+ // get the current state
+ validate();
+
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
+
+ // update page message
+ if (this.status.isError()) {
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ } else {
+ if (this.status.isWarning()) {
+ setMessage(this.status.getMessage(), IMessageProvider.WARNING);
+ } else if (this.status.isInfo()) {
+ setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
+ } else {
+ setMessage(this.status.getMessage(), IMessageProvider.NONE);
+ }
+ }
+ }
+
+ /**
+ * Validates all inputs and sets the validation status.
+ */
+ private void validate() {
+ String msg = null;
+ Severity severity = Severity.ERROR;
+
+ if ((this.resources == null) || this.resources.isEmpty() || this.files.isEmpty()) {
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text()
+ : RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
+ } else if (this.server == null) {
+ int count = this.cbxServer.getItemCount();
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableServersStatusMsg.text()
+ : RestClientI18n.publishPageMissingServerStatusMsg.text());
+ } else if (this.repository == null) {
+ int count = this.cbxRepository.getItemCount();
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text()
+ : RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
+ } else if (this.workspace == null) {
+ int count = this.cbxWorkspace.getItemCount();
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text()
+ : RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
+ } else {
+ severity = Severity.OK;
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ }
+
+ this.status = new Status(severity, msg, null);
+ }
+
+ /**
+ * Processing done after wizard is finished. Wizard was not canceled.
+ */
+ void wizardFinished() {
+ // update dialog settings
+ getDialogSettings().put(RECURSE_KEY, this.recurse);
+ getDialogSettings().put(WORKSPACE_AREA_KEY, this.workspaceArea);
+ }
+
}
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishWizard.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishWizard.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishWizard.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -12,7 +12,9 @@
package org.jboss.tools.modeshape.rest.wizards;
import static org.jboss.tools.modeshape.rest.IUiConstants.WIZARD_BANNER_IMAGE;
+
import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -33,10 +35,6 @@
*/
public final class PublishWizard extends Wizard {
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* The wizard page containing all the controls that allow publishing/unpublishing of resources.
*/
@@ -52,10 +50,6 @@
*/
private final Type type;
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
/**
* @param type the publishing or unpublishing indicator (never <code>null</code>)
* @param resources the resources being published or unpublished (never <code>null</code>)
@@ -65,9 +59,9 @@
public PublishWizard( Type type,
List<IResource> resources,
ServerManager serverManager ) throws CoreException {
- CheckArg.isNotNull(type, "type");
- CheckArg.isNotNull(resources, "resources");
- CheckArg.isNotNull(serverManager, "serverManager");
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
+ CheckArg.isNotNull(resources, "resources"); //$NON-NLS-1$
+ CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
this.type = type;
this.page = new PublishPage(type, resources);
@@ -78,10 +72,6 @@
setDefaultPageImageDescriptor(Activator.getDefault().getImageDescriptor(WIZARD_BANNER_IMAGE));
}
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
/**
* {@inheritDoc}
*
@@ -141,7 +131,7 @@
Workspace workspace = this.page.getWorkspace();
List<IFile> files = this.page.getFiles();
String workspaceArea = this.page.getWorkspaceArea();
- PublishJob job = new PublishJob(this.type, files, workspace, workspaceArea);
+ PublishJob job = new PublishJob(this.type, files, workspace, workspaceArea, this.page.isVersioning());
job.schedule();
return true;
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerPage.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerPage.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerPage.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -12,7 +12,7 @@
package org.jboss.tools.modeshape.rest.wizards;
import static org.jboss.tools.modeshape.rest.IUiConstants.BLANK_IMAGE;
-import static org.jboss.tools.modeshape.rest.IUiConstants.SERVER_DIALOG_HELP_CONTEXT;
+import static org.jboss.tools.modeshape.rest.IUiConstants.HelpContexts.SERVER_DIALOG_HELP_CONTEXT;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
@@ -49,10 +49,6 @@
*/
public final class ServerPage extends WizardPage {
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* The button used to test the connection to the server. Should only be enabled when server properties are valid.
*/
@@ -88,10 +84,6 @@
*/
private String user;
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
/**
* Constructs a wizard page that will create a new server.
*/
@@ -117,10 +109,6 @@
this.savePassword = server.isPasswordBeingPersisted();
}
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
private void constructAuthenticationPanel( Composite parent ) {
Group pnl = new Group(parent, SWT.NONE);
pnl.setText(RestClientI18n.serverPageAuthenticationGroupTitle.text());
@@ -501,10 +489,10 @@
Server changedServer = getServer();
// don't check if modifying existing server and identifying properties have not changed
- if (((this.server == null) || !this.server.hasSameKey(changedServer))
- && getServerManager().isRegistered(changedServer)) {
+ if (((this.server == null) || !this.server.hasSameKey(changedServer)) && getServerManager().isRegistered(changedServer)) {
this.status = new Status(Severity.ERROR,
- RestClientI18n.serverExistsMsg.text(changedServer.getShortDescription()), null);
+ RestClientI18n.serverExistsMsg.text(changedServer.getShortDescription()),
+ null);
}
}
}
Modified: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerWizard.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerWizard.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/ServerWizard.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -12,6 +12,7 @@
package org.jboss.tools.modeshape.rest.wizards;
import static org.jboss.tools.modeshape.rest.IUiConstants.WIZARD_BANNER_IMAGE;
+
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.tools.modeshape.rest.Activator;
@@ -25,10 +26,6 @@
*/
public final class ServerWizard extends Wizard {
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
/**
* Non-<code>null</code> if the wizard is editing an existing server.
*/
@@ -44,10 +41,6 @@
*/
private final ServerManager serverManager;
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
/**
* Constructs a wizard that creates a new server.
*
@@ -72,13 +65,11 @@
this.page = new ServerPage(server);
this.serverManager = serverManager;
this.existingServer = server;
+
+ setDefaultPageImageDescriptor(Activator.getDefault().getImageDescriptor(WIZARD_BANNER_IMAGE));
setWindowTitle(RestClientI18n.serverWizardEditServerTitle.text());
}
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
/**
* {@inheritDoc}
*
Added: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/impl/StaticLoggerBinder.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/impl/StaticLoggerBinder.java (rev 0)
+++ branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/impl/StaticLoggerBinder.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -0,0 +1,62 @@
+/*
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.
+ *
+ * This software is made available by Red Hat, Inc. 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.
+ *
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ */
+package org.slf4j.impl;
+
+import org.jboss.tools.modeshape.rest.log.EclipseLoggerFactory;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+public final class StaticLoggerBinder implements LoggerFactoryBinder {
+
+ /**
+ * The class name of the logger factory.
+ */
+ private static final String LOGGER_FACTORY_CLASS_NAME = EclipseLoggerFactory.class.getName();
+
+ /**
+ * The unique instance of this class.
+ */
+ private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+
+ /**
+ * @return the static instance of the logger
+ */
+ public static final StaticLoggerBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ /**
+ * The logger factory used.
+ */
+ private final ILoggerFactory loggerFactory = new EclipseLoggerFactory();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.spi.LoggerFactoryBinder#getLoggerFactory()
+ */
+ @Override
+ public ILoggerFactory getLoggerFactory() {
+ return this.loggerFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.spi.LoggerFactoryBinder#getLoggerFactoryClassStr()
+ */
+ @Override
+ public String getLoggerFactoryClassStr() {
+ return LOGGER_FACTORY_CLASS_NAME;
+ }
+
+}
Property changes on: branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/slf4j/impl/StaticLoggerBinder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/modeshape/tests/org.jboss.tools.modeshape.rest.test/src/org/jboss/tools/modeshape/rest/MockRestClient.java
===================================================================
--- branches/jbosstools-3.2.x/modeshape/tests/org.jboss.tools.modeshape.rest.test/src/org/jboss/tools/modeshape/rest/MockRestClient.java 2011-04-04 13:59:30 UTC (rev 30267)
+++ branches/jbosstools-3.2.x/modeshape/tests/org.jboss.tools.modeshape.rest.test/src/org/jboss/tools/modeshape/rest/MockRestClient.java 2011-04-04 14:26:19 UTC (rev 30268)
@@ -16,7 +16,9 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
+
import javax.jcr.nodetype.NodeType;
+
import org.modeshape.web.jcr.rest.client.IRestClient;
import org.modeshape.web.jcr.rest.client.Status;
import org.modeshape.web.jcr.rest.client.domain.QueryRow;
@@ -84,6 +86,19 @@
/**
* {@inheritDoc}
*
+ * @see org.modeshape.web.jcr.rest.client.IRestClient#publish(org.modeshape.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File, boolean)
+ */
+ public Status publish( Workspace workspace,
+ String path,
+ File file,
+ boolean version ) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.modeshape.web.jcr.rest.client.IRestClient#unpublish(org.modeshape.web.jcr.rest.client.domain.Workspace,
* java.lang.String, java.io.File)
*/
13 years, 2 months
JBoss Tools SVN: r30267 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal: context and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-04-04 09:59:30 -0400 (Mon, 04 Apr 2011)
New Revision: 30267
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/ForeignKey.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaManyToOneMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaOneToOneMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/ForeignKeyImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormula.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormulaImpl.java
Log:
https://issues.jboss.org/browse/JBIDE-8666
make DiscriminatorFormula and ForeignKey annotations work with Eclipse 3.7
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -35,6 +35,7 @@
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.ForeignKey;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.ForeignKeyAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.ForeignKeyImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaBasicMappingImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaColumnImpl;
@@ -67,6 +68,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaTypeDef;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaTypeDefImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.TypeImpl;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.DiscriminatorFormulaAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.GenericGeneratorAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedNativeQueryAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueryAnnotation;
@@ -123,8 +125,8 @@
}
public JavaDiscriminatorFormula buildJavaDiscriminatorFormula(
- HibernateJavaEntity hibernateJavaEntity, JavaDiscriminatorFormula.Owner owner) {
- return new JavaDiscriminatorFormulaImpl(hibernateJavaEntity, owner);
+ HibernateJavaEntity hibernateJavaEntity, DiscriminatorFormulaAnnotation annotation) {
+ return new JavaDiscriminatorFormulaImpl(hibernateJavaEntity, annotation);
}
@Override
@@ -192,8 +194,8 @@
return new IndexImpl(parent);
}
- public ForeignKey buildForeignKey(JavaJpaContextNode parent) {
- return new ForeignKeyImpl(parent);
+ public ForeignKey buildForeignKey(JavaJpaContextNode parent, ForeignKeyAnnotation annotation) {
+ return new ForeignKeyImpl(parent, annotation);
}
public JavaType buildType(JavaJpaContextNode parent) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/ForeignKey.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/ForeignKey.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/ForeignKey.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -27,9 +27,7 @@
String getInverseName();
void setInverseName(String inverseName);
String FOREIGN_KEY_INVERSE_NAME = "inverseName"; //$NON-NLS-1$
-
- public void initialize(ForeignKeyAnnotation indexResource);
- public void update(ForeignKeyAnnotation indexResource);
+ ForeignKeyAnnotation getForeignKeyAnnotation();
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaManyToOneMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaManyToOneMapping.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaManyToOneMapping.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -54,51 +54,52 @@
@Override
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
- this.initializeForeignKey();
+ this.syncForeignKey();
}
@Override
public void update() {
super.update();
- this.updateForeignKey();
+ if (foreignKey != null){
+ this.foreignKey.update();
+ }
}
- // *** foreignKey
+ // ********************* foreignKey **************
- protected void initializeForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource != null) {
- this.foreignKey = buildForeignKey(foreignKeyResource);
- }
- }
-
- protected void updateForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource == null) {
+ protected void syncForeignKey() {
+ ForeignKeyAnnotation annotation = getForeignKeyAnnotation();
+ if (annotation == null) {
if (getForeignKey() != null) {
setForeignKey(null);
}
- } else {
+ }
+ else {
if (getForeignKey() == null) {
- setForeignKey(buildForeignKey(foreignKeyResource));
- } else {
- getForeignKey().update(foreignKeyResource);
+ setForeignKey(buildForeignKey(annotation));
}
+ else {
+ if ((this.foreignKey != null) && (this.foreignKey.getForeignKeyAnnotation() == annotation)) {
+ this.foreignKey.synchronizeWithResourceModel();
+ } else {
+ this.setForeignKey(this.buildForeignKey(annotation));
+ }
+ }
}
}
+ @Override
public ForeignKey addForeignKey() {
if (getForeignKey() != null) {
throw new IllegalStateException("foreignKey already exists"); //$NON-NLS-1$
}
- this.foreignKey = getJpaFactory().buildForeignKey(this);
- ForeignKeyAnnotation foreignKeyResource = (ForeignKeyAnnotation) getResourcePersistentAttribute()
- .addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
- this.foreignKey.initialize(foreignKeyResource);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, null, this.foreignKey);
+ ForeignKeyAnnotation annotation = (ForeignKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ ForeignKey foreignKey = buildForeignKey(annotation);
+ setForeignKey(foreignKey);
return this.foreignKey;
}
+ @Override
public ForeignKey getForeignKey() {
return this.foreignKey;
}
@@ -109,27 +110,26 @@
firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, newForeignKey);
}
+ @Override
public void removeForeignKey() {
if (getForeignKey() == null) {
- throw new IllegalStateException(
- "foreignKey does not exist, cannot be removed"); //$NON-NLS-1$
+ throw new IllegalStateException("foreignKey does not exist, cannot be removed"); //$NON-NLS-1$
}
- ForeignKey oldForeignKey = this.foreignKey;
- this.foreignKey = null;
- this.getResourcePersistentAttribute().removeAnnotation(
- ForeignKeyAnnotation.ANNOTATION_NAME);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, null);
+ this.getResourcePersistentAttribute().removeAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ setForeignKey(null);
}
+
+ protected ForeignKey buildForeignKey() {
+ ForeignKeyAnnotation annotation = this.getForeignKeyAnnotation();
+ return (annotation == null) ? null : this.buildForeignKey(annotation);
+ }
- protected ForeignKey buildForeignKey(ForeignKeyAnnotation foreignKeyResource) {
- ForeignKey foreignKey = getJpaFactory().buildForeignKey(this);
- foreignKey.initialize(foreignKeyResource);
- return foreignKey;
+ protected ForeignKey buildForeignKey(ForeignKeyAnnotation annotation) {
+ return getJpaFactory().buildForeignKey(this, annotation);
}
- protected ForeignKeyAnnotation getResourceForeignKey() {
- return (ForeignKeyAnnotation) this.getResourcePersistentAttribute()
- .getAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ protected ForeignKeyAnnotation getForeignKeyAnnotation() {
+ return (ForeignKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
}
public Table getForeignKeyDbTable() {
@@ -159,7 +159,7 @@
return;
}
}
- TextRange textRange = this.getResourceForeignKey().getNameTextRange(
+ TextRange textRange = this.getForeignKeyAnnotation().getNameTextRange(
astRoot);
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
Messages.UNRESOLVED_FOREIGN_KEY_NAME, new String[] {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaOneToOneMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaOneToOneMapping.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/AbstractHibernateJavaOneToOneMapping.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -53,51 +53,52 @@
@Override
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
- this.initializeForeignKey();
+ this.syncForeignKey();
}
@Override
public void update() {
super.update();
- this.updateForeignKey();
+ if (foreignKey != null){
+ this.foreignKey.update();
+ }
}
- // *** foreignKey
+ // ********************* foreignKey **************
- protected void initializeForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource != null) {
- this.foreignKey = buildForeignKey(foreignKeyResource);
- }
- }
-
- protected void updateForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource == null) {
+ protected void syncForeignKey() {
+ ForeignKeyAnnotation annotation = getForeignKeyAnnotation();
+ if (annotation == null) {
if (getForeignKey() != null) {
setForeignKey(null);
}
- } else {
+ }
+ else {
if (getForeignKey() == null) {
- setForeignKey(buildForeignKey(foreignKeyResource));
- } else {
- getForeignKey().update(foreignKeyResource);
+ setForeignKey(buildForeignKey(annotation));
}
+ else {
+ if ((this.foreignKey != null) && (this.foreignKey.getForeignKeyAnnotation() == annotation)) {
+ this.foreignKey.synchronizeWithResourceModel();
+ } else {
+ this.setForeignKey(this.buildForeignKey(annotation));
+ }
+ }
}
}
+ @Override
public ForeignKey addForeignKey() {
if (getForeignKey() != null) {
throw new IllegalStateException("foreignKey already exists"); //$NON-NLS-1$
}
- this.foreignKey = getJpaFactory().buildForeignKey(this);
- ForeignKeyAnnotation foreignKeyResource = (ForeignKeyAnnotation) getResourcePersistentAttribute()
- .addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
- this.foreignKey.initialize(foreignKeyResource);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, null, this.foreignKey);
+ ForeignKeyAnnotation annotation = (ForeignKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ ForeignKey foreignKey = buildForeignKey(annotation);
+ setForeignKey(foreignKey);
return this.foreignKey;
}
+ @Override
public ForeignKey getForeignKey() {
return this.foreignKey;
}
@@ -108,27 +109,26 @@
firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, newForeignKey);
}
+ @Override
public void removeForeignKey() {
if (getForeignKey() == null) {
- throw new IllegalStateException(
- "foreignKey does not exist, cannot be removed"); //$NON-NLS-1$
+ throw new IllegalStateException("foreignKey does not exist, cannot be removed"); //$NON-NLS-1$
}
- ForeignKey oldForeignKey = this.foreignKey;
- this.foreignKey = null;
- this.getResourcePersistentAttribute().removeAnnotation(
- ForeignKeyAnnotation.ANNOTATION_NAME);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, null);
+ this.getResourcePersistentAttribute().removeAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ setForeignKey(null);
}
+
+ protected ForeignKey buildForeignKey() {
+ ForeignKeyAnnotation annotation = this.getForeignKeyAnnotation();
+ return (annotation == null) ? null : this.buildForeignKey(annotation);
+ }
- protected ForeignKey buildForeignKey(ForeignKeyAnnotation foreignKeyResource) {
- ForeignKey foreignKey = getJpaFactory().buildForeignKey(this);
- foreignKey.initialize(foreignKeyResource);
- return foreignKey;
+ protected ForeignKey buildForeignKey(ForeignKeyAnnotation annotation) {
+ return getJpaFactory().buildForeignKey(this, annotation);
}
- protected ForeignKeyAnnotation getResourceForeignKey() {
- return (ForeignKeyAnnotation) this.getResourcePersistentAttribute()
- .getAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ protected ForeignKeyAnnotation getForeignKeyAnnotation() {
+ return (ForeignKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
}
public Table getForeignKeyDbTable() {
@@ -158,7 +158,7 @@
return;
}
}
- TextRange textRange = this.getResourceForeignKey().getNameTextRange(
+ TextRange textRange = this.getForeignKeyAnnotation().getNameTextRange(
astRoot);
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
Messages.UNRESOLVED_FOREIGN_KEY_NAME, new String[] {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/ForeignKeyImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/ForeignKeyImpl.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/ForeignKeyImpl.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -23,30 +23,28 @@
*/
public class ForeignKeyImpl extends AbstractJavaJpaContextNode implements ForeignKey {
- private ForeignKeyAnnotation foreignKeyResource;
+ private ForeignKeyAnnotation annotation;
private String name;
private String inverseName;
- public ForeignKeyImpl(JavaJpaContextNode parent) {
+ public ForeignKeyImpl(JavaJpaContextNode parent, ForeignKeyAnnotation annotation) {
super(parent);
+ this.annotation = annotation;
+ this.name = annotation.getName();
+ this.inverseName = annotation.getInverseName();
}
- public void initialize(ForeignKeyAnnotation foreignKeyResource) {
- this.foreignKeyResource = foreignKeyResource;
- this.name = foreignKeyResource.getName();
- this.inverseName = foreignKeyResource.getInverseName();
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(annotation.getName());
+ this.setInverseName(annotation.getInverseName());
}
- public void update(ForeignKeyAnnotation foreignKeyResource) {
- this.foreignKeyResource = foreignKeyResource;
- this.setName_(foreignKeyResource.getName());
- this.setInverseName_(foreignKeyResource.getInverseName());
- }
-
private ForeignKeyAnnotation getResourceForeignKey() {
- return foreignKeyResource;
+ return annotation;
}
// ***** name
@@ -88,7 +86,12 @@
}
public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.foreignKeyResource.getTextRange(astRoot);
+ return this.annotation.getTextRange(astRoot);
}
+ @Override
+ public ForeignKeyAnnotation getForeignKeyAnnotation() {
+ return annotation;
+ }
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -62,6 +62,7 @@
super(parent, mappingAnnotation);
this.discriminatorFormula = this.buildDiscriminatorFormula();
this.typeDefContainer = getJpaFactory().buildJavaTypeDefContainer(parent);
+ this.foreignKey = this.buildForeignKey();
this.cacheable = buildJavaCachable();
}
@@ -76,8 +77,8 @@
super.synchronizeWithResourceModel();
this.cacheable.synchronizeWithResourceModel();
this.typeDefContainer.synchronizeWithResourceModel();
- this.discriminatorFormula.synchronizeWithResourceModel();
- this.initializeForeignKey();
+ this.syncDiscriminatorFormula();
+ this.syncForeignKey();
}
@Override
@@ -85,8 +86,12 @@
super.update();
this.cacheable.update();
this.typeDefContainer.update();
- this.discriminatorFormula.update();
- this.updateForeignKey();
+ if (discriminatorFormula != null){
+ this.discriminatorFormula.update();
+ }
+ if (foreignKey != null){
+ this.foreignKey.update();
+ }
}
@Override
@@ -141,11 +146,12 @@
protected JavaDiscriminatorFormula buildDiscriminatorFormula() {
- return this.getJpaFactory().buildJavaDiscriminatorFormula(this, this.buildDiscriminatorFormulaOwner());
+ DiscriminatorFormulaAnnotation annotation = this.getDiscriminatorFormulaAnnotation();
+ return (annotation == null) ? null : this.buildDiscriminatorFormula(annotation);
}
- protected JavaDiscriminatorFormula.Owner buildDiscriminatorFormulaOwner() {
- return new DiscriminatorFormulaOwner();
+ protected DiscriminatorFormulaAnnotation buildDiscriminatorFormulaAnnotation() {
+ return (DiscriminatorFormulaAnnotation) this.getResourcePersistentType().addAnnotation(DiscriminatorFormulaAnnotation.ANNOTATION_NAME);
}
protected void setDiscriminatorFormula(JavaDiscriminatorFormula newDiscriminatorFormula) {
@@ -159,11 +165,10 @@
if (getDiscriminatorFormula() != null) {
throw new IllegalStateException("discriminatorFormula already exists"); //$NON-NLS-1$
}
- this.discriminatorFormula = getJpaFactory().buildJavaDiscriminatorFormula(this, buildDiscriminatorFormulaOwner());
- DiscriminatorFormulaAnnotation discriminatorFormulaResource = (DiscriminatorFormulaAnnotation) this.getResourcePersistentType().addAnnotation(DiscriminatorFormulaAnnotation.ANNOTATION_NAME);
- this.discriminatorFormula.initialize(discriminatorFormulaResource);
- firePropertyChanged(DISCRIMINATOR_FORMULA_PROPERTY, null, this.discriminatorFormula);
- return this.discriminatorFormula;
+ DiscriminatorFormulaAnnotation annotation = this.buildDiscriminatorFormulaAnnotation();
+ JavaDiscriminatorFormula discriminatorFormula = buildDiscriminatorFormula(annotation);
+ this.setDiscriminatorFormula(discriminatorFormula);
+ return discriminatorFormula;
}
@Override
@@ -171,67 +176,57 @@
if (getDiscriminatorFormula() == null) {
throw new IllegalStateException("discriminatorFormula does not exist, cannot be removed"); //$NON-NLS-1$
}
- JavaDiscriminatorFormula oldDiscriminatorFormula = this.discriminatorFormula;
- this.discriminatorFormula = null;
this.getResourcePersistentType().removeAnnotation(DiscriminatorFormulaAnnotation.ANNOTATION_NAME);
- firePropertyChanged(DISCRIMINATOR_FORMULA_PROPERTY, oldDiscriminatorFormula,null);
+ this.setDiscriminatorFormula(null);
}
- protected void initializeDiscriminatorFormula() {
- DiscriminatorFormulaAnnotation discriminatorFormulaResource = getDiscriminatorFormulaResource();
- if (discriminatorFormulaResource != null) {
- this.discriminatorFormula = buildDiscriminatorFormula(discriminatorFormulaResource);
- }
- }
-
- protected void updateDiscriminatorFormula() {
- DiscriminatorFormulaAnnotation discriminatorFormulaResource = getDiscriminatorFormulaResource();
- if (discriminatorFormulaResource == null) {
+ protected void syncDiscriminatorFormula() {
+ DiscriminatorFormulaAnnotation annotation = getDiscriminatorFormulaAnnotation();
+ if (annotation == null) {
if (getDiscriminatorFormula() != null) {
setDiscriminatorFormula(null);
}
}
else {
if (getDiscriminatorFormula() == null) {
- setDiscriminatorFormula(buildDiscriminatorFormula(discriminatorFormulaResource));
+ setDiscriminatorFormula(buildDiscriminatorFormula(annotation));
}
else {
- getDiscriminatorFormula().update(discriminatorFormulaResource);
+ if ((this.discriminatorFormula != null) && (this.discriminatorFormula.getDiscriminatorFormulaAnnotation() == annotation)) {
+ this.discriminatorFormula.synchronizeWithResourceModel();
+ } else {
+ this.setDiscriminatorFormula(this.buildDiscriminatorFormula(annotation));
+ }
}
}
}
- public DiscriminatorFormulaAnnotation getDiscriminatorFormulaResource() {
+ public DiscriminatorFormulaAnnotation getDiscriminatorFormulaAnnotation() {
return (DiscriminatorFormulaAnnotation) this.getResourcePersistentType().getAnnotation(DiscriminatorFormulaAnnotation.ANNOTATION_NAME);
}
- protected JavaDiscriminatorFormula buildDiscriminatorFormula(DiscriminatorFormulaAnnotation discriminatorFormulaResource) {
- JavaDiscriminatorFormula discriminatorFormula = getJpaFactory().buildJavaDiscriminatorFormula(this, buildDiscriminatorFormulaOwner());
- discriminatorFormula.initialize(discriminatorFormulaResource);
- return discriminatorFormula;
+ protected JavaDiscriminatorFormula buildDiscriminatorFormula(DiscriminatorFormulaAnnotation annotation) {
+ return getJpaFactory().buildJavaDiscriminatorFormula(this, annotation);
}
// ********************* foreignKey **************
- protected void initializeForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource != null) {
- this.foreignKey = buildForeignKey(foreignKeyResource);
- }
- }
-
- protected void updateForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource == null) {
+ protected void syncForeignKey() {
+ ForeignKeyAnnotation annotation = getForeignKeyAnnotation();
+ if (annotation == null) {
if (getForeignKey() != null) {
setForeignKey(null);
}
}
else {
if (getForeignKey() == null) {
- setForeignKey(buildForeignKey(foreignKeyResource));
+ setForeignKey(buildForeignKey(annotation));
}
else {
- getForeignKey().update(foreignKeyResource);
+ if ((this.foreignKey != null) && (this.foreignKey.getForeignKeyAnnotation() == annotation)) {
+ this.foreignKey.synchronizeWithResourceModel();
+ } else {
+ this.setForeignKey(this.buildForeignKey(annotation));
+ }
}
}
}
@@ -241,10 +236,9 @@
if (getForeignKey() != null) {
throw new IllegalStateException("foreignKey already exists"); //$NON-NLS-1$
}
- this.foreignKey = getJpaFactory().buildForeignKey(this);
- ForeignKeyAnnotation foreignKeyResource = (ForeignKeyAnnotation) this.getResourcePersistentType().addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
- this.foreignKey.initialize(foreignKeyResource);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, null, this.foreignKey);
+ ForeignKeyAnnotation annotation = (ForeignKeyAnnotation) this.getResourcePersistentType().addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ ForeignKey foreignKey = buildForeignKey(annotation);
+ setForeignKey(foreignKey);
return this.foreignKey;
}
@@ -264,19 +258,20 @@
if (getForeignKey() == null) {
throw new IllegalStateException("foreignKey does not exist, cannot be removed"); //$NON-NLS-1$
}
- ForeignKey oldForeignKey = this.foreignKey;
- this.foreignKey = null;
this.getResourcePersistentType().removeAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, null);
+ setForeignKey(null);
}
+
+ protected ForeignKey buildForeignKey() {
+ ForeignKeyAnnotation annotation = this.getForeignKeyAnnotation();
+ return (annotation == null) ? null : this.buildForeignKey(annotation);
+ }
- protected ForeignKey buildForeignKey(ForeignKeyAnnotation foreignKeyResource) {
- ForeignKey foreignKey = getJpaFactory().buildForeignKey(this);
- foreignKey.initialize(foreignKeyResource);
- return foreignKey;
+ protected ForeignKey buildForeignKey(ForeignKeyAnnotation annotation) {
+ return getJpaFactory().buildForeignKey(this, annotation);
}
- protected ForeignKeyAnnotation getResourceForeignKey() {
+ protected ForeignKeyAnnotation getForeignKeyAnnotation() {
return (ForeignKeyAnnotation) this.getResourcePersistentType().getAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
}
@@ -310,7 +305,7 @@
return;
}
}
- TextRange textRange = this.getResourceForeignKey().getNameTextRange(astRoot);
+ TextRange textRange = this.getForeignKeyAnnotation().getNameTextRange(astRoot);
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
Messages.UNRESOLVED_FOREIGN_KEY_NAME, new String[] {this.foreignKey.getName(), getPrimaryTableName()},
this.foreignKey);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -61,54 +61,52 @@
@Override
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
- this.initializeForeignKey();
+ this.syncForeignKey();
}
@Override
public void update() {
super.update();
- this.updateForeignKey();
+ if (foreignKey != null){
+ this.foreignKey.update();
+ }
}
+ // ********************* foreignKey **************
-
- // *** foreignKey
-
- protected void initializeForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource != null) {
- this.foreignKey = buildForeignKey(foreignKeyResource);
- }
- }
-
- protected void updateForeignKey() {
- ForeignKeyAnnotation foreignKeyResource = getResourceForeignKey();
- if (foreignKeyResource == null) {
+ protected void syncForeignKey() {
+ ForeignKeyAnnotation annotation = getForeignKeyAnnotation();
+ if (annotation == null) {
if (getForeignKey() != null) {
setForeignKey(null);
}
}
else {
if (getForeignKey() == null) {
- setForeignKey(buildForeignKey(foreignKeyResource));
+ setForeignKey(buildForeignKey(annotation));
}
else {
- getForeignKey().update(foreignKeyResource);
+ if ((this.foreignKey != null) && (this.foreignKey.getForeignKeyAnnotation() == annotation)) {
+ this.foreignKey.synchronizeWithResourceModel();
+ } else {
+ this.setForeignKey(this.buildForeignKey(annotation));
+ }
}
}
}
+ @Override
public ForeignKey addForeignKey() {
if (getForeignKey() != null) {
throw new IllegalStateException("foreignKey already exists"); //$NON-NLS-1$
}
- this.foreignKey = getJpaFactory().buildForeignKey(this);
- ForeignKeyAnnotation foreignKeyResource = (ForeignKeyAnnotation) getResourcePersistentAttribute().addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
- this.foreignKey.initialize(foreignKeyResource);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, null, this.foreignKey);
+ ForeignKeyAnnotation annotation = (ForeignKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
+ ForeignKey foreignKey = buildForeignKey(annotation);
+ setForeignKey(foreignKey);
return this.foreignKey;
}
+ @Override
public ForeignKey getForeignKey() {
return this.foreignKey;
}
@@ -119,23 +117,25 @@
firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, newForeignKey);
}
+ @Override
public void removeForeignKey() {
if (getForeignKey() == null) {
throw new IllegalStateException("foreignKey does not exist, cannot be removed"); //$NON-NLS-1$
}
- ForeignKey oldForeignKey = this.foreignKey;
- this.foreignKey = null;
this.getResourcePersistentAttribute().removeAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
- firePropertyChanged(FOREIGN_KEY_PROPERTY, oldForeignKey, null);
+ setForeignKey(null);
}
+
+ protected ForeignKey buildForeignKey() {
+ ForeignKeyAnnotation annotation = this.getForeignKeyAnnotation();
+ return (annotation == null) ? null : this.buildForeignKey(annotation);
+ }
- protected ForeignKey buildForeignKey(ForeignKeyAnnotation foreignKeyResource) {
- ForeignKey foreignKey = getJpaFactory().buildForeignKey(this);
- foreignKey.initialize(foreignKeyResource);
- return foreignKey;
+ protected ForeignKey buildForeignKey(ForeignKeyAnnotation annotation) {
+ return getJpaFactory().buildForeignKey(this, annotation);
}
- protected ForeignKeyAnnotation getResourceForeignKey() {
+ protected ForeignKeyAnnotation getForeignKeyAnnotation() {
return (ForeignKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(ForeignKeyAnnotation.ANNOTATION_NAME);
}
@@ -162,7 +162,7 @@
return;
}
}
- TextRange textRange = this.getResourceForeignKey().getNameTextRange(astRoot);
+ TextRange textRange = this.getForeignKeyAnnotation().getNameTextRange(astRoot);
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
Messages.UNRESOLVED_FOREIGN_KEY_NAME, new String[] {this.foreignKey.getName(), getTypeMapping().getPrimaryTableName()},
this.foreignKey);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormula.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormula.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormula.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -19,16 +19,9 @@
*/
public interface JavaDiscriminatorFormula extends DiscriminatorFormula {
+ DiscriminatorFormulaAnnotation getDiscriminatorFormulaAnnotation();
- void initialize(DiscriminatorFormulaAnnotation dfResource);
-
/**
- * Update the JavaDiscriminatorFormula context model object to match the DiscriminatorFormulaAnnotation
- * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
- */
- void update(DiscriminatorFormulaAnnotation dfResource);
-
- /**
* interface allowing formulas to be used in multiple places
*/
interface Owner
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormulaImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormulaImpl.java 2011-04-04 13:51:51 UTC (rev 30266)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaDiscriminatorFormulaImpl.java 2011-04-04 13:59:30 UTC (rev 30267)
@@ -25,44 +25,46 @@
protected String value;
- protected DiscriminatorFormulaAnnotation dfResource;
+ protected DiscriminatorFormulaAnnotation annotation;
- protected JavaDiscriminatorFormula.Owner owner;
-
- public JavaDiscriminatorFormulaImpl(JpaContextNode parent, JavaDiscriminatorFormula.Owner owner) {
+ public JavaDiscriminatorFormulaImpl(JpaContextNode parent, DiscriminatorFormulaAnnotation annotation) {
super(parent);
- this.owner = owner;
+ this.annotation = annotation;
}
- public void initialize(DiscriminatorFormulaAnnotation dfResource) {
- this.dfResource = dfResource;
- this.value = dfResource.getValue();
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setValue_(annotation.getValue());
}
- public void update(DiscriminatorFormulaAnnotation dfResource) {
- this.dfResource = dfResource;
- this.setValue(dfResource.getValue());
- }
-
//******************* value *********************
public String getValue() {
return this.value;
}
-
- public void setValue(String newValue) {
+
+ public void setValue_(String newValue) {
String oldValue = this.value;
this.value = newValue;
- this.dfResource.setValue(newValue);
firePropertyChanged(DiscriminatorFormula.VALUE_PROPERTY, oldValue, newValue);
}
+ public void setValue(String newValue) {
+ this.annotation.setValue(newValue);
+ setValue_(newValue);
+ }
public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.dfResource.getTextRange(astRoot);
+ return this.annotation.getTextRange(astRoot);
}
@Override
public void toString(StringBuilder sb) {
sb.append(this.value);
}
+
+ @Override
+ public DiscriminatorFormulaAnnotation getDiscriminatorFormulaAnnotation() {
+ return annotation;
+ }
}
13 years, 2 months
JBoss Tools SVN: r30266 - trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-04-04 09:51:51 -0400 (Mon, 04 Apr 2011)
New Revision: 30266
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-8675 : VPE JUnits fail because of different style values for different XULRunner versions
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-04-04 13:50:17 UTC (rev 30265)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-04-04 13:51:51 UTC (rev 30266)
@@ -18,6 +18,7 @@
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -26,6 +27,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jboss.tools.common.model.ui.util.StringUtil;
import org.jboss.tools.common.model.util.XMLUtil;
import org.jboss.tools.jst.css.common.CSSStyleManager;
import org.jboss.tools.vpe.editor.util.Constants;
@@ -257,108 +259,139 @@
* compareComplexStrings(..) method.
* For "style" attribute there is a separate comparison.
*/
- boolean performComplexStringsComparison = true;
- if (HTML.ATTR_STYLE.equalsIgnoreCase(name)) {
- String xmlAttrValue = modelAttr.getNodeValue();
- /*
- * Check if it is not a regular expression.
- * Otherwise perform Complex Strings Comparison
- * as usual.
- */
- if (!(xmlAttrValue.startsWith(START_REGEX)
- && xmlAttrValue.endsWith(END_REGEX))) {
- performComplexStringsComparison = false;
- /*
- * Parse style attribute value
- */
- Map<String, String> vpeStyle = CSSStyleManager
- .getStyleAttributes(vpeAttr.getNodeValue());
- Map<String, String> xmlStyle = CSSStyleManager
- .getStyleAttributes(xmlAttrValue);
- /*
- * Major condition is that
- * all styles from the xml file should present
- * in the style attribute of the vpe element.
- */
- if (xmlStyle.size() > vpeStyle.size()) {
+ String xmlAttrValue = modelAttr.getNodeValue();
+ boolean performRegExComparison =
+ xmlAttrValue.startsWith(START_REGEX)
+ && xmlAttrValue.endsWith(END_REGEX);
+ if (HTML.ATTR_STYLE.equalsIgnoreCase(name) && !performRegExComparison) {
+ compareStyle(modelAttr, vpeAttr);
+ } else if (performRegExComparison) {
+ compareRegExAttribute(modelAttr, vpeAttr);
+ } else { // perform simple comparison
+ String modelString = modelAttr.getNodeValue().trim();
+ String vpeString = vpeAttr.getNodeValue().trim();
+ if (!modelString.equals(vpeString)) {
+ throw new DOMComparisonException("string is\"" + vpeString //$NON-NLS-1$
+ + "\" but must be \"" + modelString + "\"", modelAttr); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ }
+ }
+
+ private static void compareStyle(Attr modelAttr, nsIDOMAttr vpeAttr)
+ throws DOMComparisonException {
+ /*
+ * Parse style attribute value
+ */
+ Map<String, String> vpeStyle = CSSStyleManager
+ .getStyleAttributes(vpeAttr.getNodeValue());
+ Map<String, String> xmlStyle = CSSStyleManager
+ .getStyleAttributes(modelAttr.getNodeValue());
+ /*
+ * Major condition is that
+ * all styles from the xml file should present
+ * in the style attribute of the vpe element.
+ */
+ if (xmlStyle.size() > vpeStyle.size()) {
+ throw new DOMComparisonException(
+ "VPE element has less style parameters [" //$NON-NLS-1$
+ + vpeStyle.size()
+ + "] than was specified [" //$NON-NLS-1$
+ + xmlStyle.size() + "]." //$NON-NLS-1$
+ + "\n Expected: " + xmlStyle //$NON-NLS-1$
+ + "\n Was: " + vpeStyle, //$NON-NLS-1$
+ modelAttr);
+ } else {
+ if ((xmlStyle.size() > 0) && (vpeStyle.size() > 0)) {
+ for (String key : xmlStyle.keySet()) {
+ if (vpeStyle.containsKey(key)) {
+ if (!areStylePropertiesEqual(xmlStyle.get(key), vpeStyle.get(key))) {
throw new DOMComparisonException(
- "VPE element has less style parameters [" //$NON-NLS-1$
- + vpeStyle.size()
- + "] than was specified [" //$NON-NLS-1$
- + xmlStyle.size() + "]." //$NON-NLS-1$
- + "\n Expected: " + xmlStyle //$NON-NLS-1$
- + "\n Was: " + vpeStyle, //$NON-NLS-1$
- modelAttr);
- } else {
- if ((xmlStyle.size() > 0) && (vpeStyle.size() > 0)) {
- for (String key : xmlStyle.keySet()) {
- if (vpeStyle.containsKey(key)) {
- if (!xmlStyle.get(key).equalsIgnoreCase(
- vpeStyle.get(key))) {
- throw new DOMComparisonException(
- "Style value for parameter [" //$NON-NLS-1$
- + key
- + "] is different. Expected [" //$NON-NLS-1$
- + xmlStyle.get(key)
- + "] but was [" //$NON-NLS-1$
- + vpeStyle.get(key)
- + "]", modelAttr); //$NON-NLS-1$
- }
- } else {
- throw new DOMComparisonException(
- "Style parameter [" //$NON-NLS-1$
- + key
- + "] is missing in the VPE element", //$NON-NLS-1$
- modelAttr);
- }
- }
- }
+ "Style value for parameter [" //$NON-NLS-1$
+ + key
+ + "] is different. Expected [" //$NON-NLS-1$
+ + xmlStyle.get(key)
+ + "] but was [" //$NON-NLS-1$
+ + vpeStyle.get(key)
+ + "]", modelAttr); //$NON-NLS-1$
}
+ } else {
+ throw new DOMComparisonException(
+ "Style parameter [" //$NON-NLS-1$
+ + key
+ + "] is missing in the VPE element", //$NON-NLS-1$
+ modelAttr);
}
}
- if (performComplexStringsComparison) {
- compareComplexAttributes(modelAttr, vpeAttr);
- }
}
}
}
- static private void compareComplexAttributes(Attr modelAttr, nsIDOMAttr vpeAttr)
+ /**
+ * Compares style properties, performing comparisons word by word.
+ *
+ * So the property {@code "grey none repeat scroll 0% 0%"} will be equal
+ * to {@code "none repeat scroll 0% 0% grey"}
+ */
+ private static boolean areStylePropertiesEqual(String property1, String property2) {
+ List<String> propertyParts1 = splitAndSort(property1);
+ List<String> propertyParts2 = splitAndSort(property2);
+
+ if (propertyParts1.size() != propertyParts2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < propertyParts1.size(); i++) {
+ if (!propertyParts1.get(i).equals(propertyParts2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static List<String> splitAndSort(String property) {
+ List<String> propertyParts = new ArrayList<String>();
+ for (String propertyPart : property.split("[\\s]+")) {
+ if (!propertyPart.isEmpty()) {
+ propertyParts.add(propertyPart);
+ }
+ }
+ Collections.sort(propertyParts);
+
+ return propertyParts;
+ }
+
+ static private void compareRegExAttribute(Attr modelAttr, nsIDOMAttr vpeAttr)
throws DOMComparisonException {
String modelString = modelAttr.getNodeValue().trim();
String vpeString = vpeAttr.getNodeValue().trim();
- if (modelString.startsWith(START_REGEX)
- && modelString.endsWith(END_REGEX)) {
- String regex = modelString.substring(START_REGEX.length(),
- modelString.length() - END_REGEX.length());
- int firstPos = regex.indexOf("url\\("); //$NON-NLS-1$
- if (firstPos > -1) {
- String subString = regex.substring(firstPos + 5, firstPos + 5 + 2);
- if (!"\"?".equalsIgnoreCase(subString)) { //$NON-NLS-1$
- String firstPart = regex.substring(0, firstPos + 5);
- String secondPart = regex.substring(firstPos + 5, regex.length());
- int lastPos = secondPart.indexOf("\\)"); //$NON-NLS-1$
- if (lastPos > -1) {
- String subs = secondPart.substring(lastPos - 2, lastPos);
- if (!"\"?".equalsIgnoreCase(subs)) { //$NON-NLS-1$
- String fpart = secondPart.substring(0, lastPos);
- String spart = secondPart.substring(lastPos, secondPart.length());
- regex = firstPart + "\"?" + fpart + "\"?" + spart; //$NON-NLS-1$ //$NON-NLS-2$
- }
+ String regex = modelString.substring(START_REGEX.length(),
+ modelString.length() - END_REGEX.length());
+ int firstPos = regex.indexOf("url\\("); //$NON-NLS-1$
+ if (firstPos > -1) {
+ String subString = regex.substring(firstPos + 5, firstPos + 5 + 2);
+ if (!"\"?".equalsIgnoreCase(subString)) { //$NON-NLS-1$
+ String firstPart = regex.substring(0, firstPos + 5);
+ String secondPart = regex.substring(firstPos + 5, regex.length());
+ int lastPos = secondPart.indexOf("\\)"); //$NON-NLS-1$
+ if (lastPos > -1) {
+ String subs = secondPart.substring(lastPos - 2, lastPos);
+ if (!"\"?".equalsIgnoreCase(subs)) { //$NON-NLS-1$
+ String fpart = secondPart.substring(0, lastPos);
+ String spart = secondPart.substring(lastPos, secondPart.length());
+ regex = firstPart + "\"?" + fpart + "\"?" + spart; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
- Matcher matcher = Pattern.compile(regex).matcher(vpeString);
- if (!matcher.find()) {
- throw new DOMComparisonException("string is\"" + vpeString //$NON-NLS-1$
- + "\" but pattern is \"" + regex + "\"", modelAttr); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else if (!modelString.equals(vpeString)) {
+ }
+ Matcher matcher = Pattern.compile(regex).matcher(vpeString);
+ if (!matcher.find()) {
throw new DOMComparisonException("string is\"" + vpeString //$NON-NLS-1$
- + "\" but must be \"" + modelString + "\"", modelAttr); //$NON-NLS-1$ //$NON-NLS-2$
+ + "\" but pattern is \"" + regex + "\"", modelAttr); //$NON-NLS-1$ //$NON-NLS-2$
}
-
}
/**
13 years, 2 months
JBoss Tools SVN: r30265 - trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-04-04 09:50:17 -0400 (Mon, 04 Apr 2011)
New Revision: 30265
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF
Log:
JBIDE-8676 org.jboss.ide.eclipse.as.test unnecessarily requires org.eclipse.jpt.core
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF 2011-04-04 09:15:11 UTC (rev 30264)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/META-INF/MANIFEST.MF 2011-04-04 13:50:17 UTC (rev 30265)
@@ -40,8 +40,7 @@
org.jboss.ide.eclipse.as.classpath.ui,
org.jboss.ide.eclipse.as.wtp.core,
org.jboss.ide.eclipse.as.wtp.ui,
- org.eclipse.jst.jsf.core,
- org.eclipse.jpt.core
+ org.eclipse.jst.jsf.core
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
13 years, 2 months
JBoss Tools SVN: r30264 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-04 05:15:11 -0400 (Mon, 04 Apr 2011)
New Revision: 30264
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
[JBIDE-8668] updating driver state on each test if driver is UNKNOWN
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-04-04 09:09:32 UTC (rev 30263)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-04-04 09:15:11 UTC (rev 30264)
@@ -1,5 +1,35 @@
+2011-04-01 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (updateDriver):
+ (isValid):
+ (isKnownDriver):
+ [JBIDE-8668] updating driver state on each test if driver is UNKNOWN
+
2011-03-24 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (areImagesLoaded):
+ (imagesRepo):
+ (getImages):
+ (getInstances):
+ (instancesLoaded):
+ (getImage):
+ [JBIDE-8102] now loading all images before querying server for a single image
+
+ * src/org/jboss/tools/deltacloud/core/InstanceFilter.java
+ (matches):
+ (aliasRule):
+ (setRules):
+ (toString):
+ (getAliasRule):
+ * src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
+ (ALL_STRING):
+ (getAliasRule):
+ * src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java
+ (getAliasRule):
+ [JBIDE-8187] added capability to filter instance on behalf of alias
+
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
(getActions):
(Action.getByName):
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-04-04 09:09:32 UTC (rev 30263)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-04-04 09:15:11 UTC (rev 30264)
@@ -74,7 +74,8 @@
public DeltaCloud(String name, String url, String username, String password, Driver driver)
throws DeltaCloudException {
- this(name, url, username, password, driver, IImageFilter.ALL_STRING, IInstanceFilter.ALL_STRING, new ArrayList<IInstanceAliasMapping>());
+ this(name, url, username, password, driver, IImageFilter.ALL_STRING, IInstanceFilter.ALL_STRING,
+ new ArrayList<IInstanceAliasMapping>());
}
public DeltaCloud(String name, String url, String username, Driver driver, String imageFilterRules,
@@ -189,7 +190,32 @@
return driver;
}
+ private void updateDriver() {
+ try {
+ Driver driver = getServerDriver(url);
+ this.driver = driver;
+ } catch (DeltaCloudException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * Returns if this cloud points to a known cloud type. The implementation
+ * checks the driver type which will be valid if the url is a valid and
+ * known cloud. The credentials are not checked.
+ *
+ * @return <code>true</code> if this cloud is a known type
+ */
public boolean isValid() {
+ boolean isValid = isKnownDriver();
+ if (!isValid) {
+ updateDriver();
+ isValid = isKnownDriver();
+ }
+ return isValid;
+ }
+
+ protected boolean isKnownDriver() {
return driver != null
&& driver != Driver.UNKNOWN;
}
@@ -328,7 +354,7 @@
if (instance != null) {
while (!pm.isCanceled()) {
Thread.sleep(WAIT_FOR_STATE_DELAY);
- instance = refreshInstance(instance);
+ instance = refreshInstance(instance);
if (stateMatcher.matchesState(instance, instance.getState())
|| instance.getState().equals(DeltaCloudInstance.State.TERMINATED)) {
return instance;
@@ -416,6 +442,7 @@
Image image = client.listImages(id);
deltaCloudImage = DeltaCloudImageFactory.create(image, this);
images.add(deltaCloudImage);
+ updateDriver();
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(MessageFormat.format("Cloud not find image with id \"{0}\"", id), e);
}
13 years, 2 months
JBoss Tools SVN: r30263 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/internal/deltacloud/ui/preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-04 05:09:32 -0400 (Mon, 04 Apr 2011)
New Revision: 30263
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/preferences/IPreferenceKeys.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
Log:
[JBIDE-8259] storing/restoring last used cloud name and username from preferences
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-04-04 07:37:21 UTC (rev 30262)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-04-04 09:09:32 UTC (rev 30263)
@@ -1,3 +1,22 @@
+2011-04-04 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java (performFinish):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java (performFinish):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java (createControl):
+ * src/org/jboss/tools/internal/deltacloud/ui/preferences/IPreferenceKeys.java
+ (LAST_NAME):
+ (LAST_USERNAME):
+ [JBIDE-8259] storing/restoring last used cloud name and username from preferences
+
+2011-04-01 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * plugin.xml:
+ [JBIDE-8662] removed visibility rule for "Launch instance" in cloud viewer
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java
+ (prependHttp):
+ (CloudConnectionPageModel):
+ [JBIDE-8599] prepending "http://" if url is empty
+
2011-03-31 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceFromAnyImageHandler.java:
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/preferences/IPreferenceKeys.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/preferences/IPreferenceKeys.java 2011-04-04 07:37:21 UTC (rev 30262)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/preferences/IPreferenceKeys.java 2011-04-04 09:09:32 UTC (rev 30263)
@@ -12,6 +12,8 @@
public class IPreferenceKeys {
+ public static final String LAST_NAME = "org.jboss.tools.internal.deltacloud.ui.wizards.LAST_NAME";
public static final String LAST_URL = "org.jboss.tools.internal.deltacloud.ui.wizards.LAST_CREATED_URL";
+ public static final String LAST_USERNAME = "org.jboss.tools.internal.deltacloud.ui.wizards.LAST_USERNAME";
}
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2011-04-04 07:37:21 UTC (rev 30262)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2011-04-04 09:09:32 UTC (rev 30263)
@@ -316,12 +316,19 @@
nameLabel.setText(WizardMessages.getString(NAME_LABEL));
Text nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
bindName(dbc, nameText);
+ String name =
+ new StringPreferenceValue(IPreferenceKeys.LAST_NAME, Activator.PLUGIN_ID).get(nameText.getText());
+
+ nameText.setText(name);
// url
Label urlLabel = new Label(container, SWT.NULL);
urlLabel.setText(WizardMessages.getString(URL_LABEL));
Point p1 = urlLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Text urlText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ String url =
+ new StringPreferenceValue(IPreferenceKeys.LAST_URL, Activator.PLUGIN_ID).get(urlText.getText());
+ connectionModel.setUrl(url);
dbc.bindValue(
WidgetProperties.text(SWT.Modify).observe(urlText),
@@ -346,12 +353,6 @@
new ControlDecorationAdapter(decoration, (IStatus) validationStatusProvider.getValue()),
typeLabelBinding.getValidationStatus(), urlText);
-
- // set url from preferences
- String url =
- new StringPreferenceValue(IPreferenceKeys.LAST_URL, Activator.PLUGIN_ID).get(urlText.getText());
- urlText.setText(url);
-
// username
Label usernameLabel = new Label(container, SWT.NULL);
usernameLabel.setText(WizardMessages.getString(USERNAME_LABEL));
@@ -361,7 +362,10 @@
usernameObservable,
BeanProperties.value(CloudConnectionPageModel.class, CloudConnectionPageModel.PROPERTY_USERNAME)
.observe(connectionModel));
-
+ String username =
+ new StringPreferenceValue(IPreferenceKeys.LAST_USERNAME, Activator.PLUGIN_ID).get(usernameText.getText());
+ usernameText.setText(username);
+
// password
Label passwordLabel = new Label(container, SWT.NULL);
passwordLabel.setText(WizardMessages.getString(PASSWORD_LABEL));
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2011-04-04 07:37:21 UTC (rev 30262)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2011-04-04 09:09:32 UTC (rev 30263)
@@ -19,6 +19,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.Driver;
import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.internal.deltacloud.ui.preferences.IPreferenceKeys;
+import org.jboss.tools.internal.deltacloud.ui.preferences.StringPreferenceValue;
import org.jboss.tools.internal.deltacloud.ui.utils.WizardUtils;
/**
@@ -41,8 +44,17 @@
@Override
public boolean performFinish() {
String name = mainPage.getModel().getName();
+ new StringPreferenceValue(IPreferenceKeys.LAST_NAME, Activator.PLUGIN_ID)
+ .store(name);
+
String url = mainPage.getModel().getUrl();
+ new StringPreferenceValue(IPreferenceKeys.LAST_URL, Activator.PLUGIN_ID)
+ .store(url);
+
String username = mainPage.getModel().getUsername();
+ new StringPreferenceValue(IPreferenceKeys.LAST_USERNAME, Activator.PLUGIN_ID)
+ .store(username);
+
String password = mainPage.getModel().getPassword();
Driver driver = mainPage.getModel().getDriver();
return editCloud(initialCloud, name, url, username, password, driver);
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2011-04-04 07:37:21 UTC (rev 30262)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2011-04-04 09:09:32 UTC (rev 30263)
@@ -109,12 +109,17 @@
@Override
public boolean performFinish() {
String name = mainPage.getModel().getName();
+ new StringPreferenceValue(IPreferenceKeys.LAST_NAME, Activator.PLUGIN_ID)
+ .store(name);
+
String url = mainPage.getModel().getUrl();
-
new StringPreferenceValue(IPreferenceKeys.LAST_URL, Activator.PLUGIN_ID)
.store(url);
String username = mainPage.getModel().getUsername();
+ new StringPreferenceValue(IPreferenceKeys.LAST_USERNAME, Activator.PLUGIN_ID)
+ .store(username);
+
String password = mainPage.getModel().getPassword();
Driver driver = mainPage.getModel().getDriver();
@@ -122,7 +127,7 @@
}
private boolean createCloud(final String name, final String url, final String username, final String password,
- final Driver driver) {
+ final Driver driver) {
Job job = new Job(WizardMessages.getFormattedString("CloudConnection.msg", name)) {
@Override
13 years, 2 months
JBoss Tools SVN: r30262 - trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-04-04 03:37:21 -0400 (Mon, 04 Apr 2011)
New Revision: 30262
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
Log:
* new BPEL SWTBot test
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java 2011-04-04 07:36:14 UTC (rev 30261)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java 2011-04-04 07:37:21 UTC (rev 30262)
@@ -1,28 +1,21 @@
package org.jboss.tools.bpel.ui.bot.test;
import org.eclipse.core.resources.IFile;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Table;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.bpel.ui.bot.test.suite.BPELTest;
import org.jboss.tools.bpel.ui.bot.test.util.ResourceHelper;
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
import org.jboss.tools.ui.bot.ext.view.ServersView;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-
+/**
+ *
+ * @author psrna
+ *
+ */
@SWTBotTestRequires(perspective="BPEL Perspective")
public class OdeDeployTest extends BPELTest {
13 years, 2 months
JBoss Tools SVN: r30261 - in trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test: projects/bpel_say_hello and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-04-04 03:36:14 -0400 (Mon, 04 Apr 2011)
New Revision: 30261
Added:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.project
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.component
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHello.bpel
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHelloArtifacts.wsdl
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/build.xml
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/messages/
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/messages/sayHello_request.xml
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/readme.txt
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELAllTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELTest.java
Log:
* new BPEL SWTBot test
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.project
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.project (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.project 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>say_hello</name>
+ <comment></comment>
+ <projects>
+ <project>HelloWorld</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.bpel.validator.builder</name>
+ <arguments>
+ <dictionary>
+ <key>debug</key>
+ <value>false</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.component (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.component 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="say_hello">
+ <wb-resource deploy-path="/" source-path="/bpelContent"/>
+ <dependent-module deploy-path="/" handle="module:/org.jboss.ide.eclipse.as.wtp.core.vcf.outputFolders/">
+ <dependency-type>consumes</dependency-type>
+ </dependent-module>
+ </wb-module>
+</project-modules>
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.project.facet.core.xml 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <fixed facet="jbt.bpel.facet.core"/>
+ <installed facet="jbt.bpel.facet.core" version="2.0"/>
+</faceted-project>
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHello.bpel
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHello.bpel (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHello.bpel 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,81 @@
+<!-- HelloWorld BPEL Process [Generated by the Eclipse BPEL Designer] -->
+<bpel:process name="HelloWorld"
+ targetNamespace="http://www.jboss.org/bpel/examples"
+ suppressJoinFailure="yes"
+ xmlns:tns="http://www.jboss.org/bpel/examples"
+ xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ >
+
+ <!-- Import the client WSDL -->
+ <bpel:import location="SayHelloArtifacts.wsdl" namespace="http://www.jboss.org/bpel/examples"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <!-- ================================================================= -->
+ <!-- PARTNERLINKS -->
+ <!-- List of services participating in this BPEL process -->
+ <!-- ================================================================= -->
+ <bpel:partnerLinks>
+ <!-- The 'client' role represents the requester of this service. -->
+ <bpel:partnerLink name="client"
+ partnerLinkType="tns:SayHello"
+ myRole="SayHelloProvider"
+ />
+ </bpel:partnerLinks>
+
+ <!-- ================================================================= -->
+ <!-- VARIABLES -->
+ <!-- List of messages and XML documents used within this BPEL process -->
+ <!-- ================================================================= -->
+ <bpel:variables>
+ <!-- Reference to the message passed as input during initiation -->
+ <bpel:variable name="ReceiveSayHelloVar"
+ messageType="tns:SayHelloRequestMessage"/>
+
+ <!--
+ Reference to the message that will be returned to the requester
+ -->
+ <bpel:variable name="ReplySayHelloVar"
+ messageType="tns:SayHelloResponseMessage"/>
+ </bpel:variables>
+
+ <!-- ================================================================= -->
+ <!-- ORCHESTRATION LOGIC -->
+ <!-- Set of activities coordinating the flow of messages across the -->
+ <!-- services integrated within this business process -->
+ <!-- ================================================================= -->
+ <bpel:sequence name="main">
+
+ <!-- Receive input from requester.
+ Note: This maps to operation defined in HelloWorld.wsdl
+ -->
+ <bpel:receive name="ReceiveSayHello" partnerLink="client"
+ portType="tns:SayHello"
+ operation="sayHello" variable="ReceiveSayHelloVar"
+ createInstance="yes"/>
+
+ <!-- Generate reply to synchronous request -->
+ <bpel:assign validate="no" name="AssignName">
+ <bpel:copy>
+ <bpel:from><bpel:literal><tns:HelloWorldResponse xmlns:tns="http://www.jboss.org/bpel/examples" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <tns:result></tns:result>
+</tns:HelloWorldResponse>
+</bpel:literal></bpel:from>
+ <bpel:to variable="ReplySayHelloVar" part="parameters"></bpel:to>
+ </bpel:copy>
+ <bpel:copy>
+ <bpel:from>
+ <![CDATA[concat('Hello ', $ReceiveSayHelloVar.parameters/tns:input)]]>
+ </bpel:from>
+ <bpel:to part="parameters" variable="ReplySayHelloVar">
+ <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
+ </bpel:to>
+ </bpel:copy>
+ </bpel:assign>
+ <bpel:reply name="ReplySayHello"
+ partnerLink="client"
+ portType="tns:SayHello"
+ operation="sayHello"
+ variable="ReplySayHelloVar"
+ />
+ </bpel:sequence>
+</bpel:process>
\ No newline at end of file
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHelloArtifacts.wsdl
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHelloArtifacts.wsdl (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHelloArtifacts.wsdl 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<definitions name="SayHello"
+ targetNamespace="http://www.jboss.org/bpel/examples"
+ xmlns:tns="http://www.jboss.org/bpel/examples"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ TYPE DEFINITION - List of types participating in this BPEL process
+ The BPEL Designer will generate default request and response types
+ but you can define or import any XML Schema type and use them as part
+ of the message types.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <types>
+ <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
+ targetNamespace="http://www.jboss.org/bpel/examples"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="SayHelloRequest">
+ <complexType>
+ <sequence>
+ <element name="input" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="SayHelloResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ MESSAGE TYPE DEFINITION - Definition of the message types used as
+ part of the port type defintions
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <message name="SayHelloRequestMessage">
+ <part name="parameters" element="tns:SayHelloRequest"/>
+ </message>
+ <message name="SayHelloResponseMessage">
+ <part name="parameters" element="tns:SayHelloResponse"/>
+ </message>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ PORT TYPE DEFINITION - A port type groups a set of operations into
+ a logical service unit.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <!-- portType implemented by the HelloWorld BPEL process -->
+ <portType name="SayHello">
+ <operation name="sayHello">
+ <input message="tns:SayHelloRequestMessage" />
+ <output message="tns:SayHelloResponseMessage"/>
+ </operation>
+ </portType>
+
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ PARTNER LINK TYPE DEFINITION
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <plnk:partnerLinkType name="SayHello">
+ <plnk:role name="SayHelloProvider" portType="tns:SayHello"/>
+ </plnk:partnerLinkType>
+
+ <binding name="SayHelloBinding" type="tns:SayHello">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="sayHello">
+ <soap:operation
+ soapAction="http://www.jboss.org/bpel/examples/sayHello" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="SayHelloService">
+ <port name="SayHelloPort" binding="tns:SayHelloBinding">
+ <soap:address location="http://localhost:8080/SayHelloProcess" />
+ </port>
+ </service>
+</definitions>
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/bpelContent/SayHelloArtifacts.wsdl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/build.xml
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/build.xml (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/build.xml 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="say_hello_process" default="deploy" basedir=".">
+ <description>${ant.project.name} ${line.separator}</description>
+<!-- Import the base Ant build script... -->
+ <property file="../conf/quickstarts.properties"/>
+ <property name="org.jboss.esb.server.home" value="../../.."/>
+ <property name="org.jboss.esb.server.config" value="default"/>
+ <property name="version" value="1"/>
+ <property name="server.dir" value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}"/>
+ <property name="conf.dir" value="${server.dir}/conf"/>
+ <property name="deploy.dir" value="${server.dir}/deploy"/>
+ <property name="server.lib.dir" value="${server.dir}/lib"/>
+ <property name="sample.jar.name" value="${ant.project.name}-${version}.jar"/>
+ <target name="deploy">
+ <echo>Deploy ${ant.project.name}</echo>
+ <jar basedir="bpelContent" destfile="${deploy.dir}/${sample.jar.name}"/>
+ </target>
+ <target name="undeploy">
+ <echo>Undeploy ${ant.project.name}</echo>
+ <delete file="${deploy.dir}/${sample.jar.name}"/>
+ </target>
+ <target name="sayhello">
+ <echo>Send test message to: ${ant.project.name}</echo>
+ <java classname="org.apache.ode.tools.sendsoap.cline.HttpSoapSender">
+ <arg value="http://localhost:8080/SayHelloProcess"/>
+ <arg value="messages/sayHello_request.xml"/>
+ <classpath>
+ <fileset dir="${org.jboss.esb.server.home}/client" includes="*.jar"/>
+ <pathelement path="${java.class.path}"/>
+ </classpath>
+ </java>
+ </target>
+</project>
\ No newline at end of file
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/build.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/messages/sayHello_request.xml
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/messages/sayHello_request.xml (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/messages/sayHello_request.xml 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://www.jboss.org/bpel/examples">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <exam:SayHelloRequest>
+ <exam:input>Dolly</exam:input>
+ </exam:SayHelloRequest>
+ </soapenv:Body>
+</soapenv:Envelope>
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/messages/sayHello_request.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/readme.txt
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/readme.txt (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/readme.txt 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,28 @@
+Quickstart Examples - Level 1 - Say Hello
+============================================
+
+This example is simmilar to Hello World examples but uses input data
+to influence the output.
+
+The user calls the sayHello operation and provides his name. The process
+replys with 'Hello <name>'.
+
+To deploy the example, open a command line window in the example's folder,
+and simply type 'ant deploy'. To undeploy, use the command 'ant undeploy'.
+
+To test the example, for example using the SOAPUI client, an example
+'sayHello' message can be found in the messages sub-folder, with the
+relevant WSDL being located in the bpel sub-folder.
+
+Alternatively, use the 'ant sayhello' command (from a command line window)
+to send the message.
+
+NOTE: The "ant deploy" command will by default deploy version 1 of the
+example to the server. If you wish to change the example, and redeploy,
+then you will need to update the version number in the build.xml, or
+override the version property, e.g. "ant -Dversion=2 deploy" (and similarly
+when undeploying "ant -Dversion=2 undeploy").
+
+Some handy URLs:
+http://localhost:8080/bpel-console is the BPEL console
+http://localhost:8080/SayHelloProcess?wsdl is the URL to the BPEL process' WSDL
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/projects/bpel_say_hello/readme.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java (rev 0)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java 2011-04-04 07:36:14 UTC (rev 30261)
@@ -0,0 +1,89 @@
+package org.jboss.tools.bpel.ui.bot.test;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.bpel.ui.bot.test.suite.BPELTest;
+import org.jboss.tools.bpel.ui.bot.test.util.ResourceHelper;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
+import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
+import org.jboss.tools.ui.bot.ext.view.ServersView;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+@SWTBotTestRequires(perspective="BPEL Perspective")
+public class OdeDeployTest extends BPELTest {
+
+ static String BUNDLE = "org.jboss.tools.bpel.ui.bot.test";
+ ServersView sView = new ServersView();
+ ProjectExplorer projExplorer = new ProjectExplorer();
+
+ @Before
+ public void setupWorkspace() throws Exception {
+ ResourceHelper.importProject(BUNDLE, "/projects/bpel_say_hello", "say_hello");
+ bot.viewByTitle("Project Explorer").setFocus();
+ projExplorer.selectProject("say_hello");
+ }
+
+ @Test
+ public void deployDescriptor() throws Exception {
+
+ IFile deployFile = createNewDeployDescriptor("say_hello");
+
+ bot.editorByTitle("deploy.xml").show();
+ bot.editorByTitle("deploy.xml").setFocus();
+ SWTBot editorBot = bot.editorByTitle("deploy.xml").bot();
+
+ SWTBotTable table = editorBot.table(0);
+ table.click(0, 1);
+ bot.sleep(TIME_1S);
+
+ editorBot.ccomboBox("-- none -- ").setSelection("SayHelloPort");
+ table.click(0, 2);
+ bot.editorByTitle("deploy.xml").save();
+
+ String deployContent = loadFile(deployFile);
+ Assert.assertTrue(deployContent != null);
+ Assert.assertTrue(deployContent.contains("<deploy xmlns=\"http://www.apache.org/ode/schemas/dd/2007/03\" xmlns:examples=\"http://www.jboss.org/bpel/examples\">"));
+ Assert.assertTrue(deployContent.contains("<process name=\"examples:HelloWorld\">"));
+ Assert.assertTrue(deployContent.contains("<active>true</active>"));
+ Assert.assertTrue(deployContent.contains("<retired>false</retired>"));
+ Assert.assertTrue(deployContent.contains("<process-events generate=\"all\"/>"));
+ Assert.assertTrue(deployContent.contains("<provide partnerLink=\"client\">"));
+ Assert.assertTrue(deployContent.contains("<service name=\"examples:SayHelloService\" port=\"SayHelloPort\"/>"));
+ Assert.assertTrue(deployContent.contains("</provide>"));
+ Assert.assertTrue(deployContent.contains("</process>"));
+ Assert.assertTrue(deployContent.contains("</deploy>"));
+
+ bot.sleep(TIME_10S);
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
Property changes on: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java 2011-04-04 05:57:52 UTC (rev 30260)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java 2011-04-04 07:36:14 UTC (rev 30261)
@@ -126,31 +126,5 @@
return hasRuntime;
}
- String loadFile(IFile file) throws Exception {
- if(file.getType() != IFile.FILE) {
- throw new IllegalArgumentException("File: " + file.getFullPath().toString() + " is a directory!");
- }
-
- InputStream in = null;
- StringBuffer out;
- try {
- in = file.getContents();
- out = new StringBuffer();
- byte[] buffer = new byte[4 * 1024];
- int c = 0;
- while((c = in.read(buffer)) > -1) {
- out.append(new String(buffer, 0, c));
- }
- } finally {
- if(in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- return out.length() == 0 ? null : out.toString();
- }
}
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELAllTest.java
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELAllTest.java 2011-04-04 05:57:52 UTC (rev 30260)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELAllTest.java 2011-04-04 07:36:14 UTC (rev 30261)
@@ -5,6 +5,7 @@
import org.jboss.tools.bpel.ui.bot.test.ActivityModelingTest;
import org.jboss.tools.bpel.ui.bot.test.AssignActivityTest;
import org.jboss.tools.bpel.ui.bot.test.FaultModelingTest;
+import org.jboss.tools.bpel.ui.bot.test.OdeDeployTest;
import org.jboss.tools.bpel.ui.bot.test.SimpleModelingTest;
import org.jboss.tools.bpel.ui.bot.test.WizardTest;
@@ -15,7 +16,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-@SuiteClasses({ WizardTest.class, ActivityModelingTest.class, /* AssignActivityTest.class,*/ SimpleModelingTest.class, FaultModelingTest.class})
+(a)SuiteClasses({OdeDeployTest.class /*WizardTest.class, ActivityModelingTest.class,*/ /* AssignActivityTest.class,*/ /*SimpleModelingTest.class, FaultModelingTest.class*/})
@RunWith(RequirementAwareSuite.class)
public class BPELAllTest extends TestSuite {
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELTest.java
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELTest.java 2011-04-04 05:57:52 UTC (rev 30260)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/suite/BPELTest.java 2011-04-04 07:36:14 UTC (rev 30261)
@@ -1,5 +1,8 @@
package org.jboss.tools.bpel.ui.bot.test.suite;
+import java.io.IOException;
+import java.io.InputStream;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -156,4 +159,32 @@
return iproject;
}
+
+ public String loadFile(IFile file) throws Exception {
+ if(file.getType() != IFile.FILE) {
+ throw new IllegalArgumentException("File: " + file.getFullPath().toString() + " is a directory!");
+ }
+
+ InputStream in = null;
+ StringBuffer out;
+ try {
+ in = file.getContents();
+ out = new StringBuffer();
+ byte[] buffer = new byte[4 * 1024];
+ int c = 0;
+ while((c = in.read(buffer)) > -1) {
+ out.append(new String(buffer, 0, c));
+ }
+ } finally {
+ if(in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return out.length() == 0 ? null : out.toString();
+ }
+
}
13 years, 2 months