Author: elvisisking
Date: 2009-07-29 18:37:55 -0400 (Wed, 29 Jul 2009)
New Revision: 1139
Added:
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/icons/views/checkbox.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/edit_server.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/refresh.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
Removed:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/edit_server.gif
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath
branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
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/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java
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/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/i18n.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.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/PublishOperation.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.web.jcr.rest.client.swt.updatesite/artifacts.xml
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/content.xml
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/features/org.jboss.dna.web.jcr.rest.client.swt.feature_1.0.0.v20090708.jar
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/plugins/org.jboss.dna.web.jcr.rest.client.swt_1.0.0.jar
Log:
Finished implementation of PublishOperation. Added refresh to ServerView. Added popup
dialogs for when there is a problem accessing a server. Now depending on a jar of the
non-UI maven project that has all its dependencies included in the jar. Using URLDecoder
and URLEncoder instead of methods I had written. Did some work with sizing and setting
location of dialogs. Added a results dialog after a publish or unpublish operation is
finished (regardless if an error occurred). Setting DNA image on dialog title bars.
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath 2009-07-29 21:33:49 UTC (rev
1138)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath 2009-07-29 22:37:55 UTC (rev
1139)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry exported="true" kind="lib"
path="dna-web-jcr-rest-client-0.6-SNAPSHOT.jar"
sourcepath="dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib"
path="dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF 2009-07-29 21:33:49
UTC (rev 1138)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF 2009-07-29 22:37:55
UTC (rev 1139)
@@ -11,5 +11,5 @@
org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: dna-web-jcr-rest-client-0.6-SNAPSHOT.jar,
+Bundle-ClassPath: dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar,
dnaPublishUi.jar
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties 2009-07-29 21:33:49 UTC
(rev 1138)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties 2009-07-29 22:37:55 UTC
(rev 1139)
@@ -10,9 +10,9 @@
plugin.properties,\
icons/,\
plugin.xml,\
- dna-web-jcr-rest-client-0.6-SNAPSHOT.jar,\
LEGAL.txt,\
- AUTHORS.txt
+ AUTHORS.txt,\
+ dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
src.includes = src/,\
LEGAL.txt
source.dnaPublishUi.jar = src/
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Deleted:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT.jar
===================================================================
(Binary files differ)
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/checkbox.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/checkbox.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/edit_server.gif
===================================================================
(Binary files differ)
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/edit_server.gif
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/edit_server.gif
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/edit_server.gif 2009-07-29
22:37:55 UTC (rev 1139)
@@ -0,0 +1,3 @@
+GIF89a
+*�7
\ No newline at end of file
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/refresh.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/refresh.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java 2009-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -56,10 +56,10 @@
public static String NewServerActionText;
public static String NewServerActionToolTip;
+ public static String PublishOperationPublishNotAttemptedMsg;
public static String PublishOperationPublishTaskName;
- public static String PublishOperationPublishTitle;
+ public static String PublishOperationUnpublishNotAttemptedMsg;
public static String PublishOperationUnpublishTaskName;
- public static String PublishOperationUnpublishTitle;
public static String PublishPagePublishTitle;
public static String PublishPageLocationGroupTitle;
@@ -87,12 +87,25 @@
public static String PublishPageWorkspaceLabel;
public static String PublishPageWorkspacePublishToolTip;
public static String PublishPageWorkspaceUnpublishToolTip;
+
+ public static String PublishResultsDialogErrorPublishingMsg;
+ public static String PublishResultsDialogErrorUnpublishingMsg;
+ public static String PublishResultsDialogFileHeader;
+ public static String PublishResultsDialogMessageHeader;
+ public static String PublishResultsDialogPublishMsg;
+ public static String PublishResultsDialogTitle;
+ public static String PublishResultsDialogUnpublishMsg;
public static String PublishWizardPublishErrorMsg;
public static String PublishWizardPublishTitle;
public static String PublishWizardUnpublishTitle;
public static String PublishWizardUnpublishErrorMsg;
-
+
+ public static String RefreshActionToolTip;
+
+ public static String ServerManagerGetRepositoriesExceptionMsg;
+ public static String ServerManagerGetWorkspacesExceptionMsg;
+
public static String ServerPageAuthenticationGroupTitle;
public static String ServerPageInvalidServerProperties;
public static String ServerPageOkStatusMsg;
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -56,6 +56,8 @@
String VIEWS_ICON_FOLDER = ICON_PATH + "views/"; //$NON-NLS-1$
+ String CHECKBOX_IMAGE_PATH = VIEWS_ICON_FOLDER + "checkbox.gif";
//$NON-NLS-1$
+
String COLLAPSE_ALL_IMAGE_PATH = VIEWS_ICON_FOLDER + "collapse_all.gif";
//$NON-NLS-1$
String DNA_WINDOW_IMAGE_PATH = VIEWS_ICON_FOLDER + "dna_window.png";
//$NON-NLS-1$
@@ -64,6 +66,8 @@
String NEW_SERVER_IMAGE_PATH = VIEWS_ICON_FOLDER + "new_server.gif";
//$NON-NLS-1$
+ String REFRESH_IMAGE_PATH = VIEWS_ICON_FOLDER + "refresh.gif";
//$NON-NLS-1$
+
//
// /icons/wizards/
//
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -24,6 +24,11 @@
package org.jboss.dna.web.jcr.rest.client.swt;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
@@ -38,6 +43,42 @@
//
===========================================================================================================================
/**
+ * Sizes the shell to the minimum of it's current size or the width and height
display percentages.
+ *
+ * @param shell the shell being resized if necessary and located
+ * @param widthPercentage a number between 1 and 100 indicating a percentage of the
screen size (defaults to 50 if bad value)
+ * @param heightPercentage a number between 1 and 100 indicating a percentage of the
screen size (defaults to 50 if bad value)
+ * @since 0.6
+ */
+ public static void sizeShellRelativeToDisplayAndCentery( Shell shell,
+ int widthPercentage,
+ int heightPercentage ) {
+ if ((widthPercentage < 1) || (widthPercentage > 100)) {
+ widthPercentage = 50;
+ }
+
+ if ((heightPercentage < 1) || (heightPercentage > 100)) {
+ heightPercentage = 50;
+ }
+
+ // size
+ Rectangle shellBounds = shell.getBounds();
+ Rectangle displayBounds = shell.getDisplay().getClientArea();
+ int scaledWidth = displayBounds.width * widthPercentage / 100;
+ int scaledHeight = displayBounds.height * heightPercentage / 100;
+ shell.setSize(Math.min(scaledWidth, shellBounds.width), Math.min(scaledHeight,
shellBounds.height));
+ Point size = shell.getSize();
+
+ // center
+ int excessX = displayBounds.width - size.x;
+ int excessY = displayBounds.height - size.y;
+ int x = displayBounds.x + (excessX / 2);
+ int y = displayBounds.y + (excessY / 2);
+
+ shell.setLocation(x, y);
+ }
+
+ /**
* Converts the non-Eclipse status severity to an Eclipse severity level. An {@link
Status.Severity#UNKNOWN unknown status} is
* converted to {@link IStatus#CANCEL cancel}. A {@link Status.Severity} is
*
@@ -70,6 +111,31 @@
return Severity.UNKNOWN;
}
+ /**
+ * The OK status does not have an image.
+ *
+ * @param status the status whose image is being requested
+ * @return the image or <code>null</code> if no associated image for the
status severity
+ * @since 0.6
+ */
+ public static Image getImage( Status status ) {
+ String imageId = null;
+
+ if (status.isError()) {
+ imageId = ISharedImages.IMG_OBJS_ERROR_TSK;
+ } else if (status.isInfo()) {
+ imageId = ISharedImages.IMG_OBJS_INFO_TSK;
+ } else if (status.isWarning()) {
+ imageId = ISharedImages.IMG_OBJS_WARN_TSK;
+ }
+
+ if (imageId != null) {
+ return Activator.getDefault().getSharedImage(imageId);
+ }
+
+ return null;
+ }
+
//
===========================================================================================================================
// Constructors
//
===========================================================================================================================
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IResource;
@@ -111,7 +112,16 @@
// run wizard
try {
- new WizardDialog(shell, new PublishWizard(this.type, resources,
Activator.getDefault().getServerManager())).open();
+ WizardDialog dialog = new WizardDialog(shell, new PublishWizard(this.type,
resources,
+
Activator.getDefault().getServerManager())) {
+ @Override
+ protected void configureShell( Shell newShell ) {
+ super.configureShell(newShell);
+
newShell.setImage(Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH));
+ }
+ };
+
+ dialog.open();
} catch (CoreException e) {
String msg = null;
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.EDIT_SERVER_IMAGE_PATH;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
@@ -98,7 +99,15 @@
@Override
public void run() {
ServerWizard wizard = new ServerWizard(this.serverManager,
this.serverBeingEdited);
- new WizardDialog(this.shell, wizard).open();
+ WizardDialog dialog = new WizardDialog(this.shell, wizard) {
+ @Override
+ protected void configureShell( Shell newShell ) {
+ super.configureShell(newShell);
+
newShell.setImage(Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH));
+ }
+ };
+
+ dialog.open();
}
/**
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.NEW_SERVER_IMAGE_PATH;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
@@ -88,7 +89,15 @@
@Override
public void run() {
ServerWizard wizard = new ServerWizard(this.serverManager);
- new WizardDialog(this.shell, wizard).open();
+ WizardDialog dialog = new WizardDialog(this.shell, wizard) {
+ @Override
+ protected void configureShell( Shell newShell ) {
+ super.configureShell(newShell);
+
newShell.setImage(Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH));
+ }
+ };
+
+ dialog.open();
}
}
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -0,0 +1,336 @@
+/*
+ * 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.dialogs;
+
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.CHECKBOX_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+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.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.Utils;
+import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation;
+
+/**
+ * The <code>DeleteServerDialog</code> class provides a UI for deleting a
{@link Server server}.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public class PublishingResultsDialog extends MessageDialog {
+
+ //
===========================================================================================================================
+ // Constants
+ //
===========================================================================================================================
+
+ private static final int FILE_COL = 0;
+
+ private static final int SEVERITY_COL = 1;
+
+ private static final int MESSAGE_COL = 2;
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * An error caught during the publish operation (may be
<code>null</code>).
+ *
+ * @since 0.6
+ */
+ private Throwable error;
+
+ /**
+ * The list of files that were published or unpublished.
+ *
+ * @since 0.6
+ */
+ private final List<IFile> files;
+
+ /**
+ * The status of the publish or unpublish operation for each file.
+ *
+ * @since 0.6
+ */
+ private final List<Status> statuses;
+
+ /**
+ * The operation type.
+ *
+ * @since 0.6
+ */
+ private final PublishOperation.Type type;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param parentShell the dialog parent
+ * @param type the operation type (publish or unpublish)
+ * @param files the files used in the operation
+ * @param statuses the operation status of each file
+ * @since 0.6
+ */
+ public PublishingResultsDialog( Shell parentShell,
+ PublishOperation.Type type,
+ List<IFile> files,
+ List<Status> statuses ) {
+ super(parentShell, I18n.PublishResultsDialogTitle,
Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH), null,
+ MessageDialog.INFORMATION, new String[] {IDialogConstants.OK_LABEL}, 0);
+ this.files = files;
+ this.statuses = statuses;
+ this.type = type;
+
+ // make sure dialog is resizable
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ /**
+ * @param parentShell the dialog parent
+ * @param type the operation type (publish or unpublish)
+ * @param files the files used in the operation
+ * @param statuses the operation status of each file
+ * @param error an unexpected error caught during the publish operation
+ * @since 0.6
+ */
+ public PublishingResultsDialog( Shell parentShell,
+ PublishOperation.Type type,
+ List<IFile> files,
+ List<Status> statuses,
+ Throwable error ) {
+ super(parentShell, I18n.PublishResultsDialogTitle,
Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH), null,
+ MessageDialog.ERROR, new String[] {IDialogConstants.OK_LABEL}, 0);
+ this.files = files;
+ this.statuses = statuses;
+ this.type = type;
+ this.error = error;
+
+ // make sure dialog is resizable
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.MessageDialog#configureShell(org.eclipse.swt.widgets.Shell)
+ * @since 0.6
+ */
+ @Override
+ protected void configureShell( Shell shell ) {
+ super.configureShell(shell);
+
+ // now set message
+ if (this.type == PublishOperation.Type.PUBLISH) {
+ this.message = ((this.error == null) ? I18n.PublishResultsDialogPublishMsg :
I18n.bind(I18n.PublishResultsDialogErrorPublishingMsg,
+
this.error.getLocalizedMessage()));
+ } else {
+ this.message = ((this.error == null) ? I18n.PublishResultsDialogUnpublishMsg
: I18n.bind(I18n.PublishResultsDialogErrorUnpublishingMsg,
+
this.error.getLocalizedMessage()));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.window.Window#constrainShellSize()
+ * @since 0.6
+ */
+ @Override
+ protected void constrainShellSize() {
+ super.constrainShellSize();
+ Utils.sizeShellRelativeToDisplayAndCentery(getShell(), 50, 50);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
+ * @since 0.6
+ */
+ @Override
+ protected Control createCustomArea( Composite parent ) {
+ Composite pnl = new Composite(parent, SWT.NONE);
+ pnl.setLayout(new GridLayout());
+ GridData gd = new GridData(SWT.LEFT, SWT.CENTER, true, true);
+ pnl.setLayoutData(gd);
+
+ TableViewer viewer = new TableViewer(pnl, SWT.V_SCROLL | SWT.H_SCROLL |
SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+ ResultsProvider provider = new ResultsProvider();
+ viewer.setContentProvider(provider);
+ viewer.setLabelProvider(provider);
+
+ Table table = viewer.getTable();
+ table.setLayout(new GridLayout());
+ table.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true));
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumn col = new TableColumn(table, SWT.LEFT);
+ col.setText(I18n.PublishResultsDialogFileHeader);
+
+ col = new TableColumn(table, SWT.LEFT);
+ col.setResizable(false);
+
+ col = new TableColumn(table, SWT.LEFT);
+ col.setText(I18n.PublishResultsDialogMessageHeader);
+
+ // populate the table
+ viewer.setInput(this);
+
+ // size columns
+ for (TableColumn column : table.getColumns()) {
+ column.pack();
+ column.setWidth(column.getWidth() + 2);
+ }
+
+ return pnl;
+ }
+
+ /**
+ * @return the files that were involved in the publishing operation
+ * @since 0.6
+ */
+ List<IFile> getFiles() {
+ return this.files;
+ }
+
+ /**
+ * @param index the index of the status being requested
+ * @return the status
+ * @since 0.6
+ */
+ Status getStatus( int index ) {
+ return this.statuses.get(index);
+ }
+
+ //
===========================================================================================================================
+ // Inner Class
+ //
===========================================================================================================================
+
+ /**
+ * The <code>ResultsProvider</code> class is the label provider and
content provider for the table that is shown in the
+ * dialog.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+ class ResultsProvider extends LabelProvider implements IStructuredContentProvider,
ITableLabelProvider {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ * @since 0.6
+ */
+ @Override
+ public Image getColumnImage( Object element,
+ int columnIndex ) {
+ if (columnIndex == SEVERITY_COL) {
+ Status status = getStatus(getFiles().indexOf(element));
+
+ if (status.isOk()) {
+ return Activator.getDefault().getImage(CHECKBOX_IMAGE_PATH);
+ }
+
+ return Utils.getImage(status);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ * @since 0.6
+ */
+ @Override
+ public String getColumnText( Object element,
+ int columnIndex ) {
+ if (columnIndex == FILE_COL) {
+ return ((IFile)element).getFullPath().toString();
+ }
+
+ if (columnIndex == MESSAGE_COL) {
+ Status status = getStatus(getFiles().indexOf(element));
+
+ if (!status.isOk()) {
+ return status.getMessage();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public Object[] getElements( Object inputElement ) {
+ return getFiles().toArray();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
java.lang.Object,
+ * java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void inputChanged( Viewer viewer,
+ Object oldInput,
+ Object newInput ) {
+ // nothing to do
+ }
+
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.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/i18n.properties
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties 2009-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties 2009-07-29
22:37:55 UTC (rev 1139)
@@ -44,10 +44,11 @@
NewServerActionText = New Server
NewServerActionToolTip = Create and register a new server
+PublishOperationPublishNotAttemptedMsg = Publishing not attempted
+PublishOperationUnpublishNotAttemptedMsg = Unpublishing not attempted
PublishOperationPublishTaskName = Publishing resources
-PublishOperationPublishTitle = Publish
+PublishOperationUnpublishNotAttemptedMsg = Unpublishing not attempted
PublishOperationUnpublishTaskName = Unpublishing resources
-PublishOperationUnpublishTitle = Unpublish
PublishPagePublishTitle = Publish the selected resources
PublishPageLocationGroupTitle = Location
@@ -60,7 +61,7 @@
PublishPageNoAvailableWorkspacesStatusMsg = There are no workspaces available on that
server and repository
PublishPageNoResourcesToPublishStatusMsg = There are no files that can be published
PublishPageNoResourcesToUnpublishStatusMsg = There are no files that can be unpublished
-PublishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the
selected resources will be published.
+PublishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the
selected resources will be published. Then click "Finish" to execute the publish
operation.
PublishPagePublishResourcesLabel = These resources will be published to the specified DNA
repository:
PublishPageRecurseCheckBox = Recurse folders and projects
PublishPageRecurseCheckBoxToolTip = Add all files under folders recursively under
selected projects and folders
@@ -69,18 +70,31 @@
PublishPageRepositoryToolTip = The repository where the workspace is located
PublishPageServerLabel = Server:
PublishPageServerToolTip = The server where the repository is located
-PublishPageUnpublishOkStatusMsg = Choose the server, repository, and workspace where the
selected resources will be unpublished.
+PublishPageUnpublishOkStatusMsg = Choose the server, repository, and workspace where the
selected resources will be unpublished. Then click "Finish" to execute the
unpublish operation.
PublishPageUnpublishResourcesLabel = These resources will be unpublished from the
specified DNA repository:
PublishPageUnpublishTitle = Unpublish the selected resources
PublishPageWorkspaceLabel = Workspace:
PublishPageWorkspacePublishToolTip = The workspace where the resources are being
published
PublishPageWorkspaceUnpublishToolTip = The workspace where the resources are being
unpublished
+PublishResultsDialogErrorPublishingMsg = There was a problem publishing some or all of
the files. See results below and the log for more details. Error message:
"{0}."
+PublishResultsDialogErrorUnpublishingMsg = There was a problem publishing some or all of
the files. See results below and the log for more details. Error message:
"{0}."
+PublishResultsDialogFileHeader = File
+PublishResultsDialogMessageHeader = Message
+PublishResultsDialogPublishMsg = Here are the results of the publishing request.
+PublishResultsDialogTitle = Results
+PublishResultsDialogUnpublishMsg = Here are the results of the unpublishing request.
+
PublishWizardPublishErrorMsg = Error Publishing
PublishWizardPublishTitle = Publish
PublishWizardUnpublishErrorMsg = Error Unpublishing
PublishWizardUnpublishTitle = Unpublish
+RefreshActionToolTip = Refresh
+
+ServerManagerGetRepositoriesExceptionMsg = There was a problem obtaining repositories for
the server "{0}."
+ServerManagerGetWorkspacesExceptionMsg = There was a problem obtaining workspaces for
repository "{0}."
+
ServerPageAuthenticationGroupTitle = Authentication
ServerPageInvalidServerProperties = Cannot construct a server because all server
properties are not valid
ServerPageOkStatusMsg = Define the server information where the DNA repositories are
located.
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java 2009-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -23,17 +23,21 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.views;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
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.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.IDnaObject;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
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.I18n;
/**
* The ServerContentProvider is a content and label provider for DNA repositories.
@@ -47,8 +51,20 @@
// Fields
//
===========================================================================================================================
+ /**
+ * The server manager where the server registry is managed.
+ *
+ * @since 0.6
+ */
private final ServerManager serverManager;
+ /**
+ * The viewer using this content provider.
+ *
+ * @since 0.6
+ */
+ private Viewer viewer;
+
//
===========================================================================================================================
// Constructors
//
===========================================================================================================================
@@ -97,12 +113,30 @@
public Object[] getChildren( Object parentElement ) {
assert (parentElement instanceof IDnaObject);
- if (parentElement instanceof Server) {
- return this.serverManager.getRepositories((Server)parentElement).toArray();
+ try {
+ if (parentElement instanceof Server) {
+ return
this.serverManager.getRepositories((Server)parentElement).toArray();
+ }
+ } catch (Exception e) {
+ String msg = I18n.bind(I18n.ServerManagerGetRepositoriesExceptionMsg,
((Server)parentElement).getShortDescription());
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+
+ if (this.viewer.getControl().isVisible()) {
+ MessageDialog.openError(this.viewer.getControl().getShell(),
I18n.ErrorDialogTitle, msg);
+ }
}
- if (parentElement instanceof Repository) {
- return
this.serverManager.getWorkspaces((Repository)parentElement).toArray();
+ try {
+ if (parentElement instanceof Repository) {
+ return
this.serverManager.getWorkspaces((Repository)parentElement).toArray();
+ }
+ } catch (Exception e) {
+ String msg = I18n.ServerManagerGetWorkspacesExceptionMsg;
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+
+ if (this.viewer.getControl().isVisible()) {
+ MessageDialog.openError(this.viewer.getControl().getShell(),
I18n.ErrorDialogTitle, msg);
+ }
}
return new Object[0];
@@ -163,10 +197,10 @@
assert (element instanceof IDnaObject);
return ((IDnaObject)element).getName();
}
-
+
/**
* {@inheritDoc}
- *
+ *
* @see
org.eclipse.jface.viewers.CellLabelProvider#getToolTipImage(java.lang.Object)
* @since 0.6
*/
@@ -192,7 +226,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see
org.eclipse.jface.viewers.CellLabelProvider#getToolTipTimeDisplayed(java.lang.Object)
* @since 0.6
*/
@@ -223,7 +257,7 @@
public void inputChanged( Viewer viewer,
Object oldInput,
Object newInput ) {
- // nothing to do
+ this.viewer = viewer;
}
/**
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -24,6 +24,7 @@
package org.jboss.dna.web.jcr.rest.client.swt.views;
import static
org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.COLLAPSE_ALL_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.REFRESH_IMAGE_PATH;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
@@ -99,8 +100,15 @@
private ServerContentProvider provider;
/**
+ * Refreshes the tree.
+ *
* @since 0.6
*/
+ private IAction refreshAction;
+
+ /**
+ * @since 0.6
+ */
private TreeViewer viewer;
//
===========================================================================================================================
@@ -122,6 +130,17 @@
this.collapseAllAction.setToolTipText(I18n.CollapseActionToolTip);
this.collapseAllAction.setImageDescriptor(Activator.getDefault().getImageDescriptor(COLLAPSE_ALL_IMAGE_PATH));
+ // the refresh action is always enabled
+ this.refreshAction = new Action() {
+ @Override
+ public void run() {
+ getViewer().refresh();
+ }
+ };
+
+ this.refreshAction.setToolTipText(I18n.RefreshActionToolTip);
+
this.refreshAction.setImageDescriptor(Activator.getDefault().getImageDescriptor(REFRESH_IMAGE_PATH));
+
// the shell used for dialogs that the actions display
Shell shell = this.getSite().getShell();
@@ -161,6 +180,7 @@
toolBar.add(this.newAction);
toolBar.add(this.editAction);
toolBar.add(this.deleteAction);
+ toolBar.add(this.refreshAction);
toolBar.add(this.collapseAllAction);
}
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java 2009-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -25,44 +25,63 @@
import java.io.File;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
+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.domain.Workspace;
+import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.I18n;
/**
* @author Dan Florian
* @since 0.6
*/
-public class PublishOperation implements IRunnableWithProgress {
+public class PublishOperation {
//
===========================================================================================================================
// Constants
//
===========================================================================================================================
/**
- * The wizard type.
+ * The operation type.
*
* @since 0.6
*/
public enum Type {
/**
- * Indicates the wizard will be used to publish.
+ * Indicates a publish operation.
*
* @since 0.6
*/
PUBLISH,
/**
- * Indicates the wizard will be used to unpublish.
+ * Indicates an unpublish operation.
*
* @since 0.6
*/
UNPUBLISH
}
+ /**
+ * Status indicating the file was not attempted to be published.
+ *
+ * @since 0.6
+ */
+ private static final Status PUBLISH_NOT_ATTEMPTED_STATUS = new Status(Severity.INFO,
+
I18n.PublishOperationPublishNotAttemptedMsg, null);
+
+ /**
+ * Status indicating the file was not attempted to be published.
+ *
+ * @since 0.6
+ */
+ private static final Status UNPUBLISH_NOT_ATTEMPTED_STATUS = new
Status(Severity.INFO,
+
I18n.PublishOperationUnpublishNotAttemptedMsg, null);
+
//
===========================================================================================================================
// Fields
//
===========================================================================================================================
@@ -82,6 +101,13 @@
private final Type type;
/**
+ * The operation status for each file.
+ *
+ * @since 0.6
+ */
+ private List<Status> statuses;
+
+ /**
* The workspace to use when publishing or unpublishing.
*
* @since 0.6
@@ -93,9 +119,9 @@
//
===========================================================================================================================
/**
- * @param type the operation type
- * @param files the files being published or unpublished
- * @param workspace the workspace to use when publishing or unpublishing
+ * @param type the operation 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 PublishOperation( Type type,
@@ -111,11 +137,11 @@
//
===========================================================================================================================
/**
- * @return the operation title
+ * @return the operation status of each file (never <code>null</code> and
always one status for each file)
* @since 0.6
*/
- public String getTitle() {
- return ((this.type == Type.PUBLISH) ? I18n.PublishOperationPublishTitle :
I18n.PublishOperationUnpublishTitle);
+ public List<Status> getStatus() {
+ return this.statuses;
}
/**
@@ -135,31 +161,54 @@
}
/**
- * {@inheritDoc}
- *
- * @see
org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ * @param monitor the progress monitor
+ * @throws InvocationTargetException if an unexpected error occurs
+ * @throws InterruptedException if the user cancels the monitor
* @since 0.6
*/
- @Override
- public void run( IProgressMonitor monitor ) throws InvocationTargetException,
InterruptedException {
+ public void execute( IProgressMonitor monitor ) throws InvocationTargetException,
InterruptedException {
assert (this.workspace != null);
+ this.statuses = new ArrayList<Status>(this.files.size());
+
try {
String name = (isPublishing() ? I18n.PublishOperationPublishTaskName :
I18n.PublishOperationUnpublishTaskName);
monitor.beginTask(name, this.files.size());
+ monitor.setTaskName(name);
- for (IFile eclipseFile : this.files) {
+ for (IFile eclipseFile : this.files) {
+
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+
File file = eclipseFile.getLocation().toFile();
// TODO call publisher here (timeout?)
+ if (isPublishing()) {
+
this.statuses.add(Activator.getDefault().getServerManager().publish(this.workspace,
+
eclipseFile.getFullPath().toString(),
+
file));
+ } else {
+
this.statuses.add(Activator.getDefault().getServerManager().unpublish(this.workspace,
+
eclipseFile.getFullPath().toString(),
+
file));
+ }
monitor.worked(1);
-
- if (monitor.isCanceled()) {
- break;
- }
}
+ } catch (InterruptedException e) {
+ throw e;
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
+ // ensure there is a status for each file
+ if (this.files.size() != this.statuses.size()) {
+ Status status = (isPublishing() ? PUBLISH_NOT_ATTEMPTED_STATUS :
UNPUBLISH_NOT_ATTEMPTED_STATUS);
+
+ for (int count = this.files.size() - this.statuses.size(), i = 0; i <
count; ++i) {
+ this.statuses.add(status);
+ }
+ }
+
monitor.done();
}
}
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -614,7 +614,10 @@
loadFiles();
} catch (CoreException e) {
Activator.getDefault().log(new Status(Severity.ERROR,
I18n.PublishPageRecurseProcessingErrorMsg, e));
- MessageDialog.openError(getShell(), I18n.ErrorDialogTitle,
I18n.PublishPageRecurseProcessingErrorMsg);
+
+ if (getControl().isVisible()) {
+ MessageDialog.openError(getShell(), I18n.ErrorDialogTitle,
I18n.PublishPageRecurseProcessingErrorMsg);
+ }
}
}
@@ -738,7 +741,17 @@
if (this.server == null) {
this.repositories = Collections.emptyList();
} else {
- this.repositories = new
ArrayList<Repository>(getServerManager().getRepositories(this.server));
+ try {
+ this.repositories = new
ArrayList<Repository>(getServerManager().getRepositories(this.server));
+ } catch (Exception e) {
+ this.repositories = Collections.emptyList();
+ String msg = I18n.bind(I18n.ServerManagerGetRepositoriesExceptionMsg,
this.server.getShortDescription());
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+
+ if (getControl().isVisible()) {
+ MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, msg);
+ }
+ }
}
// uninstall listeners to prevent handling events
@@ -840,7 +853,17 @@
if (this.repository == null) {
this.workspaces = Collections.emptyList();
} else {
- this.workspaces = new
ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
+ try {
+ this.workspaces = new
ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
+ } catch (Exception e) {
+ this.workspaces = Collections.emptyList();
+ String msg = I18n.ServerManagerGetWorkspacesExceptionMsg;
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+
+ if (getControl().isVisible()) {
+ MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, msg);
+ }
+ }
}
// uninstall listeners to prevent handling events
@@ -921,19 +944,15 @@
// set initial status
validate();
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
+
// set initial message
- String initialMsg = ((this.type == Type.PUBLISH) ?
I18n.PublishPagePublishOkStatusMsg : I18n.PublishPageUnpublishOkStatusMsg);
-
- // if no resources to publish set the message to that else set to initial
message
- if (!this.status.isOk()) {
- if
(I18n.PublishPageNoResourcesToPublishStatusMsg.equals(this.status.getMessage())
- ||
I18n.PublishPageNoResourcesToUnpublishStatusMsg.equals(this.status.getMessage())) {
- setErrorMessage(this.status.getMessage());
- } else {
- setMessage(initialMsg);
- }
+ if (this.status.isOk()) {
+ String msg = ((this.type == Type.PUBLISH) ?
I18n.PublishPagePublishOkStatusMsg : I18n.PublishPageUnpublishOkStatusMsg);
+ setMessage(msg);
} else {
- setMessage(initialMsg);
+ setErrorMessage(this.status.getMessage());
}
}
}
@@ -995,7 +1014,7 @@
} else if (this.status.isInfo()) {
setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
} else {
- setMessage(I18n.ServerPageOkStatusMsg);
+ setMessage(this.status.getMessage());
}
}
}
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-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-07-29
22:37:55 UTC (rev 1139)
@@ -29,8 +29,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.dna.web.jcr.rest.client.ServerManager;
import org.jboss.dna.web.jcr.rest.client.Status;
@@ -38,6 +40,7 @@
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.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.dialogs.PublishingResultsDialog;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
@@ -148,19 +151,47 @@
*/
@Override
public boolean performFinish() {
+ Throwable error = null;
Workspace workspace = this.page.getWorkspace();
List<IFile> files = this.page.getFiles();
- PublishOperation operation = new PublishOperation(this.type, files, workspace);
+ final PublishOperation operation = new PublishOperation(this.type, files,
workspace);
+ // display progress dialog
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ @Override
+ public void run( IProgressMonitor monitor ) throws InvocationTargetException,
InterruptedException {
+ operation.execute(monitor);
+ }
+ };
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
+
try {
- getContainer().run(true, true, operation);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- String message = (operation.isPublishing() ?
I18n.PublishWizardPublishErrorMsg : I18n.PublishWizardUnpublishErrorMsg);
- Activator.getDefault().log(new Status(Severity.ERROR, message,
e.getTargetException()));
- MessageDialog.openError(getContainer().getShell(), I18n.ErrorDialogTitle,
message);
- return false;
+ dialog.run(true, true, op);
+ } catch (Throwable e) {
+ if (!(e instanceof InterruptedException)) {
+ error = e;
+
+ if (e instanceof InvocationTargetException) {
+ error = ((InvocationTargetException)e).getTargetException();
+ }
+
+ String message = (operation.isPublishing() ?
I18n.PublishWizardPublishErrorMsg : I18n.PublishWizardUnpublishErrorMsg);
+ Activator.getDefault().log(new Status(Severity.ERROR, message, error));
+ }
+ } finally {
+ dialog.getProgressMonitor().done();
+
+ // show results
+ PublishingResultsDialog resultsDialog = null;
+
+ if (error == null) {
+ resultsDialog = new PublishingResultsDialog(getShell(), this.type, files,
operation.getStatus());
+ } else {
+ resultsDialog = new PublishingResultsDialog(getShell(), this.type, files,
operation.getStatus(), error);
+ }
+
+ resultsDialog.open();
}
return true;
Modified: branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/artifacts.xml
===================================================================
---
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/artifacts.xml 2009-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/artifacts.xml 2009-07-29
22:37:55 UTC (rev 1139)
@@ -3,14 +3,21 @@
<repository name='JBoss DNA REST Eclipse SWT Client'
type='org.eclipse.equinox.p2.artifact.repository.simpleRepository'
version='1.0.0'>
<properties size='2'>
<property name='p2.compressed' value='false'/>
- <property name='p2.timestamp' value='1247070330809'/>
+ <property name='p2.timestamp' value='1248905146973'/>
</properties>
<mappings size='3'>
<rule filter='(& (classifier=osgi.bundle))'
output='${repoUrl}/plugins/${id}_${version}.jar'/>
<rule filter='(& (classifier=binary))'
output='${repoUrl}/binary/${id}_${version}'/>
<rule filter='(& (classifier=org.eclipse.update.feature))'
output='${repoUrl}/features/${id}_${version}.jar'/>
</mappings>
- <artifacts size='5'>
+ <artifacts size='6'>
+ <artifact classifier='osgi.bundle'
id='org.jboss.dna.web.jcr.rest.client.swt' version='1.0.0'>
+ <properties size='3'>
+ <property name='artifact.size' value='85068'/>
+ <property name='download.size' value='85068'/>
+ <property name='download.contentType'
value='application/zip'/>
+ </properties>
+ </artifact>
<artifact classifier='org.eclipse.update.feature'
id='org.jboss.dna.web.jcr.rest.client.swt.feature'
version='1.0.0.v20090708'>
<properties size='2'>
<property name='artifact.size' value='1859'/>
@@ -19,15 +26,15 @@
</artifact>
<artifact classifier='osgi.bundle'
id='org.jboss.dna.web.jcr.rest.client.swt' version='1.0.0'>
<properties size='3'>
- <property name='artifact.size' value='85068'/>
- <property name='download.size' value='85068'/>
+ <property name='artifact.size' value='85010'/>
+ <property name='download.size' value='85010'/>
<property name='download.contentType'
value='application/zip'/>
</properties>
</artifact>
<artifact classifier='osgi.bundle'
id='org.jboss.dna.web.jcr.rest.client.swt' version='1.0.0'>
<properties size='3'>
- <property name='artifact.size' value='85010'/>
- <property name='download.size' value='85010'/>
+ <property name='artifact.size' value='10911490'/>
+ <property name='download.size' value='10911490'/>
<property name='download.contentType'
value='application/zip'/>
</properties>
</artifact>
Modified: branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/content.xml
===================================================================
---
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/content.xml 2009-07-29
21:33:49 UTC (rev 1138)
+++
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/content.xml 2009-07-29
22:37:55 UTC (rev 1139)
@@ -3,7 +3,7 @@
<repository name='JBoss DNA REST Eclipse SWT Client'
type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository'
version='1.0.0'>
<properties size='2'>
<property name='p2.compressed' value='false'/>
- <property name='p2.timestamp' value='1247070330817'/>
+ <property name='p2.timestamp' value='1248905147025'/>
</properties>
<units size='8'>
<unit id='org.jboss.dna.web.jcr.rest.client.swt.feature.feature.jar'
version='1.0.0.v20090708'>
Modified:
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/features/org.jboss.dna.web.jcr.rest.client.swt.feature_1.0.0.v20090708.jar
===================================================================
(Binary files differ)
Modified:
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/plugins/org.jboss.dna.web.jcr.rest.client.swt_1.0.0.jar
===================================================================
(Binary files differ)