Author: elvisisking
Date: 2009-09-17 15:46:22 -0400 (Thu, 17 Sep 2009)
New Revision: 1230
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaPreferencesDialog.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishedLocationsDialog.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/DnaPreferencesDialog.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/NewFilteredFileExtension.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/NewFilteredFolderName.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/OperationDialog.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/PublishedLocationsDialog.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/ServerViewContextMenu.png
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/PublishJob.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/ReconnectJob.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFileExtensionEditor.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFoldersEditor.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewItemDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PublishingFileFilter.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/dnaPrefs.properties
Removed:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/ExtensionEditor.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewFileExtensionDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaConsole.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaServerView.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaToc.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishDialog.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ResourceContextMenu.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ServerDialog.html
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/helpContexts.xml
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/DnaConsole.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/ResourceDnaContextMenu.png
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/toc.xml
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/ReconnectToServerAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/DnaPreferencePage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PrefUtils.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaContentProvider.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaMessageConsole.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java
Log:
Updated help documents. Added a way to add emphasis (bold) messages or message segments
that appear in the DNA Message Console. Added a preference that filters out files that are
contained in folders that match a list of folder names created by the user. Added a UI to
the preference page for this. Create a "jobs" package and refactored PublishJob
and created a ReconnectJob. The reconnect action was rewritten to use this new job. Added
javadocs for anonymous inner classes.
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
===================================================================
(Binary files differ)
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaConsole.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaConsole.html 2009-09-17 14:01:59
UTC (rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaConsole.html 2009-09-17 19:46:22
UTC (rev 1230)
@@ -1,33 +1,50 @@
<h2>DNA Console</h2>
-<p>The DNA Console is shown in the Workbench Console view. Entries in this view
show the output of the publishing or unpublishing operations. For each operation there is
an entry at the start of the operation and another entry at the end of the operation.
Inbetween those entries will be an entry for each file involved in the
operation.</p>
+<p>The <i>DNA Console</i> is shown in the <i>Workbench
Console</i> view. Entries show the status and outcome of the publishing or
unpublishing operations.</p>
-<p>The following symbols indicate the type of outcome for each file:</p>
+<p>Here is what the <i>DNA Console</i> looks like:</p>
+<img src="images/DnaConsole.png" border="0" alt="">
+
+<p>There are view toolbar buttons to clear the console, scroll lock, pin the
console, display a different console, and to open another <i>DNA
Console</i>.</p>
+
+<h3>Console Message Entries</h3>
+
+<p>For each operation there is an entry at the start of the operation that
identifies the job number, operation type, number of files involved in the operation,
server, repository, and workspace. There is another entry at the end of the operation that
identifies the job number, operation type, and how long the operation took. Inbetween
these entries are entries for each file involved in the operation. The file entry takes on
the form of a job number, message prefix, and message. The message consists of an
operation type, eclipse workspace path, and the URL of the DNA repository for that file.
The URL is a hyperlink that opens that file in the default or last used editor for that
file.</p>
+
+<p>Here are the file entry message prefixes:</p>
+
<table border="1">
<tr>
- <td align="center"><strong>+</strong> </td>
+ <td align="center"><strong>++</strong> </td>
<td>if the file was successfully published (uploaded)</td>
</tr>
<tr>
- <td align="center"><strong>-</strong> </td>
+ <td align="center"><strong>--</strong> </td>
<td>if the file was successfully unpublished (removed)</td>
</tr>
<tr>
- <td align="center"><strong>*</strong> </td>
+ <td
align="center"><strong>ERROR</strong> </td>
<td>if there was an error publishing or unpublishing the file</td>
</tr>
<tr>
- <td align="center"><strong>w</strong> </td>
+ <td
align="center"><strong>INFO</strong> </td>
+ <td>if there was an informational message publishing or unpublishing the
file</td>
+</tr>
+<tr>
+ <td
align="center"><strong>WARN</strong> </td>
<td>if there is a warning when publishing or unpublishing a file (like trying to
unpublish a file that was never unpublished)</td>
</tr>
</table>
-<p>Here is what the DNA Console in the Console view looks like:</p>
+<h3>Operations</h3>
-<img src="images/DnaConsole.png" width="610"
height="168" border="0" alt="">
+<p>Each publishing or unpublishing operation can be run "in the
background" so you don't have to wait around until an operation is finished.
Simply click "Run in Background" on the operation dialog. This dialog identifies
the operation type, the job number, and the operations progress. You can also cancel the
operation using this dialog.</p>
-<p>There are view toolbar buttons to clear the console, scroll lock, pin the
console, display a different console, and to open another DNA Console.</p>
+<p>Here is what the <i>Operation Dialog</i> looks like:</p>
+
+<img src="images/OperationDialog.png" border="0"
alt="">
+
<h3>Related Topics</h3>
<ul>
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaPreferencesDialog.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaPreferencesDialog.html
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaPreferencesDialog.html 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,26 @@
+<h2>DNA Preferences Page</h2>
+
+<p>The <i>DNA Preferences Page</i> provides settings that control what
files are included in publishing and unpublishing operations. A publishing operation
occurs when the selected files in your local workspace are uploaded to a specific DNA
repository workspace. While an unpublishing operation occurs when the selected files in
your local workspace are removed from a specific DNA repository workspace. The
<i>Filtered File Extensions</i> preference and the <i>Filtered Folder
Names</i> preference each provide a way to filter out certain files from these
operations.</p>
+
+<p>Here is what the <i>DNA Preferences Page</i> looks like:</p>
+
+<img src="images/DnaPreferencesDialog.png" border="0"
alt="">
+
+<h3>Filtered File Extensions Preference</h3>
+
+The <i>Filtered File Extensions</i> preference provides a way to construct a
list of file extensions. If a file has an extension that matches one of these file
extensions it will not be involved in either a publishing or unpublishing operation. To
add a file extension simply click on the <code>New...</code> button to display
the following dialog:
+
+<p><img src="images/NewFilteredFileExtension.png" border="0"
alt=""></p>
+
+<h3>Filtered Folder Names Preference</h3>
+
+The <i>Filtered File Names</i> preference provides a way to construct a list
of folder names. If a file is contained in a folder, or has an ancestor folder, with a
name that matches one of these folder names it will not be involved in either a publishing
or unpublishing operation. To add a folder name simply click on the
<code>New...</code> button to display the following dialog:
+
+<p><img src="images/NewFilteredFolderName.png" border="0"
alt=""></p>
+
+<h3>Related Topics</h3>
+
+<ul>
+<li><a href="PublishDialog.html">Publish/Unpublish
Dialog</a></li>
+<li><a href="ResourceContextMenu.html">Resource DNA Context
Menu</a></li>
+</ul>
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaPreferencesDialog.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaServerView.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaServerView.html 2009-09-17
14:01:59 UTC (rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaServerView.html 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,13 +1,15 @@
<h2>Server View</h2>
-<p>The DNA Server View displays the registered servers hosting DNA repositories.
For each server, the repositories and repository workspaces are also displayed. There are
view toolbar buttons to create a new server (<img src="images/new_server.gif"
width="16" height="16" border="0" alt="">),
edit a selected server's properties (<img src="images/edit_server.gif"
width="16" height="16" border="0" alt="">),
delete one or more selected servers (<img src="images/delete_server.gif"
width="16" height="16" border="0" alt="">),
refresh, which attempts to connect to all the selected servers (<img
src="images/refresh.gif" width="16" height="16"
border="0" alt="">), and collapse all servers so that their
repositories and workspaces can't be seen (<img
src="images/collapse_all.gif" width="16" height="16"
border="0" alt="">).</p>
+<p>The <i>DNA Server View</i> displays the registered servers hosting
DNA repositories. For each server, the repositories and repository workspaces are also
displayed. There are view toolbar buttons to create a new server (<img
src="images/new_server.gif" border="0" alt="">), edit a
selected server's properties (<img src="images/edit_server.gif"
border="0" alt="">), discard one or more selected servers (<img
src="images/delete_server.gif" border="0" alt="">),
reconnect to a selected server (<img src="images/refresh.gif"
border="0" alt="">), and collapse all servers so that their
repositories and workspaces can't be seen (<img
src="images/collapse_all.gif" border="0" alt="">). If a
connection to a server cannot be established that server icon will be decorated with an
error overlay image.</p>
-<p>Here is what the DNA Server View looks like:</p>
+<p>Here is what the <i>DNA Server View</i> looks like:</p>
-<img src="images/ServerView.png" width="532"
height="166" border="0" alt="">
+<img src="images/ServerView.png" border="0" alt="">
-<p>If a connection to a server cannot be established that server icon will be
decorated with an error overlay image. There is also a context menu with actions to create
a new server (always enabled), edit server properties (enabled only when one server is
selected), and delete one or more selected servers.</p>
+<p>The view's context menu includes the new server, edit server properties,
discard server, and reconnect to server actions. Here is what the DNA Server View context
menu looks like:</p>
+<img src="images/ServerViewContextMenu.png" border="0"
alt="">
+
<h3>Related Topics</h3>
<ul>
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaToc.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaToc.html 2009-09-17 14:01:59 UTC
(rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/DnaToc.html 2009-09-17 19:46:22 UTC
(rev 1230)
@@ -1,9 +1,11 @@
<h2>DNA Publishing</h2>
<ul>
-<li><a href="ResourceContextMenu.html">Resource Context
Menu</a></li>
<li><a href="PublishDialog.html">Publish/Unpublish
Dialog</a></li>
<li><a href="ServerDialog.html">Server Dialog</a></li>
<li><a href="DnaServerView.html">Server View</a></li>
<li><a href="DnaConsole.html">DNA Message
Console</a></li>
+<li><a href="PublishedLocationsDialog.html">Published Locations
Dialog</a></li>
+<li><a href="ResourceContextMenu.html">Resource Context
Menu</a></li>
+<li><a href="DnaPreferencesDialog.html">DNA Preferences
Page</a></li>
</ul>
\ No newline at end of file
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishDialog.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishDialog.html 2009-09-17
14:01:59 UTC (rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishDialog.html 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,7 +1,11 @@
<h2>Publish/Unpublish Dialog</h2>
-<p>The DNA Publish/Unpublish Dialog is used to publish or unpublish workspace
selected files and folders to/from DNA repository workspaces. When publishing, the
selected files will be uploaded to the selected DNA repository workspace. When
unpublishing, the selected files will be removed from the selected DNA repository
workspace (if they exist there).</p>
+<p>The <i>DNA Publish/Unpublish Dialog</i> is used to publish or
unpublish workspace selected files and folders to/from DNA repository workspaces. When
publishing, the selected files will be uploaded to the selected DNA repository workspace.
When unpublishing, the selected files will be removed from the selected DNA repository
workspace (if they exist there). The <a
href="DnaPreferencesDialog.html">DNA Preferences Page</a> allows you to
filter out files contained within the selection based on their file extensions or by the
name of the folder, or ancestor folder, they are contained within.</p>
+<p>Here is what the <i>DNA Publish/Unpublish Dialog</i> looks
like:</p>
+
+<img src="images/PublishDialog.png" border="0"
alt="">
+
<p>The dialog consists of the following controls:</p>
<table border="1">
@@ -31,10 +35,6 @@
</tr>
</table>
-<p>Here is what the DNA Publish/Unpublish Dialog looks like:</p>
-
-<img src="images/PublishDialog.png" width="525"
height="405" border="0" alt="">
-
<p>A server must be selected before a repository can be selected. Likewise, a
repository must be selected before a workspace can be selected. The message area at the
top of the dialog will indicate the type of operation (publish or unpublish) and if there
is any missing information. Once the workspace has been selected the 'Finish'
button will be enabled and the operation can be executed. These operations can be run in
the background so that multiple operations can be run at the same time. The DNA Message
Console displays output from the operations.</p>
<h3>Related Topics</h3>
@@ -42,4 +42,5 @@
<ul>
<li><a href="ServerDialog.html">Server Dialog</a></li>
<li><a href="DnaConsole.html">DNA Message
Console</a></li>
+<li><a href="DnaPreferencesDialog.html">DNA Preferences
Page</a></li>
</ul>
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishedLocationsDialog.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishedLocationsDialog.html
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishedLocationsDialog.html 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,15 @@
+<h2>Published Locations Dialog</h2>
+
+<p>The <i>Published Locations Dialog</i> identifies all the DNA
workspaces the selected file has been published to from this Eclipse workspace.</p>
+
+<p>Here is what the <i>Published Locations Dialog</i> looks
like:</p>
+
+<img src="images/PublishedLocationsDialog.png" border="0"
alt="">
+
+<p>The table data identifies, for each workspace, the server URL, user, repository
name, workspace name, and published URL. A button to copy the published URL of the
selected row to the system clipboard is also available.</p>
+
+<h3>Related Topics</h3>
+
+<ul>
+<li><a href="PublishDialog.html">Publish/Unpublish
Dialog</a></li>
+</ul>
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/PublishedLocationsDialog.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ResourceContextMenu.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ResourceContextMenu.html 2009-09-17
14:01:59 UTC (rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ResourceContextMenu.html 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,13 +1,16 @@
<h2>Resource Context Menu</h2>
-<p>The Resource Context Menu consists of two actions: publish and unpublish. Each
action will be enabled when one or more resources (i.e, project, folder, or file) in the
workspace are selected. When publishing, the selected resources will be uploaded to a DNA
repository workspace. When unpublishing, the selected resources will be removed from a
selected DNA repository workspace (if they exist there).</p>
+<p>The <i>Resource Context Menu</i> consists of these actions: publish,
unpublish, and show published locations. The publish and unpublish actions will be enabled
when one or more resources (i.e, project, folder, or file) in the workspace are selected.
When publishing, the selected resources will be uploaded to a DNA repository workspace.
When unpublishing, the selected resources will be removed from a selected DNA repository
workspace (if they exist there). If a resource has already been published using the
current Eclipse workspace, the show published locations action will be enabled.</p>
-<p>Here is what the Resource Context Menu looks like:</p>
+<p>Here is what the <i>Resource Context Menu</i> looks like:</p>
-<img src="images/ResourceDnaContextMenu.png" width="358"
height="118" border="0" alt="">
+<img src="images/ResourceDnaContextMenu.png" border="0"
alt="">
+<p>Files can be filtered out of publishing and unpublishing operations even though
they have been selected. Use the <a href="DnaPreferencesDialog.html">DNA
Preferences Page</a> to filter out files contained within the selection based on
their file extensions or by the name of the folder, or ancestor folder, they are contained
within. </p>
+
<h3>Related Topics</h3>
<ul>
<li><a href="PublishDialog.html">Publishing and Unpublishing
Dialog</a></li>
+<li><a href="DnaPreferenceDialog.html">DNA Preferences
Dialog</a></li>
</ul>
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ServerDialog.html
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ServerDialog.html 2009-09-17
14:01:59 UTC (rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/ServerDialog.html 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,7 +1,11 @@
<h2>Server Dialog</h2>
-<p>The DNA Server Dialog is used to create and register new servers that host DNA
repositories. This dialog is also used to edit an existing server's
properties.</p>
+<p>The <i>DNA Server Dialog</i> is used to create and register new
servers that host DNA repositories. This dialog is also used to edit an existing
server's properties.</p>
+<p>Here is what the <i>DNA Server Dialog</i> looks like:</p>
+
+<img src="images/ServerDialog.png" border="0"
alt="">
+
<p>The dialog consists of the following controls:</p>
<table border="1">
@@ -19,7 +23,7 @@
</tr>
<tr>
<td align="right"><strong>Save Password
Checkbox</strong> </td>
- <td>when checked the password will be saved in clear-text on the local
machined</td>
+ <td>when checked, all the server properties (including the password) will be saved
to a file on the local machine</td>
</tr>
<tr>
<td align="right"><strong>Test Server Connection
Button</strong> </td>
@@ -27,10 +31,6 @@
</tr>
</table>
-<p>Here is what the DNA Server Dialog looks like:</p>
-
-<img src="images/ServerDialog.png" width="525"
height="515" border="0" alt="">
-
<p>Once all server properties have been entered the 'Finish' button will be
enabled and the new server can be created or the existing server's properties can be
modified. You can display the Server Dialog from the Server View and from the
Publish/Unpublish Dialog.</p>
<h3>Related Topics</h3>
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/helpContexts.xml
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/helpContexts.xml 2009-09-17
14:01:59 UTC (rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/helpContexts.xml 2009-09-17
19:46:22 UTC (rev 1230)
@@ -14,12 +14,19 @@
<context id="serverDialogHelpContext" title="Server Dialog">
<description>The DNA Server Dialog allows you to edit or create a server that
hosts one or more DNA repositories.</description>
<topic href="docs/ServerDialog.html" label="Server
Dialog"/>
+ <topic href="docs/DnaServerView.html" label="DNA Server
View"/>
</context>
<context id="publishDialogHelpContext" title="DNA Publish and
Unpublish Dialog Help">
<description>The DNA Publish/Unpublish Dialog uploads or removes selected
resources from a selected DNA server.</description>
<topic href="docs/PublishDialog.html" label="Publish/Unpublish
Dialog"/>
<topic href="docs/ServerDialog.html" label="Create a new
server"/>
+ <topic href="docs/DnaPreferencesDialog.html" label="DNA
Preferences"/>
</context>
+ <context id="preferencesHelpContext" title="DNA Preferences Dialog
Help">
+ <description>The DNA Preferences Dialog allows you to identify file extensions
and folder names that should not be involved in publishing
operations.</description>
+ <topic href="docs/DnaPreferencesDialog.html" label="DNA
Preferences"/>
+ <topic href="docs/PublishDialog.html" label="Publish/Unpublish
Dialog"/>
+ </context>
<context id="dnaConsoleHelpContext" title="DNA Message
Console">
<description>The DNA Message Console contains the output from the publishing
and unpublishing operations.</description>
<topic href="docs/DnaConsole.html" label="DNA Message
Console"/>
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/DnaConsole.png
===================================================================
(Binary files differ)
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/DnaPreferencesDialog.png
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/DnaPreferencesDialog.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/NewFilteredFileExtension.png
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/NewFilteredFileExtension.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/NewFilteredFolderName.png
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/NewFilteredFolderName.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/OperationDialog.png
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/OperationDialog.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/PublishedLocationsDialog.png
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/PublishedLocationsDialog.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/ResourceDnaContextMenu.png
===================================================================
(Binary files differ)
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/ServerViewContextMenu.png
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/docs/images/ServerViewContextMenu.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/docs/toc.xml
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/docs/toc.xml 2009-09-17 14:01:59 UTC
(rev 1229)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/docs/toc.xml 2009-09-17 19:46:22 UTC
(rev 1230)
@@ -3,5 +3,7 @@
<topic label="Server View" href="docs/DnaServerView.html"/>
<topic label="Server Dialog"
href="docs/ServerDialog.html"/>
<topic label="DNA Console" href="docs/DnaConsole.html"/>
+ <topic label="Published Locations Dialog"
href="docs/PublishedLocationsDialog.html"/>
<topic label="Resource Context Menu"
href="docs/ResourceContextMenu.html"/>
+ <topic label="DNA Preferences Dialog"
href="docs/DnaPreferencesDialog.html"/>
</toc>
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -94,6 +94,8 @@
String HELP_CONTEXT_PREFIX = PLUGIN_ID + '.';
String DNA_CONSOLE_HELP_CONTEXT = HELP_CONTEXT_PREFIX +
"dnaConsoleHelpContext"; //$NON-NLS-1$
+
+ String PREFERENCE_PAGE_HELP_CONTEXT = HELP_CONTEXT_PREFIX +
"preferencesHelpContext"; //$NON-NLS-1$
String PUBLISH_DIALOG_HELP_CONTEXT = HELP_CONTEXT_PREFIX +
"publishDialogHelpContext"; //$NON-NLS-1$
@@ -123,4 +125,11 @@
*/
String FILTERED_FILE_EXTENSIONS_PREFERENCE =
"dna.preference.filteredFileExtensions"; //$NON-NLS-1$
+ /**
+ * A preference for a list of folder names whose contents will not be part of
publishing operations.
+ *
+ * @since 0.6
+ */
+ String FILTERED_FOLDER_NAMES_PREFERENCE =
"dna.preference.filteredFolderNames"; //$NON-NLS-1$
+
}
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -49,10 +49,11 @@
public static I18n dnaConsoleProblemCreatingHyperlinkMsg;
public static I18n dnaConsoleFilePathNotFoundMsg;
- public static I18n dnaPreferencePageFilteredFileExtensionsDescription;
+ public static I18n dnaPreferencePageDescription;
public static I18n dnaPreferencePageFilteredFileExtensionsLabel;
- public static I18n dnaPreferencePageFilteredFileExtensionsMessage;
- public static I18n dnaPreferencePageFilteredFileExtensionsTitle;
+ public static I18n dnaPreferencePageFilteredFolderNamesLabel;
+ public static I18n dnaPreferencePageMessage;
+ public static I18n dnaPreferencePageTitle;
public static I18n editServerActionText;
public static I18n editServerActionToolTip;
@@ -61,12 +62,18 @@
public static I18n missingImage;
- public static I18n newFileExtensionDialogLabel;
- public static I18n newFileExtensionDialogTitle;
+ public static I18n newFilteredFileExtensionDialogLabel;
+ public static I18n newFilteredFileExtensionDialogTitle;
+
+ public static I18n newFilteredFolderNameDialogLabel;
+ public static I18n newFilteredFolderNameDialogTitle;
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 publishedLocationsDialogErrorObtainingUrlMsg;
@@ -81,12 +88,13 @@
public static I18n publishedResourcePropertyErrorMsg;
public static I18n publishJobCanceled;
- public static I18n publishJobLongDurationMsg;
- public static I18n publishJobShortDurationMsg;
+ public static I18n publishJobDurationMsg;
+ public static I18n publishJobDurationNoHoursMsg;
+ public static I18n publishJobDurationNoHoursNoMinutesMsg;
+ public static I18n publishJobDurationShortMsg;
public static I18n publishJobPublish;
public static I18n publishJobPublishCanceledMsg;
public static I18n publishJobPublishFile;
- public static I18n publishJobPublishFile2;
public static I18n publishJobPublishFileFailed;
public static I18n publishJobPublishFileInfo;
public static I18n publishJobPublishFileWarning;
@@ -135,6 +143,8 @@
public static I18n publishWizardPublishTitle;
public static I18n publishWizardUnpublishTitle;
public static I18n publishWizardUnpublishErrorMsg;
+
+ public static I18n reconnectJobTaskName;
public static I18n serverManagerGetRepositoriesExceptionMsg;
public static I18n serverManagerGetWorkspacesExceptionMsg;
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties 2009-09-17
19:46:22 UTC (rev 1230)
@@ -41,21 +41,28 @@
dnaConsoleProblemCreatingHyperlinkMsg = Unexpected problem creating hyperlink in DNA
Console view
dnaConsoleFilePathNotFoundMsg = A hyperlink could not be created in the DNA Message
Console because the file path of "{0}" could not be found.
-dnaPreferencePageFilteredFileExtensionsDescription = Add, remove, or edit the filtered
file extensions. Files with matching extensions will NOT be published to DNA
repositories.
+dnaPreferencePageDescription = Add or remove filtered 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 DNA repositories.
dnaPreferencePageFilteredFileExtensionsLabel = Filtered File Extensions:
-dnaPreferencePageFilteredFileExtensionsMessage = DNA
-dnaPreferencePageFilteredFileExtensionsTitle = DNA Filtered File Extensions
+dnaPreferencePageFilteredFolderNamesLabel = Filtered Folder Names:
+dnaPreferencePageMessage = DNA
+dnaPreferencePageTitle = DNA Preferences
errorDialogTitle = Error
missingImage = The following image cannot be found "{0}"
-newFileExtensionDialogLabel = File Extension:
-newFileExtensionDialogTitle = New Filtered File Extension
+newFilteredFileExtensionDialogLabel = File extension:
+newFilteredFileExtensionDialogTitle = New Filtered File Extension
+
+newFilteredFolderNameDialogLabel = Folder name:
+newFilteredFolderNameDialogTitle = New Filtered Folder Name
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.
+
publishedLocationsDialogCopyUrlButton = Copy URL
publishedLocationsDialogCopyUrlButtonToolTip = Copy to the clipboard the selected
workspace URL where the file is published
publishedLocationsDialogErrorObtainingUrlMsg = Error obtaining URL
@@ -70,25 +77,26 @@
publishedResourcePropertyErrorMsg = Error obtaining the "published" property
from the resource "{0}"
publishJobCanceled = Job {0} was canceled. See log for details.
-publishJobLongDurationMsg = {0} hour(s), {1} minute(s), {2} second(s)
-publishJobShortDurationMsg = less than 1 second
+publishJobDurationMsg = {0} hour(s), {1} minute(s), {2} second(s)
+publishJobDurationNoHoursMsg = {0} minute(s), {1} second(s)
+publishJobDurationNoHoursNoMinutesMsg = {0} second(s)
+publishJobDurationShortMsg = less than 1 second
publishJobPublish = [{0}] Publishing {4} file(s) to server "{1}" (repository
"{2}", workspace "{3}") ...
-publishJobPublishCanceledMsg = [{0}] !! Publishing to server "{1}" (repository
"{2}", workspace "{3}") was canceled after {4} file(s) out of {5} were
processed.\n
-publishJobPublishFile = \t[{0}] ++ Published file "{1}" to URL\
-publishJobPublishFile2 = "{0}"
-publishJobPublishFileFailed = \t[{0}] ERROR Publishing file "{1}" generated an
ERROR message. See log.
-publishJobPublishFileInfo = \t[{0}] INFO Publishing file "{1}" generated an
INFO message. See log.
-publishJobPublishFileWarning = \t[{0}] WARN Publishing file "{1}" generated a
WARNING message. See log.
-publishJobPublishFinishedMsg = [{0}] Done publishing. Elapsed time: {1}. \n
+publishJobPublishCanceledMsg = [{0}] Publishing was canceled after {1} file(s) out of {2}
were processed. Elapsed time: {3}.\n
+publishJobPublishFile = [{0}] + Published file "{1}" to URL
"<em>{2}</em>"
+publishJobPublishFileFailed = [{0}] -- ERROR -- Publishing file "{1}" generated
an ERROR message. See log.
+publishJobPublishFileInfo = [{0}] -- INFO -- Publishing file "{1}" generated an
INFO message. See log.
+publishJobPublishFileWarning = [{0}] -- WARNING -- Publishing file "{1}"
generated a WARNING message. See log.
+publishJobPublishFinishedMsg = [{0}] Done publishing. Elapsed time: {1}.\n
publishJobPublishName = DNA Publish [{0}]
publishJobPublishTaskName = Publishing resources [{0}]
publishJobUnexpectedErrorMsg = Unexpected error occurred. See log for more details.
publishJobUnpublish = [{0}] Unpublishing {4} file(s) from server "{1}"
(repository "{2}", workspace "{3}") ...
-publishJobUnpublishCanceledMsg = [{0}] !! Unpublishing from server "{1}"
(repository "{2}", workspace "{3}") was canceled after {4} file(s) out
of {5} were processed.\n
-publishJobUnpublishFile = \t[{0}] -- Unpublished file "{1}"
-publishJobUnpublishFileFailed = \t[{0}] ERROR Unpublishing file "{0}" generated
an ERROR message. See log.
-publishJobUnpublishFileInfo = \t[{0}] INFO Unpublishing file "{1}" generated
an INFO message. See log.
-publishJobUnpublishFileWarning = \t[{0}] WARN Unpublishing file "{1}"
generated a WARNING message. See log.
+publishJobUnpublishCanceledMsg = [{0}] Unublishing was canceled after {1} file(s) out of
{2} were processed. Elapsed time: {3}.\n
+publishJobUnpublishFile = [{0}] - Unpublished file "{1}"
+publishJobUnpublishFileFailed = [{0}] -- ERROR -- Unpublishing file "{0}"
generated an ERROR message. See log.
+publishJobUnpublishFileInfo = [{0}] -- INFO -- Unpublishing file "{1}"
generated an INFO message. See log.
+publishJobUnpublishFileWarning = [{0}] -- WARN -- Unpublishing file "{1}"
generated a WARNING message. See log.
publishJobUnpublishFinishedMsg = [{0}] Done unpublishing. Elapsed time: {1}. \n
publishJobUnpublishName = DNA Unpublish [{0}]
publishJobUnpublishTaskName = Unpublishing resources [{0}]
@@ -125,8 +133,10 @@
publishWizardUnpublishErrorMsg = Error Unpublishing
publishWizardUnpublishTitle = Unpublish
+reconnectJobTaskName = Connecting to server "{0}"
+
serverReconnectActionText = Reconnect
-serverReconnectActionToolTip = Reconnect to selected servers or all servers if no servers
selected
+serverReconnectActionToolTip = Reconnect to the selected server
serverManagerGetRepositoriesExceptionMsg = There was a problem obtaining repositories for
the server "{0}."
serverManagerGetWorkspacesExceptionMsg = There was a problem obtaining workspaces for
repository "{0}."
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -23,16 +23,11 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.PLUGIN_ID;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.StringTokenizer;
import java.util.TreeSet;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
@@ -141,30 +136,14 @@
}
/**
- * @param container the project or folder whose files are being requested
- * @param recurse the flag indicating if child containers should be traversed
- * @return the list of files contained in the specified container (never
<code>null</code>)
- * @throws CoreException if there is a problem finding the files
+ * @param status the status being converted (never <code>null</code>)
+ * @return the Eclipse status object (never <code>null</code>)
* @since 0.6
*/
- public static List<IFile> findFiles( IContainer container,
- boolean recurse ) throws CoreException {
- List<IFile> result = new ArrayList<IFile>();
-
- for (IResource member : container.members()) {
- if (recurse && (member instanceof IContainer)) {
- // don't select closed projects
- if ((member instanceof IProject) && !((IProject)member).isOpen())
{
- continue;
- }
-
- result.addAll(findFiles((IContainer)member, recurse));
- } else if ((member instanceof IFile) &&
((IFile)member).getLocation().toFile().exists()) {
- result.add((IFile)member);
- }
- }
-
- return result;
+ public static IStatus convert( Status status ) {
+ CheckArg.isNotNull(status, "status"); //$NON-NLS-1$
+ return new org.eclipse.core.runtime.Status(convertSeverity(status.getSeverity()),
PLUGIN_ID, status.getMessage(),
+ status.getException());
}
/**
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -41,8 +41,8 @@
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.Utils;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.PublishJob.Type;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishWizard;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
/**
* @since 0.6
@@ -114,6 +114,11 @@
try {
WizardDialog dialog = new WizardDialog(shell, new PublishWizard(this.type,
resources,
Activator.getDefault().getServerManager())) {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
+ */
@Override
protected void initializeBounds() {
super.initializeBounds();
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -101,6 +101,11 @@
public void run() {
ServerWizard wizard = new ServerWizard(this.serverManager,
this.serverBeingEdited);
WizardDialog dialog = new WizardDialog(this.shell, wizard) {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.wizard.WizardDialog#configureShell(org.eclipse.swt.widgets.Shell)
+ */
@Override
protected void configureShell( Shell newShell ) {
super.configureShell(newShell);
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -92,6 +92,11 @@
public void run() {
ServerWizard wizard = new ServerWizard(this.serverManager);
WizardDialog dialog = new WizardDialog(this.shell, wizard) {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.wizard.WizardDialog#configureShell(org.eclipse.swt.widgets.Shell)
+ */
@Override
protected void configureShell( Shell newShell ) {
super.configureShell(newShell);
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.PublishJob.Type;
/**
* The <code>PublishAction</code> controls the publishing of one or more
{@link org.eclipse.core.resources.IResource}s to a DNA
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/ReconnectToServerAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/ReconnectToServerAction.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/ReconnectToServerAction.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -24,21 +24,24 @@
package org.jboss.dna.web.jcr.rest.client.swt.actions;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.REFRESH_IMAGE;
-import org.eclipse.jface.action.Action;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.dna.web.jcr.rest.client.IServerRegistryListener;
-import org.jboss.dna.web.jcr.rest.client.ServerRegistryEvent;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.ReconnectJob;
/**
- * The <code>ReconnectToServerAction</code> tries to reconnect to one or more
selected servers or to all servers if none are
- * selected. This action must be registered to received server registry events.
+ * The <code>ReconnectToServerAction</code> tries to reconnect to a selected
server.
*
* @since 0.6
*/
-public final class ReconnectToServerAction extends Action implements
IServerRegistryListener {
+public final class ReconnectToServerAction extends BaseSelectionListenerAction {
//
===========================================================================================================================
// Fields
@@ -73,6 +76,37 @@
//
===========================================================================================================================
/**
+ * @return the view's tree viewer
+ * @since 0.6
+ */
+ StructuredViewer getViewer() {
+ return this.viewer;
+ }
+
+ /**
+ * @param server the server being connected to
+ * @since 0.6
+ */
+ void refresh( final Server server ) {
+ final Display display = this.viewer.getControl().getDisplay();
+
+ if (!display.isDisposed()) {
+ // make sure we are in the UI thread
+ display.asyncExec(new Runnable() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ getViewer().refresh(server);
+ }
+ });
+ }
+ }
+
+ /**
* {@inheritDoc}
*
* @see org.eclipse.jface.action.Action#run()
@@ -80,27 +114,39 @@
*/
@Override
public void run() {
- IStructuredSelection selection =
(IStructuredSelection)this.viewer.getSelection();
+ final Server server = (Server)getStructuredSelection().getFirstElement();
+ final ReconnectJob job = new ReconnectJob(server);
- if (selection.size() == 0) {
- this.viewer.refresh();
- } else {
- for (Object server : selection.toArray()) {
- this.viewer.refresh(server);
+ // add listener so we can refresh tree
+ job.addJobChangeListener(new JobChangeAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.core.runtime.jobs.JobChangeAdapter#done(org.eclipse.core.runtime.jobs.IJobChangeEvent)
+ */
+ @Override
+ public void done( IJobChangeEvent event ) {
+ refresh(server);
+ job.removeJobChangeListener(this);
}
- }
+ });
+
+ // run job in own thread not in the UI thread
+ Thread t = new Thread();
+ t.run();
+ job.setThread(t);
+ job.schedule();
}
/**
* {@inheritDoc}
*
- * @see
org.jboss.dna.web.jcr.rest.client.IServerRegistryListener#serverRegistryChanged(org.jboss.dna.web.jcr.rest.client.ServerRegistryEvent)
+ * @see
org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
* @since 0.6
*/
@Override
- public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
- setEnabled(!event.getServerManager().getServers().isEmpty());
- return null;
+ protected boolean updateSelection( IStructuredSelection selection ) {
+ return ((selection.size() == 1) && (selection.getFirstElement()
instanceof Server));
}
}
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.PublishJob.Type;
/**
* The <code>UnpublishAction</code> controls the unpublishing of one or more
{@link org.eclipse.core.resources.IResource}s from a
Copied:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/PublishJob.java
(from rev 1182,
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java)
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/PublishJob.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/PublishJob.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,390 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.jobs;
+
+import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_PUBLISHING_JOB_FAMILY;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.PLUGIN_ID;
+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;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.ServerManager;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+import org.jboss.dna.web.jcr.rest.client.swt.Activator;
+import org.jboss.dna.web.jcr.rest.client.swt.DnaResourceHelper;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.swt.views.DnaContentProvider;
+import org.jboss.dna.web.jcr.rest.client.swt.views.DnaMessageConsole;
+
+/**
+ * The <code>PublishJob</code> publishes or unpublishes one or more files
using the {@link ServerManager}.
+ *
+ * @since 0.6
+ */
+public final class PublishJob extends Job {
+
+ //
===========================================================================================================================
+ // Constants
+ //
===========================================================================================================================
+
+ /**
+ * The job type.
+ *
+ * @since 0.6
+ */
+ public enum Type {
+ /**
+ * Indicates a publish job.
+ *
+ * @since 0.6
+ */
+ PUBLISH,
+
+ /**
+ * Indicates an unpublish job.
+ *
+ * @since 0.6
+ */
+ UNPUBLISH
+ }
+
+ /**
+ * A unique job identifier given to each publishing/unpublishing job.
+ *
+ * @since 0.6
+ */
+ private static final AtomicInteger JOB_ID = new AtomicInteger(1);
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * @param type the job type (never <code>null</code>)
+ * @param jobId the job identifier
+ * @return the job name
+ * @since 0.6
+ */
+ private static String getJobName( Type type,
+ int jobId ) {
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
+
+ if (Type.PUBLISH == type) {
+ return RestClientI18n.publishJobPublishName.text(jobId);
+ }
+
+ // unpublish
+ return RestClientI18n.publishJobUnpublishName.text(jobId);
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The files being published or unpublished.
+ *
+ * @since 0.6
+ */
+ private final List<IFile> files;
+
+ /**
+ * The unique job identifier.
+ *
+ * @since 0.6
+ */
+ private final int jobId;
+
+ /**
+ * The job type.
+ *
+ * @since 0.6
+ */
+ private final Type type;
+
+ /**
+ * The workspace to use when publishing or unpublishing.
+ *
+ * @since 0.6
+ */
+ private final Workspace workspace;
+
+ //
===========================================================================================================================
+ // 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>)
+ * @since 0.6
+ */
+ public PublishJob( Type type,
+ List<IFile> files,
+ Workspace workspace ) {
+ super(getJobName(type, JOB_ID.incrementAndGet()));
+
+ CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
+
+ this.type = type;
+ this.files = files;
+ this.workspace = workspace;
+ this.jobId = JOB_ID.get();
+
+ setUser(true); // allow user to run in background
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public boolean belongsTo( Object family ) {
+ return DNA_PUBLISHING_JOB_FAMILY.equals(family);
+ }
+
+ /**
+ * @return the server manager
+ * @since 0.6
+ */
+ private ServerManager getServerManager() {
+ return Activator.getDefault().getServerManager();
+ }
+
+ /**
+ * @return <code>true</code> if a publishing job
+ * @since 0.6
+ */
+ private boolean isPublishing() {
+ return (this.type == Type.PUBLISH);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ * @since 0.6
+ */
+ @Override
+ protected IStatus run( IProgressMonitor monitor ) {
+ assert (this.workspace != null);
+ long startTime = System.currentTimeMillis();
+ boolean canceled = false;
+ int numProcessed = 0;
+
+ try {
+ int fileCount = this.files.size();
+ String name = (isPublishing() ?
RestClientI18n.publishJobPublishTaskName.text(this.jobId)
+ :
RestClientI18n.publishJobUnpublishTaskName.text(this.jobId));
+ monitor.beginTask(name, fileCount);
+ monitor.setTaskName(name);
+
+ String serverUrl = this.workspace.getServer().getUrl();
+ String repositoryName = this.workspace.getRepository().getName();
+ String workspaceName = this.workspace.getName();
+
+ // write initial message to console
+ if (isPublishing()) {
+
DnaMessageConsole.writeln(RestClientI18n.publishJobPublish.text(this.jobId,
+
serverUrl,
+
repositoryName,
+
workspaceName,
+
fileCount));
+ } else {
+
DnaMessageConsole.writeln(RestClientI18n.publishJobUnpublish.text(this.jobId,
+
serverUrl,
+
repositoryName,
+
workspaceName,
+
fileCount));
+ }
+
+ DnaResourceHelper resourceHelper = new
DnaResourceHelper(getServerManager());
+
+ // process the files
+ for (IFile eclipseFile : this.files) {
+ if (monitor.isCanceled()) {
+ canceled = true;
+ throw new
InterruptedException(RestClientI18n.publishJobCanceled.text(jobId));
+ }
+
+ File file = eclipseFile.getLocation().toFile();
+ String path = eclipseFile.getParent().getFullPath().toString();
+ Status status = null;
+
+ if (isPublishing()) {
+ status = getServerManager().publish(this.workspace, path, file);
+
+ // set persistent property on resource indicating it has been
published
+ if (!status.isError()) {
+ resourceHelper.addPublishedProperty(eclipseFile, workspace);
+ DnaContentProvider decorator =
DnaContentProvider.getDecorator();
+
+ if (decorator != null) {
+ // decorator.refresh(eclipseFile);
+ }
+ }
+ } else {
+ status = getServerManager().unpublish(this.workspace, path, file);
+
+ // clear persistent property on resource indicating it has been
unpublished
+ if (!status.isError()) {
+ resourceHelper.removePublishedProperty(eclipseFile, workspace);
+ DnaContentProvider decorator =
DnaContentProvider.getDecorator();
+
+ if (decorator != null) {
+ // decorator.refresh(eclipseFile);
+ }
+ }
+ }
+
+ ++numProcessed;
+ monitor.worked(1);
+
+ // write outcome message to console
+ if (isPublishing() && status.isOk()) {
+ URL url = getServerManager().getUrl(file, path, this.workspace);
+ writeToConsole(eclipseFile, url, status);
+ } else {
+ writeToConsole(eclipseFile, null, status);
+ }
+ }
+
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+ } catch (Exception e) {
+ String msg = null;
+
+ if (e instanceof InterruptedException) {
+ msg = e.getLocalizedMessage();
+ } else {
+ msg = RestClientI18n.publishJobUnexpectedErrorMsg.text();
+ }
+
+ return new org.eclipse.core.runtime.Status(IStatus.INFO, PLUGIN_ID, msg, e);
+ } finally {
+ monitor.done();
+
+ // add operation completed message
+ String duration;
+ long milliseconds = (System.currentTimeMillis() - startTime);
+ long hours = milliseconds / (1000 * 60 * 60);
+ long minutes = (milliseconds % (1000 * 60 * 60)) / (1000 * 60);
+ long seconds = ((milliseconds % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
+
+ if (hours > 0) {
+ duration = RestClientI18n.publishJobDurationMsg.text(hours, minutes,
seconds);
+ } else if (minutes > 0) {
+ duration = RestClientI18n.publishJobDurationNoHoursMsg.text(minutes,
seconds);
+ } else if (seconds > 0) {
+ duration =
RestClientI18n.publishJobDurationNoHoursNoMinutesMsg.text(seconds);
+ } else {
+ duration = RestClientI18n.publishJobDurationShortMsg.text();
+ }
+
+ if (canceled) {
+ if (isPublishing()) {
+
DnaMessageConsole.writeln(RestClientI18n.publishJobPublishCanceledMsg.text(this.jobId,
+
numProcessed,
+
this.files.size(),
+
duration));
+ } else {
+
DnaMessageConsole.writeln(RestClientI18n.publishJobUnpublishCanceledMsg.text(this.jobId,
+
numProcessed,
+
this.files.size(),
+
duration));
+ }
+ } else {
+ if (isPublishing()) {
+
DnaMessageConsole.writeln(RestClientI18n.publishJobPublishFinishedMsg.text(this.jobId,
duration));
+ } else {
+
DnaMessageConsole.writeln(RestClientI18n.publishJobUnpublishFinishedMsg.text(this.jobId,
duration));
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a hyperlink in console.
+ *
+ * @param file the file involved in the publishing operation
+ * @param url the destination file URL or <code>null</code>
+ * @param status the status of the publishing operation
+ * @since 0.6
+ */
+ private void writeToConsole( final IFile file,
+ URL url,
+ Status status ) {
+ String message = null;
+
+ if (status.isOk()) {
+ if (isPublishing()) {
+ message = RestClientI18n.publishJobPublishFile.text(this.jobId,
file.getFullPath(), url.toString());
+ } else {
+ message = RestClientI18n.publishJobUnpublishFile.text(this.jobId,
file.getFullPath());
+ }
+ } else if (status.isError()) {
+ if (isPublishing()) {
+ message = RestClientI18n.publishJobPublishFileFailed.text(this.jobId,
file.getFullPath());
+ } else {
+ message = RestClientI18n.publishJobUnpublishFileFailed.text(this.jobId,
file.getFullPath());
+ }
+
+ // log
+ Activator.getDefault().log(status);
+ } else if (status.isWarning()) {
+ if (isPublishing()) {
+ message = RestClientI18n.publishJobPublishFileWarning.text(this.jobId,
file.getFullPath());
+ } else {
+ message = RestClientI18n.publishJobUnpublishFileWarning.text(this.jobId,
file.getFullPath());
+ }
+
+ // log
+ Activator.getDefault().log(status);
+ } else {
+ if (isPublishing()) {
+ message = RestClientI18n.publishJobPublishFileInfo.text(this.jobId,
file.getFullPath());
+ } else {
+ message = RestClientI18n.publishJobUnpublishFileInfo.text(this.jobId,
file.getFullPath());
+ }
+
+ // log
+ Activator.getDefault().log(status);
+ }
+
+ // write to console creating a hyperlink
+ DnaMessageConsole.writeln(message, file);
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/PublishJob.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/ReconnectJob.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/ReconnectJob.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/ReconnectJob.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,120 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.jobs;
+
+import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_PUBLISHING_JOB_FAMILY;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.PLUGIN_ID;
+import static org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.reconnectJobTaskName;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.dna.web.jcr.rest.client.ServerManager;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+import org.jboss.dna.web.jcr.rest.client.swt.Activator;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.swt.Utils;
+
+/**
+ * The <code>ReconnectJob</code> attempts to reconnect to the selected {@link
Server server(s)}.
+ *
+ * @since 0.6
+ */
+public final class ReconnectJob extends Job {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The server being reconnected to.
+ *
+ * @since 0.6
+ */
+ private final Server server;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param server the server being connected to (never <code>null</code>)
+ * @since 0.6
+ */
+ public ReconnectJob( Server server ) {
+ super(reconnectJobTaskName.text(server.getShortDescription()));
+ this.server = server;
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public boolean belongsTo( Object family ) {
+ return DNA_PUBLISHING_JOB_FAMILY.equals(family);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ * @since 0.6
+ */
+ @Override
+ protected IStatus run( IProgressMonitor monitor ) {
+ IStatus result = null;
+ ServerManager serverManager = Activator.getDefault().getServerManager();
+
+ try {
+ String taskName =
reconnectJobTaskName.text(this.server.getShortDescription());
+ monitor.beginTask(taskName, 1);
+ monitor.setTaskName(taskName);
+ Status status = serverManager.ping(this.server);
+ result = Utils.convert(status);
+ } catch (Exception e) {
+ String msg = null;
+
+ if (e instanceof InterruptedException) {
+ msg = e.getLocalizedMessage();
+ } else {
+ msg = RestClientI18n.publishJobUnexpectedErrorMsg.text();
+ }
+
+ result = new org.eclipse.core.runtime.Status(IStatus.ERROR, PLUGIN_ID, msg,
e);
+ } finally {
+ monitor.done();
+ done(result);
+ }
+
+ return result;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/jobs/ReconnectJob.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/DnaPreferencePage.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/DnaPreferencePage.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/DnaPreferencePage.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -24,9 +24,10 @@
package org.jboss.dna.web.jcr.rest.client.swt.preferences;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
-import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageFilteredFileExtensionsDescription;
-import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageFilteredFileExtensionsMessage;
-import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageFilteredFileExtensionsTitle;
+import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.PREFERENCE_PAGE_HELP_CONTEXT;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageDescription;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageMessage;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageTitle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
@@ -37,6 +38,7 @@
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.dna.web.jcr.rest.client.swt.Activator;
/**
@@ -51,12 +53,19 @@
//
===========================================================================================================================
/**
- * The editor used to manage the list of file extensions.
+ * The editor used to manage the list of filtered file extensions.
*
* @since 0.6
*/
- private ExtensionEditor editor;
+ private FilteredFileExtensionEditor extensionsEditor;
+ /**
+ * The editor used to manage the list of filtered folder names.
+ *
+ * @since 0.6
+ */
+ private FilteredFoldersEditor foldersEditor;
+
//
===========================================================================================================================
// Methods
//
===========================================================================================================================
@@ -73,14 +82,26 @@
panel.setLayout(new GridLayout(2, false));
panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- // create the editor
- this.editor = new ExtensionEditor(panel);
- this.editor.setPreferenceStore(getPreferenceStore());
- this.editor.getListControl(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 editor
- this.editor.load();
+ // 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;
}
@@ -92,7 +113,7 @@
*/
@Override
public String getDescription() {
- return dnaPreferencePageFilteredFileExtensionsDescription.text();
+ return dnaPreferencePageDescription.text();
}
/**
@@ -114,7 +135,7 @@
*/
@Override
public String getMessage() {
- return dnaPreferencePageFilteredFileExtensionsMessage.text();
+ return dnaPreferencePageMessage.text();
}
/**
@@ -136,7 +157,7 @@
*/
@Override
public String getTitle() {
- return dnaPreferencePageFilteredFileExtensionsTitle.text();
+ return dnaPreferencePageTitle.text();
}
/**
@@ -158,7 +179,8 @@
*/
@Override
protected void performDefaults() {
- this.editor.loadDefault();
+ this.extensionsEditor.loadDefault();
+ this.foldersEditor.loadDefault();
super.performDefaults();
}
@@ -170,7 +192,8 @@
*/
@Override
public boolean performOk() {
- this.editor.store();
+ this.extensionsEditor.store();
+ this.foldersEditor.store();
return super.performOk();
}
Deleted:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/ExtensionEditor.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/ExtensionEditor.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/ExtensionEditor.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,110 +0,0 @@
-package org.jboss.dna.web.jcr.rest.client.swt.preferences;
-
-import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.FILTERED_FILE_EXTENSIONS_PREFERENCE;
-import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageFilteredFileExtensionsLabel;
-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.widgets.Composite;
-import org.jboss.dna.web.jcr.rest.client.swt.Utils;
-
-/**
- * The <code>ExtensionEditor</code> is an editor for managing a set of file
extensions.
- *
- * @since 0.6
- */
-public final class ExtensionEditor extends ListEditor {
-
- //
=======================================================================================================================
- // Constants
- //
=======================================================================================================================
-
- /**
- * The delimiter used to separate file extensions when saved to the preference
store.
- *
- * @since 0.6
- */
- private static final char DELIM = ',';
-
- //
=======================================================================================================================
- // Fields
- //
=======================================================================================================================
-
- /**
- * The current set of file extensions.
- *
- * @since 0.6
- */
- private final Set<String> extensions;
-
- //
=======================================================================================================================
- // Constructors
- //
=======================================================================================================================
-
- /**
- * @param parent the parent control
- * @since 0.6
- */
- public ExtensionEditor( Composite parent ) {
- super(FILTERED_FILE_EXTENSIONS_PREFERENCE,
dnaPreferencePageFilteredFileExtensionsLabel.text(), parent);
- this.extensions = new TreeSet<String>();
- }
-
- //
=======================================================================================================================
- // Methods
- //
=======================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.preference.ListEditor#createList(java.lang.String[])
- * @since 0.6
- */
- @Override
- protected String createList( String[] items ) {
- return Utils.combineTokens(items, DELIM);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
- * @since 0.6
- */
- @Override
- protected String getNewInputObject() {
- NewFileExtensionDialog dialog = new NewFileExtensionDialog(getShell());
-
- if (dialog.open() == Window.OK) {
- String extension = dialog.getFileExtension();
-
- // add new extension
- if (extension != null) {
- this.extensions.add(extension);
- return extension;
- }
- }
-
- // user canceled dialog
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.preference.ListEditor#parseString(java.lang.String)
- * @since 0.6
- */
- @Override
- protected String[] parseString( String stringList ) {
- String[] values = Utils.getTokens(stringList, Character.toString(DELIM), true);
-
- this.extensions.clear();
- this.extensions.addAll(Arrays.asList(values));
-
- return values;
- }
-
-}
Copied:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFileExtensionEditor.java
(from rev 1194,
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/ExtensionEditor.java)
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFileExtensionEditor.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFileExtensionEditor.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,122 @@
+package org.jboss.dna.web.jcr.rest.client.swt.preferences;
+
+import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.FILTERED_FILE_EXTENSIONS_PREFERENCE;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageFilteredFileExtensionsLabel;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.newFilteredFileExtensionDialogLabel;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.newFilteredFileExtensionDialogTitle;
+import static
org.jboss.dna.web.jcr.rest.client.swt.preferences.PrefUtils.FILE_EXT_DELIMITER;
+import static
org.jboss.dna.web.jcr.rest.client.swt.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;
+import org.jboss.dna.web.jcr.rest.client.swt.Utils;
+
+/**
+ * The <code>FilteredFileExtensionEditor</code> is an editor for managing a
set of filtered file extensions.
+ *
+ * @since 0.6
+ */
+public final class FilteredFileExtensionEditor extends ListEditor implements
VerifyListener {
+
+ //
=======================================================================================================================
+ // Fields
+ //
=======================================================================================================================
+
+ /**
+ * The current set of file extensions.
+ *
+ * @since 0.6
+ */
+ private final Set<String> extensions;
+
+ //
=======================================================================================================================
+ // Constructors
+ //
=======================================================================================================================
+
+ /**
+ * @param parent the parent control
+ * @since 0.6
+ */
+ public FilteredFileExtensionEditor( Composite parent ) {
+ super(FILTERED_FILE_EXTENSIONS_PREFERENCE,
dnaPreferencePageFilteredFileExtensionsLabel.text(), parent);
+ this.extensions = new TreeSet<String>();
+ }
+
+ //
=======================================================================================================================
+ // Methods
+ //
=======================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#createList(java.lang.String[])
+ * @since 0.6
+ */
+ @Override
+ protected String createList( String[] items ) {
+ return Utils.combineTokens(items, FILE_EXT_DELIMITER);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
+ * @since 0.6
+ */
+ @Override
+ protected String getNewInputObject() {
+ NewItemDialog dialog = new NewItemDialog(getShell(),
newFilteredFileExtensionDialogTitle.text(),
+
newFilteredFileExtensionDialogLabel.text(), this);
+
+ 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.eclipse.jface.preference.ListEditor#parseString(java.lang.String)
+ * @since 0.6
+ */
+ @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;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent)
+ * @since 0.6
+ */
+ @Override
+ public void verifyText( VerifyEvent event ) {
+ for (char c : FILE_EXT_INVALID_CHARS.toCharArray()) {
+ if (c == event.character) {
+ event.doit = false;
+ break;
+ }
+ }
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFileExtensionEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFoldersEditor.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFoldersEditor.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFoldersEditor.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,122 @@
+package org.jboss.dna.web.jcr.rest.client.swt.preferences;
+
+import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.FILTERED_FOLDER_NAMES_PREFERENCE;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.dnaPreferencePageFilteredFolderNamesLabel;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.newFilteredFolderNameDialogLabel;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.newFilteredFolderNameDialogTitle;
+import static
org.jboss.dna.web.jcr.rest.client.swt.preferences.PrefUtils.FOLDER_NAME_DELIMITER;
+import static
org.jboss.dna.web.jcr.rest.client.swt.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;
+import org.jboss.dna.web.jcr.rest.client.swt.Utils;
+
+/**
+ * The <code>FilteredFoldersEditor</code> is an editor for managing a set of
folder names.
+ *
+ * @since 0.6
+ */
+public final class FilteredFoldersEditor extends ListEditor implements VerifyListener {
+
+ //
=======================================================================================================================
+ // Fields
+ //
=======================================================================================================================
+
+ /**
+ * The current set of folder names.
+ *
+ * @since 0.6
+ */
+ private final Set<String> folderNames;
+
+ //
=======================================================================================================================
+ // Constructors
+ //
=======================================================================================================================
+
+ /**
+ * @param parent the parent control
+ * @since 0.6
+ */
+ public FilteredFoldersEditor( Composite parent ) {
+ super(FILTERED_FOLDER_NAMES_PREFERENCE,
dnaPreferencePageFilteredFolderNamesLabel.text(), parent);
+ this.folderNames = new TreeSet<String>();
+ }
+
+ //
=======================================================================================================================
+ // Methods
+ //
=======================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#createList(java.lang.String[])
+ * @since 0.6
+ */
+ @Override
+ protected String createList( String[] items ) {
+ return Utils.combineTokens(items, FOLDER_NAME_DELIMITER);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
+ * @since 0.6
+ */
+ @Override
+ protected String getNewInputObject() {
+ NewItemDialog dialog = new NewItemDialog(getShell(),
newFilteredFolderNameDialogTitle.text(),
+ newFilteredFolderNameDialogLabel.text(),
this);
+
+ 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.eclipse.jface.preference.ListEditor#parseString(java.lang.String)
+ * @since 0.6
+ */
+ @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;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent)
+ * @since 0.6
+ */
+ @Override
+ public void verifyText( VerifyEvent event ) {
+ for (char c : FOLDER_NAME_INVALID_CHARS.toCharArray()) {
+ if (c == event.character) {
+ event.doit = false;
+ break;
+ }
+ }
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/FilteredFoldersEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewFileExtensionDialog.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewFileExtensionDialog.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewFileExtensionDialog.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,156 +0,0 @@
-package org.jboss.dna.web.jcr.rest.client.swt.preferences;
-
-import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.newFileExtensionDialogLabel;
-import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.newFileExtensionDialogTitle;
-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.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-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;
-
-/**
- * A <code>NewFileExtensionDialog</code> allows the user to enter a file
extension that they wish to be filtered out of all
- * publishing operations.
- *
- * @since 0.6
- */
-public final class NewFileExtensionDialog extends Dialog implements ModifyListener,
VerifyListener {
-
- //
=======================================================================================================================
- // Fields
- //
=======================================================================================================================
-
- /**
- * The contents of the extension text field.
- *
- * @since 0.6
- */
- private String extension;
-
- //
=======================================================================================================================
- // Constructors
- //
=======================================================================================================================
-
- /**
- * @param parentShell the parent shell
- * @since 0.6
- */
- protected NewFileExtensionDialog( Shell parentShell ) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- //
=======================================================================================================================
- // Methods
- //
=======================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- * @since 0.6
- */
- @Override
- protected void configureShell( Shell newShell ) {
- newShell.setText(newFileExtensionDialogTitle.text());
- super.configureShell(newShell);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int,
java.lang.String, boolean)
- * @since 0.6
- */
- @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)
- * @since 0.6
- */
- @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(newFileExtensionDialogLabel.text());
-
- Text textField = new Text(pnlEditor, SWT.BORDER);
- textField.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
- textField.addVerifyListener(this);
- textField.addModifyListener(this);
-
- return panel;
- }
-
- /**
- * @return the file extension or <code>null</code> if dialog was
canceled
- * @since 0.6
- */
- public String getFileExtension() {
- if (getReturnCode() == OK) {
- return this.extension;
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- * @since 0.6
- */
- @Override
- public void modifyText( ModifyEvent event ) {
- // disable OK button if text field does not have any characters
- this.extension = ((Text)event.widget).getText();
- boolean enable = (this.extension.length() != 0);
-
- if (getButton(OK).getEnabled() != enable) {
- getButton(OK).setEnabled(enable);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent)
- * @since 0.6
- */
- @Override
- public void verifyText( VerifyEvent event ) {
- // only allow letters, numbers, backspace, and delete
- if (!Character.isLetterOrDigit(event.character) && (event.character !=
'\b') && (event.character != '\u007F')) {
- event.doit = false;
- }
- }
-
-}
Copied:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewItemDialog.java
(from rev 1194,
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewFileExtensionDialog.java)
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewItemDialog.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewItemDialog.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,196 @@
+package org.jboss.dna.web.jcr.rest.client.swt.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.jboss.dna.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.
+ *
+ * @since 0.6
+ */
+public final class NewItemDialog extends Dialog implements ModifyListener {
+
+ //
=======================================================================================================================
+ // Fields
+ //
=======================================================================================================================
+
+ /**
+ * The label describing the new item.
+ *
+ * @since 0.6
+ */
+ private final String label;
+
+ /**
+ * The contents of the new item text field.
+ *
+ * @since 0.6
+ */
+ private String newItem;
+
+ /**
+ * The dialog title.
+ *
+ * @since 0.6
+ */
+ private final String title;
+
+ /**
+ * The listener verifying input characters.
+ *
+ * @since 0.6
+ */
+ 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>)
+ * @since 0.6
+ */
+ 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);
+ }
+
+ //
=======================================================================================================================
+ // Methods
+ //
=======================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ * @since 0.6
+ */
+ @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)
+ * @since 0.6
+ */
+ @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)
+ * @since 0.6
+ */
+ @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
+ * @since 0.6
+ */
+ public String getNewItem() {
+ if (getReturnCode() == OK) {
+ return this.newItem;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
+ * @since 0.6
+ */
+ @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)
+ * @since 0.6
+ */
+ @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);
+ }
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/NewItemDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PrefUtils.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PrefUtils.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PrefUtils.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -24,8 +24,15 @@
package org.jboss.dna.web.jcr.rest.client.swt.preferences;
import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.FILTERED_FILE_EXTENSIONS_PREFERENCE;
+import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.FILTERED_FOLDER_NAMES_PREFERENCE;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.prefUtilsPropertyFileNotFound;
+import static
org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n.prefUtilsPropertyNotFound;
+import java.io.InputStream;
+import java.util.Properties;
import org.eclipse.jface.preference.IPreferenceStore;
import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.Utils;
@@ -38,6 +45,136 @@
public final class PrefUtils {
//
=======================================================================================================================
+ // Constants
+ //
=======================================================================================================================
+
+ /**
+ * The name of the properties file located in this package.
+ */
+ private static final String PREFERENCES_FILE = "dnaPrefs.properties";
//$NON-NLS-1$
+
+ /**
+ * 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 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"; //$NON-NLS-1$
+
+ /**
+ * 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"; //$NON-NLS-1$
+
+ /**
+ * 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"; //$NON-NLS-1$
+
+ /**
+ * 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 = "*?<>|/\\:;."; //$NON-NLS-1$
+ 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 = "*?<>|/\\:;"; //$NON-NLS-1$
+ Activator.getDefault().log(new Status(Severity.ERROR,
+
prefUtilsPropertyNotFound.text(FOLDER_NAME_INVALID_CHARS_PREF_NAME), null));
+ }
+ }
+
+ //
=======================================================================================================================
// Class Methods
//
=======================================================================================================================
@@ -46,10 +183,18 @@
* @since 0.6
*/
public static String[] getFilteredFileExtensions() {
- return getListPropertyValue(FILTERED_FILE_EXTENSIONS_PREFERENCE, ',',
true);
+ return getListPropertyValue(FILTERED_FILE_EXTENSIONS_PREFERENCE,
FILE_EXT_DELIMITER, true);
}
/**
+ * @return the folder names being filtered out of publishing operations (never null)
+ * @since 0.6
+ */
+ 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
* @param delimiter the character separating the items in the property value
* @param removeDuplicates a flag indicating if duplicate items should be removed
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PublishingFileFilter.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PublishingFileFilter.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PublishingFileFilter.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,107 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.preferences;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.jboss.dna.common.util.CheckArg;
+
+/**
+ * The <code>PublishingFileFilter</code> is a file filter that uses the DNA
preferences when filtering files.
+ *
+ * @since 0.6
+ */
+public final class PublishingFileFilter {
+
+ //
=======================================================================================================================
+ // Fields
+ //
=======================================================================================================================
+
+ /**
+ * The file extensions that should not be involved in publishing operations.
+ */
+ private final String[] filteredFileExtensions;
+
+ /**
+ * The folder names that should not be involved in publishing operations.
+ */
+ private final String[] filteredFolderNames;
+
+ //
=======================================================================================================================
+ // Constructors
+ //
=======================================================================================================================
+
+ /**
+ * Construct a filter using the current DNA preferences.
+ */
+ public PublishingFileFilter() {
+ this.filteredFileExtensions = PrefUtils.getFilteredFileExtensions();
+ this.filteredFolderNames = PrefUtils.getFilteredFolderNames();
+ }
+
+ //
=======================================================================================================================
+ // 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"); //$NON-NLS-1$
+
+ if (resource instanceof IFolder) {
+ String name = resource.getName();
+
+ // see if folder name has been filtered
+ for (String filteredName : this.filteredFolderNames) {
+ if (filteredName.equals(name)) {
+ return false;
+ }
+ }
+
+ // check parent
+ if (resource.getParent() != null) {
+ return accept(resource.getParent());
+ }
+ } else if (resource instanceof IFile) {
+ // see if file extension has been filtered
+ for (String extension : this.filteredFileExtensions) {
+ if (resource.getFullPath().toString().endsWith('.' + extension))
{
+ return false;
+ }
+ }
+
+ // check parent
+ if (resource.getParent() != null) {
+ return accept(resource.getParent());
+ }
+ }
+
+ // must be project
+ return true;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/PublishingFileFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/dnaPrefs.properties
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/dnaPrefs.properties
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/dnaPrefs.properties 2009-09-17
19:46:22 UTC (rev 1230)
@@ -0,0 +1,32 @@
+#
+# JBoss DNA (
http://www.jboss.org/dna)
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+# See the AUTHORS.txt file in the distribution for a full listing of
+# individual contributors.
+#
+# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+# is licensed to you under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# JBoss DNA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+#
+
+# 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.
+
+fileExtension.delimiter = ,
+fileExtension.invalidChars = *?<>|/\:;.
+
+folderName.delimiter = ,
+folderName.invalidChars = *?<>|/\:;
\ No newline at end of file
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/preferences/dnaPrefs.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaContentProvider.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaContentProvider.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaContentProvider.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -335,6 +335,11 @@
}
display.asyncExec(new Runnable() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Runnable#run()
+ */
@SuppressWarnings( "synthetic-access" )
@Override
public void run() {
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaMessageConsole.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaMessageConsole.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/DnaMessageConsole.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -34,6 +34,7 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.console.AbstractConsole;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
@@ -58,6 +59,16 @@
//
=======================================================================================================================
/**
+ * Start tag for adding emphasis to a message. Tag will appear in a properties file.
+ */
+ private static final String EMPHASIS_START_TAG = "<em>";
//$NON-NLS-1$
+
+ /**
+ * End tag for adding emphasis to a message. Tag will appear in a properties file.
+ */
+ private static final String EMPHASIS_END_TAG = "</em>";
//$NON-NLS-1$
+
+ /**
* The identifier and type of the DNA Message Console.
*
* @since 0.6
@@ -104,32 +115,6 @@
}
/**
- * @param message the message being written to the console (never
<code>null</code>)
- * @param emphasize indicates if the message should be emphasized in the console
- * @since 0.6
- */
- public static void write( String message,
- boolean emphasize ) {
- CheckArg.isNotNull(message, "message"); //$NON-NLS-1$
- DnaMessageConsole console = getDnaConsole();
- console.print(message, emphasize, false, null);
- }
-
- /**
- * @param message the message being written to the console
- * @param file the file whose full path, which is contained in the message, will be
made into a hyperlink (may be
- * <code>null</code>)
- * @since 0.6
- */
- public static void write( String message,
- IFile file ) {
- CheckArg.isNotNull(message, "message"); //$NON-NLS-1$
-
- DnaMessageConsole console = getDnaConsole();
- console.print(message, false, false, file);
- }
-
- /**
* Adds a line feed to the console after the message is printed.
*
* @param message the message being written to the console (never
<code>null</code>)
@@ -153,7 +138,7 @@
CheckArg.isNotNull(message, "message"); //$NON-NLS-1$
DnaMessageConsole console = getDnaConsole();
- console.print(message, false, true, file);
+ console.print(message, true, file);
}
//
=======================================================================================================================
@@ -194,16 +179,15 @@
/**
* @param message the message being written to the console (never
<code>null</code>)
- * @param emphasize a flag indicating if the message should be emphasized
* @param doLineFeedAtEnd a flag indicating if a line feed should be done after
writing the message
* @param file the file to create a hyperlink for (may be
<code>null</code>)
* @since 0.6
*/
private void print( final String message,
- final boolean emphasize,
final boolean doLineFeedAtEnd,
final IFile file ) {
final Display display = Display.getDefault();
+ final AbstractConsole console = this;
if (!display.isDisposed()) {
display.asyncExec(new Runnable() {
@@ -216,23 +200,55 @@
@Override
public void run() {
if (!display.isDisposed()) {
- MessageConsoleStream stream = setup();
+ // bring focus to this view
+ console.activate();
- // configure stream
- if (emphasize) {
- stream.setColor(display.getSystemColor(SWT.COLOR_BLUE));
- }
-
// register document listener before writing to console
if (file != null) {
addDocumentListener(message, file);
}
- // write message
+ MessageConsoleStream stream = newMessageStream();
+
+ for (int beginIndex = 0, endIndex = 0, msgLength =
message.length(); endIndex < msgLength;) {
+ int startTagIndex = message.indexOf(EMPHASIS_START_TAG,
beginIndex);
+ int endTagIndex = ((startTagIndex < 0) ? -1 :
message.indexOf(EMPHASIS_END_TAG,
+
startTagIndex
+
+ EMPHASIS_START_TAG.length()));
+
+ // ignore tags if both tags are not found
+ if ((endTagIndex < 0) && (startTagIndex >= 0))
{
+ startTagIndex = -1;
+ }
+
+ // determine if in emphasize mode
+ boolean emphasize = (beginIndex == startTagIndex);
+
+ // skip over start tag and set stream to bold font style
+ if (emphasize) {
+ beginIndex += EMPHASIS_START_TAG.length();
+ stream.setFontStyle(SWT.BOLD);
+ endIndex = endTagIndex;
+ } else {
+ stream.setFontStyle(SWT.NORMAL);
+ endIndex = ((startTagIndex < 0) ? msgLength :
startTagIndex);
+ }
+
+ stream.print(message.substring(beginIndex, endIndex));
+
+ // need to construct a new stream as changes to font style
seem to only work one time
+ stream = newMessageStream();
+
+ // skip over end tag
+ if (emphasize) {
+ endIndex += EMPHASIS_END_TAG.length();
+ }
+
+ beginIndex = endIndex;
+ }
+
if (doLineFeedAtEnd) {
- stream.println(message);
- } else {
- stream.print(message);
+ stream.println();
}
}
}
@@ -240,17 +256,6 @@
}
}
- /**
- * Performs any setup required before writing to the console.
- *
- * @return the stream that can be written to
- * @since 0.6
- */
- MessageConsoleStream setup() {
- activate(); // show and focus console view
- return newMessageStream();
- }
-
//
===========================================================================================================================
// Inner Class
//
===========================================================================================================================
@@ -301,7 +306,7 @@
public HyperlinkCreator( String message,
DnaMessageConsole console,
IFile file ) {
- this.message = message;
+ this.message = message.replaceAll("<em>",
"").replaceAll("\\Q</em>\\E", ""); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
this.console = console;
this.file = file;
}
@@ -343,7 +348,7 @@
throw new
BadLocationException(RestClientI18n.dnaConsoleFilePathNotFoundMsg.text(target));
}
- this.console.addHyperlink(new FileLink(file, null, -1, -1, -1),
region.getOffset() + 1, target.length());
+ this.console.addHyperlink(new FileLink(file, null, -1, -1, -1),
(region.getOffset() + index), target.length());
// created hyperlink so no need to listen any longer
document.removeDocumentListener(this);
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -93,7 +93,7 @@
*
* @since 0.6
*/
- private BaseSelectionListenerAction newAction;
+ private Action newAction;
/**
* The viewer's content and label provider.
@@ -124,6 +124,11 @@
private void constructActions() {
// the collapse all action is always enabled
this.collapseAllAction = new Action() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
@Override
public void run() {
getViewer().collapseAll();
@@ -133,9 +138,9 @@
this.collapseAllAction.setToolTipText(RestClientI18n.collapseActionToolTip.text());
this.collapseAllAction.setImageDescriptor(Activator.getDefault().getImageDescriptor(COLLAPSE_ALL_IMAGE));
- // the refresh action is always enabled
+ // the reconnect action tries to ping a selected server
this.reconnectAction = new ReconnectToServerAction(this.viewer);
- getServerManager().addRegistryListener(this.reconnectAction);
+ this.viewer.addSelectionChangedListener(this.reconnectAction);
// the shell used for dialogs that the actions display
Shell shell = this.getSite().getShell();
@@ -150,7 +155,6 @@
// the new server action is always enabled
this.newAction = new NewServerAction(shell, getServerManager());
- this.viewer.addSelectionChangedListener(this.newAction);
}
/**
@@ -194,12 +198,22 @@
ColumnViewerToolTipSupport.enableFor(this.viewer);
this.viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
@Override
public void selectionChanged( SelectionChangedEvent event ) {
handleSelectionChanged(event);
}
});
this.viewer.addDoubleClickListener(new IDoubleClickListener() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
@Override
public void doubleClick( DoubleClickEvent arg0 ) {
handleDoubleClick();
@@ -286,7 +300,12 @@
*/
@Override
public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
- this.viewer.refresh();
+ if (event.isNew() || event.isUpdate()) {
+ this.viewer.refresh();
+ } else {
+ this.viewer.remove(event.getServer());
+ }
+
return null;
}
Deleted:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -1,388 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.swt.wizards;
-
-import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_PUBLISHING_JOB_FAMILY;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.PLUGIN_ID;
-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;
-import org.eclipse.core.runtime.jobs.Job;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.web.jcr.rest.client.ServerManager;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
-import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.DnaResourceHelper;
-import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.swt.views.DnaContentProvider;
-import org.jboss.dna.web.jcr.rest.client.swt.views.DnaMessageConsole;
-
-/**
- * The <code>PublishJob</code> publishes or unpublishes one or more files
using the {@link ServerManager}.
- *
- * @since 0.6
- */
-public final class PublishJob extends Job {
-
- //
===========================================================================================================================
- // Constants
- //
===========================================================================================================================
-
- /**
- * The job type.
- *
- * @since 0.6
- */
- public enum Type {
- /**
- * Indicates a publish job.
- *
- * @since 0.6
- */
- PUBLISH,
-
- /**
- * Indicates an unpublish job.
- *
- * @since 0.6
- */
- UNPUBLISH
- }
-
- /**
- * A unique job identifier given to each publishing/unpublishing job.
- *
- * @since 0.6
- */
- private static final AtomicInteger JOB_ID = new AtomicInteger(1);
-
- //
===========================================================================================================================
- // Class Methods
- //
===========================================================================================================================
-
- /**
- * @param type the job type (never <code>null</code>)
- * @param jobId the job identifier
- * @return the job name
- * @since 0.6
- */
- private static String getJobName( Type type,
- int jobId ) {
- CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
-
- if (Type.PUBLISH == type) {
- return RestClientI18n.publishJobPublishName.text(jobId);
- }
-
- // unpublish
- return RestClientI18n.publishJobUnpublishName.text(jobId);
- }
-
- //
===========================================================================================================================
- // Fields
- //
===========================================================================================================================
-
- /**
- * The files being published or unpublished.
- *
- * @since 0.6
- */
- private final List<IFile> files;
-
- /**
- * The unique job identifier.
- *
- * @since 0.6
- */
- private final int jobId;
-
- /**
- * The job type.
- *
- * @since 0.6
- */
- private final Type type;
-
- /**
- * The workspace to use when publishing or unpublishing.
- *
- * @since 0.6
- */
- private final Workspace workspace;
-
- //
===========================================================================================================================
- // 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>)
- * @since 0.6
- */
- public PublishJob( Type type,
- List<IFile> files,
- Workspace workspace ) {
- super(getJobName(type, JOB_ID.incrementAndGet()));
-
- CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
-
- this.type = type;
- this.files = files;
- this.workspace = workspace;
- this.jobId = JOB_ID.get();
-
- setUser(true); // allow user to run in background
- }
-
- //
===========================================================================================================================
- // Methods
- //
===========================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
- * @since 0.6
- */
- @Override
- public boolean belongsTo( Object family ) {
- return DNA_PUBLISHING_JOB_FAMILY.equals(family);
- }
-
- /**
- * @return the server manager
- * @since 0.6
- */
- private ServerManager getServerManager() {
- return Activator.getDefault().getServerManager();
- }
-
- /**
- * @return <code>true</code> if a publishing job
- * @since 0.6
- */
- private boolean isPublishing() {
- return (this.type == Type.PUBLISH);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- * @since 0.6
- */
- @Override
- protected IStatus run( IProgressMonitor monitor ) {
- assert (this.workspace != null);
- long startTime = System.currentTimeMillis();
-
- try {
- int fileCount = this.files.size();
- String name = (isPublishing() ?
RestClientI18n.publishJobPublishTaskName.text(this.jobId)
- :
RestClientI18n.publishJobUnpublishTaskName.text(this.jobId));
- monitor.beginTask(name, fileCount);
- monitor.setTaskName(name);
-
- String serverUrl = this.workspace.getServer().getUrl();
- String repositoryName = this.workspace.getRepository().getName();
- String workspaceName = this.workspace.getName();
-
- // write initial message to console
- if (isPublishing()) {
-
DnaMessageConsole.writeln(RestClientI18n.publishJobPublish.text(this.jobId,
-
serverUrl,
-
repositoryName,
-
workspaceName,
-
fileCount));
- } else {
-
DnaMessageConsole.writeln(RestClientI18n.publishJobUnpublish.text(this.jobId,
-
serverUrl,
-
repositoryName,
-
workspaceName,
-
fileCount));
- }
-
- DnaResourceHelper resourceHelper = new
DnaResourceHelper(getServerManager());
- int numProcessed = 0;
-
- // process the files
- for (IFile eclipseFile : this.files) {
- if (monitor.isCanceled()) {
- if (isPublishing()) {
-
DnaMessageConsole.writeln(RestClientI18n.publishJobPublishCanceledMsg.text(this.jobId,
-
serverUrl,
-
repositoryName,
-
workspaceName,
-
numProcessed,
-
fileCount));
- } else {
-
DnaMessageConsole.writeln(RestClientI18n.publishJobUnpublishCanceledMsg.text(this.jobId,
-
serverUrl,
-
repositoryName,
-
workspaceName,
-
numProcessed,
-
fileCount));
- }
-
- throw new
InterruptedException(RestClientI18n.publishJobCanceled.text(jobId));
- }
-
- File file = eclipseFile.getLocation().toFile();
- String path = eclipseFile.getParent().getFullPath().toString();
- Status status = null;
-
- if (isPublishing()) {
- status = getServerManager().publish(this.workspace, path, file);
-
- // set persistent property on resource indicating it has been
published
- if (!status.isError()) {
- resourceHelper.addPublishedProperty(eclipseFile, workspace);
- DnaContentProvider decorator =
DnaContentProvider.getDecorator();
-
- if (decorator != null) {
- // decorator.refresh(eclipseFile);
- }
- }
- } else {
- status = getServerManager().unpublish(this.workspace, path, file);
-
- // clear persistent property on resource indicating it has been
unpublished
- if (!status.isError()) {
- resourceHelper.removePublishedProperty(eclipseFile, workspace);
- DnaContentProvider decorator =
DnaContentProvider.getDecorator();
-
- if (decorator != null) {
- // decorator.refresh(eclipseFile);
- }
- }
- }
-
- ++numProcessed;
- monitor.worked(1);
-
- // write outcome message to console
- if (isPublishing() && status.isOk()) {
- URL url = getServerManager().getUrl(file, path, this.workspace);
- writeToConsole(eclipseFile, url, status);
- } else {
- writeToConsole(eclipseFile, null, status);
- }
- }
-
- return org.eclipse.core.runtime.Status.OK_STATUS;
- } catch (Exception e) {
- String msg = null;
-
- if (e instanceof InterruptedException) {
- msg = e.getLocalizedMessage();
- } else {
- msg = RestClientI18n.publishJobUnexpectedErrorMsg.text();
- }
-
- return new org.eclipse.core.runtime.Status(IStatus.ERROR, PLUGIN_ID, msg,
e);
- } finally {
- monitor.done();
-
- // add operation completed message
- String duration;
- long milliseconds = (System.currentTimeMillis() - startTime);
- long hours = milliseconds / (1000 * 60 * 60);
- long minutes = (milliseconds % (1000 * 60 * 60)) / (1000 * 60);
- long seconds = ((milliseconds % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
-
- if ((seconds > 0) || (minutes > 0) || (hours > 0)) {
- duration = RestClientI18n.publishJobLongDurationMsg.text(hours, minutes,
seconds);
- } else {
- duration = RestClientI18n.publishJobShortDurationMsg.text();
- }
-
- if (isPublishing()) {
-
DnaMessageConsole.writeln(RestClientI18n.publishJobPublishFinishedMsg.text(this.jobId,
duration));
- } else {
-
DnaMessageConsole.writeln(RestClientI18n.publishJobUnpublishFinishedMsg.text(this.jobId,
duration));
- }
- }
- }
-
- /**
- * Create a hyperlink in console.
- *
- * @param file the file involved in the publishing operation
- * @param url the destination file URL or <code>null</code>
- * @param status the status of the publishing operation
- * @since 0.6
- */
- private void writeToConsole( final IFile file,
- URL url,
- Status status ) {
- String message = null;
-
- if (status.isOk()) {
- if (isPublishing()) {
-
DnaMessageConsole.write(RestClientI18n.publishJobPublishFile.text(this.jobId,
file.getFullPath()), false);
-
DnaMessageConsole.write(RestClientI18n.publishJobPublishFile2.text(url.toString()),
true);
- message = ""; //$NON-NLS-1$
- } else {
- message = RestClientI18n.publishJobUnpublishFile.text(this.jobId,
file.getFullPath());
- }
- } else if (status.isError()) {
- if (isPublishing()) {
- message = RestClientI18n.publishJobPublishFileFailed.text(this.jobId,
file.getFullPath());
- } else {
- message = RestClientI18n.publishJobUnpublishFileFailed.text(this.jobId,
file.getFullPath());
- }
-
- // log
- Activator.getDefault().log(status);
- } else if (status.isWarning()) {
- if (isPublishing()) {
- message = RestClientI18n.publishJobPublishFileWarning.text(this.jobId,
file.getFullPath());
- } else {
- message = RestClientI18n.publishJobUnpublishFileWarning.text(this.jobId,
file.getFullPath());
- }
-
- // log
- Activator.getDefault().log(status);
- } else {
- if (isPublishing()) {
- message = RestClientI18n.publishJobPublishFileInfo.text(this.jobId,
file.getFullPath());
- } else {
- message = RestClientI18n.publishJobUnpublishFileInfo.text(this.jobId,
file.getFullPath());
- }
-
- // log
- Activator.getDefault().log(status);
- }
-
- // write to console creating a hyperlink
- DnaMessageConsole.writeln(message, file);
- }
-
-}
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -64,10 +64,9 @@
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.swt.Utils;
import org.jboss.dna.web.jcr.rest.client.swt.actions.NewServerAction;
-import org.jboss.dna.web.jcr.rest.client.swt.preferences.PrefUtils;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.PublishJob.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.preferences.PublishingFileFilter;
/**
* The <code>PublishPage</code> is a UI for publishing or unpublishing one or
more files to a DNA repository.
@@ -88,21 +87,65 @@
private static final String RECURSE_KEY = "recurse"; //$NON-NLS-1$
//
===========================================================================================================================
+ // Class Fields
+ //
===========================================================================================================================
+
+ /**
+ * Indicates if the file filter should be used.
+ *
+ * @since 0.6
+ */
+ private static boolean filterFiles = true;
+
+ //
===========================================================================================================================
// Class Methods
//
===========================================================================================================================
/**
+ * @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
+ * @since 0.6
+ */
+ private static List<IFile> findFiles( IContainer container,
+ boolean recurse,
+ PublishingFileFilter filter ) throws
CoreException {
+ List<IFile> result = new ArrayList<IFile>();
+
+ for (IResource member : container.members()) {
+ if (recurse && (member instanceof IContainer)) {
+ // don't select closed projects
+ if ((member instanceof IProject) && !((IProject)member).isOpen())
{
+ continue;
+ }
+
+ 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);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
* 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
* @since 0.6
*/
private static List<IFile> processResources( List<IResource> resources,
- boolean recurse ) throws CoreException
{
+ boolean recurse,
+ PublishingFileFilter filter ) throws
CoreException {
List<IFile> result = new ArrayList<IFile>();
// Project Map - the outer map. Its keys are IProjects and its values are a
Parent Map
@@ -128,6 +171,11 @@
IProject project = null;
List<IFile> files = null;
Map<IContainer, List<IFile>> parentMap = null;
+
+ // see if resource is filtered
+ if ((filter != null) && !filter.accept(resource)) {
+ continue;
+ }
if (resource instanceof IFile) {
IContainer parent = null; // project or folder
@@ -195,14 +243,14 @@
Map<IContainer, List<IFile>> parentMap =
projectMap.get(project);
if (parentMap == null) {
- result.addAll(Utils.findFiles(project, recurse));
+ result.addAll(findFiles(project, recurse, filter));
} else {
// process folders with no folder entries
for (IContainer folder : parentMap.keySet()) {
List<IFile> files = parentMap.get(folder);
if (files == null) {
- result.addAll(Utils.findFiles(folder, recurse));
+ result.addAll(findFiles(folder, recurse, filter));
}
}
}
@@ -257,11 +305,9 @@
private List<IFile> files;
/**
- * Indicates if the selected files should be filtered based on their file extension.
- *
- * @since 0.6
+ * The filter used to determine if a file should be included in publishing operations
(may be <code>null</code>).
*/
- private boolean filterFiles = true;
+ private PublishingFileFilter filter;
/**
* The control containing all the files being published or unpublished.
@@ -359,6 +405,9 @@
this.type = type;
this.resources = resources;
+
+ // filter should not be cached as preferences may change
+ this.filter = (filterFiles ? new PublishingFileFilter() : null);
}
//
===========================================================================================================================
@@ -399,6 +448,11 @@
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();
@@ -407,6 +461,11 @@
// 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();
@@ -471,6 +530,11 @@
// 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
@@ -490,6 +554,11 @@
chkRecurse.setToolTipText(RestClientI18n.publishPageRecurseCheckBoxToolTip.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(chkRecurse.getSelection());
@@ -498,6 +567,11 @@
// 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();
@@ -547,7 +621,7 @@
}
/**
- * @return the file to publish or unpublish (never <code>null</code>)
+ * @return the files to publish or unpublish (never <code>null</code>)
* @since 0.6
*/
public List<IFile> getFiles() {
@@ -596,7 +670,7 @@
saveRecurseSetting();
try {
- this.files = processResources(this.resources, isRecursing());
+ this.files = processResources(this.resources, isRecursing(), filter);
loadFiles();
} catch (CoreException e) {
Activator.getDefault().log(new Status(Severity.ERROR,
RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
@@ -682,39 +756,16 @@
/**
* 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)} has been called.
+ * Pre-condition is that {@link #processResources(List, boolean,
PublishingFileFilter)} has been called.
*
- * @return the number of files filtered out
* @since 0.6
*/
- private int loadFiles() {
+ private void loadFiles() {
this.lstResources.removeAll();
- String[] filteredExtensions = null;
- int numFiltered = 0;
-
- if (this.filterFiles) {
- filteredExtensions = PrefUtils.getFilteredFileExtensions();
- }
-
- LOADING:
for (IResource resource : this.files) {
- String filePath = resource.getFullPath().toString();
-
- // filter if necessary
- if (filteredExtensions != null) {
- for (String ext : filteredExtensions) {
- if (filePath.endsWith('.' + ext)) {
- ++numFiltered;
- continue LOADING; // don't add file
- }
- }
- }
-
- this.lstResources.add(filePath);
+ this.lstResources.add(resource.getFullPath().toString());
}
-
- return numFiltered;
}
/**
@@ -960,7 +1011,7 @@
this.recurse = isRecursing();
try {
- this.files = processResources(this.resources, this.recurse);
+ this.files = processResources(this.resources, this.recurse, this.filter);
} catch (CoreException e) {
Activator.getDefault().log(new Status(Severity.ERROR,
RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
}
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -35,7 +35,8 @@
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.PublishJob;
+import org.jboss.dna.web.jcr.rest.client.swt.jobs.PublishJob.Type;
/**
* @since 0.6
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java 2009-09-17
14:01:59 UTC (rev 1229)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java 2009-09-17
19:46:22 UTC (rev 1230)
@@ -167,6 +167,11 @@
}
txtUser.addModifyListener(new ModifyListener() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
@Override
public void modifyText( ModifyEvent e ) {
handleUserModified(((Text)e.widget).getText());
@@ -191,6 +196,11 @@
// listener for when value changes
txtPassword.addModifyListener(new ModifyListener() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
@Override
public void modifyText( ModifyEvent e ) {
handlePasswordModified(((Text)e.widget).getText());
@@ -212,6 +222,11 @@
// listener for when value changes
btn.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
@Override
public void widgetSelected( SelectionEvent e ) {
handleSavePasswordChanged(((Button)e.widget).getSelection());
@@ -220,6 +235,11 @@
// update page message first time selected to get rid of initial message by
forcing validation
btn.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
@Override
public void widgetSelected( SelectionEvent e ) {
updateInitialMessage();
@@ -267,6 +287,11 @@
this.btnTestConnection.setLayoutData(gd);
this.btnTestConnection.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
@Override
public void widgetSelected( SelectionEvent e ) {
handleTestConnection();
@@ -293,6 +318,11 @@
}
txtUrl.addModifyListener(new ModifyListener() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
@Override
public void modifyText( ModifyEvent e ) {
handleUrlModified(((Text)e.widget).getText());
@@ -373,6 +403,11 @@
final boolean[] success = new boolean[1];
BusyIndicator.showWhile(null, new Runnable() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
success[0] = getServerManager().ping(server).isOk();