Author: elvisisking
Date: 2009-06-23 14:44:56 -0400 (Tue, 23 Jun 2009)
New Revision: 1062
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath
branches/eclipse/org.jboss.dna.publish.ui.swt/.project
branches/eclipse/org.jboss.dna.publish.ui.swt/.settings/
branches/eclipse/org.jboss.dna.publish.ui.swt/.settings/org.eclipse.jdt.core.prefs
branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/
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/icons/
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/cview16/
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/cview16/repository.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/repository.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/server.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/workspace.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml
branches/eclipse/org.jboss.dna.publish.ui.swt/slf4j-api-1.5.8-sources.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/slf4j-api-1.5.8.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/src/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/Activator.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/I18n.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/IUiConstants.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/PublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/UnpublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/dialogs/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/dialogs/DeleteServerDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/i18n.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryContentProvider.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryView.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishPage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishWizard.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerPage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerWizard.java
Log:
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath (rev
0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath 2009-06-23 18:44:56 UTC (rev
1062)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/.project
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/.project (rev
0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/.project 2009-06-23 18:44:56 UTC (rev
1062)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.dna.publish.ui.swt.swt</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/.settings/org.eclipse.jdt.core.prefs 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,7 @@
+#Wed Jun 17 07:47:51 CDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF 2009-06-23 18:44:56
UTC (rev 1062)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.jboss.dna.publish.ui.swt;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.dna.publish.ui.swt.Activator
+Bundle-Vendor: %bundleVendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.dna.publish,
+ org.eclipse.core.resources;bundle-version="3.4.2"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties 2009-06-23 18:44:56 UTC
(rev 1062)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ icons/,\
+ plugin.xml
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/cview16/repository.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/cview16/repository.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/repository.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/repository.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/server.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/server.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/workspace.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/full/obj16/workspace.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.properties
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.properties 2009-06-23 18:44:56
UTC (rev 1062)
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+bundleName = DNA Eclipse Publishing UI Plug-in
+bundleVendor = Red Hat, Inc.
+contextMenu.label = DNA
+dnaCategory = DNA
+publishAction.label = Publish
+repositoryView = DNA Repositories
+unpublishAction.label = Unpublish
\ No newline at end of file
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml (rev
0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml 2009-06-23 18:44:56 UTC (rev
1062)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+<!-- Define the IResource object contribution actions to all popup menus -->
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ id="org.jboss.dna.publish.iresourcepopupmenucontribution"
+ objectClass="org.eclipse.core.resources.IResource">
+ <menu
+ id="org.jboss.dna.publish.contextMenu"
+ label="%contextMenu.label"
+ path="additions">
+ <separator
+ name="group1">
+ </separator>
+ </menu>
+
+ <!-- Unpublish action -->
+ <action
+ id="org.jboss.dna.publish.ui.swt.unpublishAction"
+ label="%unpublishAction.label"
+ class="org.jboss.dna.publish.ui.swt.actions.UnpublishAction"
+ menubarPath="org.jboss.dna.publish.contextMenu/group1"
+ enablesFor="*">
+ </action>
+
+ <!-- Publish action -->
+ <action
+ id="org.jboss.dna.publish.ui.swt.publishAction"
+ label="%publishAction.label"
+ class="org.jboss.dna.publish.ui.swt.actions.PublishAction"
+ menubarPath="org.jboss.dna.publish.contextMenu/group1"
+ enablesFor="*">
+ </action>
+ </objectContribution>
+ </extension>
+
+<!-- View extensions -->
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.jboss.dna"
+ name="%dnaCategory">
+ </category>
+
+ <!-- Repository view -->
+ <view
+ id="respositoryView"
+ name="%repositoryView"
+ category="org.jboss.dna"
+ class="org.jboss.dna.publish.ui.swt.views.RepositoryView"
+ fastViewWidthRatio="0.25"
+ icon="icons/full/cview16/repository.gif">
+ </view>
+ </extension>
+
+</plugin>
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/slf4j-api-1.5.8-sources.jar
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/slf4j-api-1.5.8-sources.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/slf4j-api-1.5.8.jar
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/slf4j-api-1.5.8.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/Activator.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/Activator.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/Activator.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,216 @@
+/*
+ * 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.publish.ui.swt;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.dna.publish.ServerManager;
+import org.jboss.dna.publish.domain.IDnaObject;
+import org.jboss.dna.publish.domain.Repository;
+import org.jboss.dna.publish.domain.Server;
+import org.jboss.dna.publish.domain.Workspace;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public class Activator extends AbstractUIPlugin implements IUiConstants {
+
+ //
===========================================================================================================================
+ // Class Fields
+ //
===========================================================================================================================
+
+ /**
+ * The shared plugin instance.
+ *
+ * @since 0.6
+ */
+ private static Activator plugin;
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * @return the shared instance or <code>null</code> if not constructed
+ * @since 0.6
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The manager in charge of the server registry.
+ *
+ * @since 0.6
+ */
+ private ServerManager serverMgr;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * Constructs the plugin activator. If constructed outside of Eclipse the {@link
#initialize(String)} method must be called to
+ * construct the {@link ServerManager server manager}.
+ *
+ * @since 0.6
+ */
+ public Activator() {
+ super();
+ plugin = this;
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * @param object the object whose image is being requested
+ * @return the image or <code>null</code> if not found
+ * @since 0.6
+ */
+ public Image getImage( Object object ) {
+ String key = null;
+
+ if (object instanceof Workspace) {
+ key = WORKSPACE_IMAGE_PATH;
+ } else if (object instanceof Repository) {
+ key = REPOSITORY_IMAGE_PATH;
+ } else if (object instanceof Server) {
+ key = SERVER_IMAGE_PATH;
+ } else if (object instanceof IDnaObject) {
+ // should have an icon for every business object
+ assert false;
+ } else if (object instanceof String) {
+ key = (String)object;
+ }
+
+ if (key != null) {
+ return getImageRegistry().get(key);
+ }
+
+ return null;
+ }
+
+ /**
+ * @param object the object whose image descriptor is being requested
+ * @return the image descriptor or <code>null</code> if not found
+ * @since 0.6
+ */
+ public ImageDescriptor getImageDescriptor( Object object ) {
+ String key = null;
+
+ if (object instanceof Workspace) {
+ key = WORKSPACE_IMAGE_PATH;
+ } else if (object instanceof Repository) {
+ key = REPOSITORY_IMAGE_PATH;
+ } else if (object instanceof Server) {
+ key = SERVER_IMAGE_PATH;
+ } else if (object instanceof IDnaObject) {
+ // should have an icon for every business object
+ assert false;
+ } else if (object instanceof String) {
+ key = (String)object;
+ }
+
+ if (key != null) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID,
((String)object));
+ }
+
+ return null;
+ }
+
+ /**
+ * @return the server manager or <code>null</code> if activator has not
been initialized or started
+ * @see #initialize(String)
+ * @see #start(BundleContext)
+ * @since 0.6
+ */
+ public ServerManager getServerManager() {
+ return this.serverMgr;
+ }
+
+ /**
+ * Performs plugin initialization. One thing it does is initialize the {@link
ServerManager server manager}.
+ * <p>
+ * Note: This should <strong>ONLY</strong> be called when the OSGi
framework is not running (i.e., {@link BundleContext bundle
+ * context} is <code>null</code>) and should be called instead of calling
{@link #start(BundleContext)}.
+ *
+ * @param stateLocationPath
+ * @since 0.6
+ */
+ public void initialize( String stateLocationPath ) {
+ this.serverMgr = new ServerManager(stateLocationPath);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * If OSGi is not running this does nothing.
+ *
+ * @see
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ * @since 0.6
+ */
+ @Override
+ public void start( BundleContext context ) throws Exception {
+ if (context != null) {
+ // OSGi is running
+ super.start(context);
+ initialize(plugin.getStateLocation().toFile().getAbsolutePath());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ * @since 0.6
+ */
+ @Override
+ public void stop( BundleContext context ) throws Exception {
+ if (this.serverMgr != null) {
+ if (this.serverMgr.saveState().isError()) {
+ // TODO log this
+ }
+
+ this.serverMgr = null;
+ }
+
+ if (context != null) {
+ super.stop(context);
+ }
+
+ plugin = null;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/Activator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/I18n.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/I18n.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/I18n.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,98 @@
+/*
+ * 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.publish.ui.swt;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * The I18n class handles localization messages.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class I18n extends NLS {
+
+ public static String CollapseActionToolTip;
+
+ public static String DeleteServerActionText;
+ public static String DeleteServerActionToolTip;
+
+ public static String DeleteServerDialogTitle;
+ public static String DeleteServerDialogOneServerMessage;
+ public static String DeleteServerDialogMultipleServersMessage;
+
+ public static String EditServerActionText;
+ public static String EditServerActionToolTip;
+
+ public static String PublishPagePublishTitle;
+ public static String PublishPageLocationGroupTitle;
+ public static String PublishPageMissingRepositoryStatusMsg;
+ public static String PublishPageMissingServerStatusMsg;
+ public static String PublishPageMissingWorkspaceStatusMsg;
+ public static String PublishPageNoAvailableRepositoriesStatusMsg;
+ public static String PublishPageNoAvailableServersStatusMsg;
+ public static String PublishPageNoAvailableWorkspacesStatusMsg;
+ public static String PublishPageNoResourcesStatusMsg;
+ public static String PublishPagePublishOkStatusMsg;
+ public static String PublishPagePublishResourcesLabel;
+ public static String PublishPageRepositoryLabel;
+ public static String PublishPageRepositoryToolTip;
+ public static String PublishPageServerLabel;
+ public static String PublishPageServerToolTip;
+ public static String PublishPageUnpublishOkStatusMsg;
+ public static String PublishPageUnpublishResourcesLabel;
+ public static String PublishPageUnpublishTitle;
+ public static String PublishPageWorkspaceLabel;
+ public static String PublishPageWorkspacePublishToolTip;
+ public static String PublishPageWorkspaceUnpublishToolTip;
+
+ public static String PublishWizardPublishTitle;
+ public static String PublishWizardUnpublishTitle;
+
+ public static String ServerPageAuthenticationGroupTitle;
+ public static String ServerPageInvalidServerProperties;
+ public static String ServerPageOkStatusMsg;
+ public static String ServerPagePasswordLabel;
+ public static String ServerPagePasswordToolTip;
+ public static String ServerPageSavePasswordButton;
+ public static String ServerPageSavePasswordLabel;
+ public static String ServerPageSavePasswordToolTip;
+ public static String ServerPageTitle;
+ public static String ServerPageUrlLabel;
+ public static String ServerPageUrlToolTip;
+ public static String ServerPageUserLabel;
+ public static String ServerPageUserToolTip;
+
+ public static String ServerWizardEditServerTitle;
+ public static String ServerWizardNewServerTitle;
+
+ public static String NewServerActionText;
+ public static String NewServerActionToolTip;
+
+ static {
+ // load message bundle
+ NLS.initializeMessages(I18n.class.getPackage().getName() + ".i18n",
I18n.class); //$NON-NLS-1$
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/I18n.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/IUiConstants.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/IUiConstants.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/IUiConstants.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,49 @@
+/*
+ * 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.publish.ui.swt;
+
+/**
+ * @author Dan Florian
+ * @since 0.6
+ */
+public interface IUiConstants {
+
+ /**
+ * The Plug-in's identifier.
+ *
+ * @since 0.6
+ */
+ String PLUGIN_ID = "org.jboss.dna.publish.ui.swt"; //$NON-NLS-1$
+
+ String ICON_PATH = "icons/full/"; //$NON-NLS-1$
+
+ String OBJ16 = ICON_PATH + "obj16/"; //$NON-NLS-1$
+
+ String REPOSITORY_IMAGE_PATH = OBJ16 + "repository.gif"; //$NON-NLS-1$
+
+ String SERVER_IMAGE_PATH = OBJ16 + "server.gif"; //$NON-NLS-1$
+
+ String WORKSPACE_IMAGE_PATH = OBJ16 + "workspace.gif"; //$NON-NLS-1$
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/IUiConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/PublishAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/PublishAction.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/PublishAction.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,103 @@
+/*
+ * 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.publish.ui.swt.actions;
+
+import java.util.Iterator;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * The PublishAction controls the publishing of one or more {@link
org.eclipse.core.resources.IResource}s to a DNA repository.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class PublishAction implements IObjectActionDelegate {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ private IStructuredSelection selection;
+
+ /**
+ * The active part's Shell.
+ *
+ * @since 0.6
+ */
+// private Shell shell;
+
+ //
===========================================================================================================================
+ // Constants
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ * @since 0.6
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public void run( IAction action ) {
+ for (Iterator itr = this.selection.iterator(); itr.hasNext();) {
+ // TODO implement run(IAction) - display publish wizard
+ IResource resource = (IResource)itr.next();
+ resource.getFullPath().toFile();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
org.eclipse.jface.viewers.ISelection)
+ * @since 0.6
+ */
+ @Override
+ public void selectionChanged( IAction action,
+ ISelection selection ) {
+ if (selection instanceof IStructuredSelection) {
+ this.selection = (IStructuredSelection)selection;
+ } else {
+ this.selection = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
org.eclipse.ui.IWorkbenchPart)
+ * @since 0.6
+ */
+ @Override
+ public void setActivePart( IAction action,
+ IWorkbenchPart targetPart ) {
+// this.shell = targetPart.getSite().getShell();
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/PublishAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/UnpublishAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/UnpublishAction.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/UnpublishAction.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,79 @@
+/*
+ * 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.publish.ui.swt.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * The UnpublishAction controls the unpublishing of on or more {@link
org.eclipse.core.resources.IResource}s from a DNA
+ * repository.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class UnpublishAction implements IObjectActionDelegate {
+
+ /**
+ * The active part's Shell.
+ *
+ * @since 0.6
+ */
+// private Shell shell;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ * @since 0.6
+ */
+ public void run( IAction action ) {
+ // TODO implement
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ * @since 0.6
+ */
+ public void selectionChanged( IAction action,
+ ISelection selection ) {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
org.eclipse.ui.IWorkbenchPart)
+ * @since 0.6
+ */
+ public void setActivePart( IAction action,
+ IWorkbenchPart targetPart ) {
+// this.shell = targetPart.getSite().getShell();
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/actions/UnpublishAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/dialogs/DeleteServerDialog.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/dialogs/DeleteServerDialog.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/dialogs/DeleteServerDialog.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,122 @@
+/*
+ * 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.publish.ui.swt.dialogs;
+
+import java.util.Collection;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.dna.publish.domain.IDnaObject;
+import org.jboss.dna.publish.domain.Server;
+import org.jboss.dna.publish.ui.swt.I18n;
+
+/**
+ * The <code>DeleteServerDialog</code> class provides a UI for deleting a
{@link org.jboss.dna.publish.domain.Server server}.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public class DeleteServerDialog extends MessageDialog {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * Collection of servers which will be deleted.
+ *
+ * @since 0.6
+ */
+ private final Collection<Server> serversBeingDeleted;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param parentShell the dialog parent
+ * @param serversBeingDeleted the servers being deleted (may not be
<code>null</code>)
+ * @since 0.6
+ */
+ public DeleteServerDialog( Shell parentShell,
+ Collection<Server> serversBeingDeleted ) {
+ super(parentShell, I18n.DeleteServerDialogTitle, null, null,
MessageDialog.QUESTION, new String[] {
+ IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
+ this.serversBeingDeleted = serversBeingDeleted;
+ }
+
+ //
===========================================================================================================================
+ // 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 title
+ String title;
+
+ if (this.serversBeingDeleted.size() == 1) {
+ IDnaObject server = this.serversBeingDeleted.iterator().next();
+ title = NLS.bind(I18n.DeleteServerDialogOneServerMessage, server.getName());
+ } else {
+ title = NLS.bind(I18n.DeleteServerDialogOneServerMessage,
this.serversBeingDeleted.size());
+ }
+
+ shell.setText(title);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
+ * @since 0.6
+ */
+ @Override
+ protected Control createCustomArea( Composite parent ) {
+ if (this.serversBeingDeleted.size() != 1) {
+ List serverList = new List(parent, SWT.NONE);
+
serverList.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ for (IDnaObject server : this.serversBeingDeleted) {
+ serverList.add(server.getName());
+ }
+ }
+
+ return null;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/dialogs/DeleteServerDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/i18n.properties
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/i18n.properties
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/i18n.properties 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,56 @@
+CollapseActionToolTip = Collapse All
+
+DeleteServerActionText = Delete Server
+DeleteServerActionToolTip = Delete Server
+
+DeleteServerDialogTitle = Confirm Delete Server
+DeleteServerDialogOneServerMessage = Are you sure you want to delete the "{0}"
server?
+DeleteServerDialogMultipleServersMessage = Are you sure you want to delete these {0}
servers?
+
+EditServerActionText = Edit Server
+EditServerActionToolTip = Edit Server
+
+NewServerActionText = New Server
+NewServerActionToolTip = New Server
+
+PublishPagePublishTitle = Publish the selected resources
+PublishPageLocationGroupTitle = Location
+PublishPageMissingRepositoryStatusMsg = A repository must be selected
+PublishPageMissingServerStatusMsg = A server must be selected
+PublishPageMissingWorkspaceStatusMsg = A workspace must be selected
+PublishPageNoAvailableRepositoriesStatusMsg = There are no repositories available on that
server
+PublishPageNoAvailableServersStatusMsg = A server must be created first
+PublishPageNoAvailableWorkspacesStatusMsg = There are no workspaces availabe on that
server and repository
+PublishPageNoResourcesStatusMsg = You must select one or more workspace resources
+PublishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the
selected resources will be published.
+PublishPagePublishResourcesLabel = These resources will be published to the specified DNA
repository:
+PublishPageRepositoryLabel = Repository:
+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.
+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
+
+PublishWizardPublishTitle = Publish
+PublishWizardUnpublishTitle = Unpublish
+
+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.
+ServerPagePasswordLabel = Password:
+ServerPagePasswordToolTip = The password used to authenticate the user when connecting to
the server
+ServerPageSavePasswordButton = Save password
+ServerPageSavePasswordLabel = Saved secret data is stored on your computer in a file
that's difficult, but not impossible, for an intruder to read.
+ServerPageSavePasswordToolTip = Indicates if the clear text password should be stored on
the local file system
+ServerPageTitle = Enter Server Information
+ServerPageUrlLabel = URL:
+ServerPageUrlToolTip = The URL used to connect to the server
+ServerPageUserLabel = User:
+ServerPageUserToolTip = The user login used when connecting to the server
+
+ServerWizardEditServerTitle = Edit Server
+ServerWizardNewServerTitle = New Server
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/i18n.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryContentProvider.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryContentProvider.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryContentProvider.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,184 @@
+/*
+ * 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.publish.ui.swt.views;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+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.publish.domain.IDnaObject;
+import org.jboss.dna.publish.ui.swt.Activator;
+
+/**
+ * The RepositoryContentProvider is a content and label provider for DNA repositories.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class RepositoryContentProvider implements ITreeContentProvider,
ILabelProvider {
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ * @since 0.6
+ */
+ @Override
+ public void addListener( ILabelProviderListener listener ) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ * @since 0.6
+ */
+ @Override
+ public void dispose() {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public Object[] getChildren( Object parentElement ) {
+ if (parentElement instanceof IDnaObject) {
+ return ((IDnaObject)parentElement).getChildren().toArray();
+ }
+
+ // should not happen
+ assert false;
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public Object[] getElements( Object inputElement ) {
+ return Activator.getDefault().getServerManager().getServers().toArray();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public Image getImage( Object element ) {
+ return Activator.getDefault().getImage(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public Object getParent( Object element ) {
+ if (element instanceof IDnaObject) {
+ return ((IDnaObject)element).getParent();
+ }
+
+ // should not happen
+ assert false;
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public String getText( Object element ) {
+ assert (element instanceof IDnaObject);
+ return ((IDnaObject)element).getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public boolean hasChildren( Object element ) {
+ return getChildren(element).length > 0;
+ }
+
+ /**
+ * {@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
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public boolean isLabelProperty( Object element,
+ String property ) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ * @since 0.6
+ */
+ @Override
+ public void removeListener( ILabelProviderListener listener ) {
+ // nothing to do
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryView.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryView.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryView.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,257 @@
+/*
+ * 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.publish.ui.swt.views;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.part.ViewPart;
+import org.jboss.dna.publish.domain.IDnaObject;
+import org.jboss.dna.publish.domain.Server;
+import org.jboss.dna.publish.ui.swt.I18n;
+
+/**
+ * The RepositoryView shows all defined servers and their DNA repositories.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class RepositoryView extends ViewPart {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * Collapses all tree nodes.
+ *
+ * @since 0.6
+ */
+ private IAction collapseAllAction;
+
+ /**
+ * Deletes a server.
+ *
+ * @since 0.6
+ */
+ private IAction deleteAction;
+
+ /**
+ * Edits a server's properties.
+ *
+ * @since 0.6
+ */
+ private IAction editAction;
+
+ /**
+ * Creates a new server.
+ *
+ * @since 0.6
+ */
+ private IAction newAction;
+
+ /**
+ * The viewer's content and label provider.
+ *
+ * @since 0.6
+ */
+ private RepositoryContentProvider provider;
+
+ /**
+ * @since 0.6
+ */
+ private TreeViewer viewer;
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * @since 0.6
+ */
+ private void constructActions() {
+ // the collapse all action is always enabled
+ this.collapseAllAction = new Action() {
+ @Override
+ public void run() {
+ getViewer().collapseAll();
+ }
+ };
+
+ this.collapseAllAction.setToolTipText(I18n.CollapseActionToolTip);
+ this.collapseAllAction.setImageDescriptor(null);
+
+ // the delete action will delete one or more servers
+ this.deleteAction = null;
+ this.deleteAction.setText(I18n.DeleteServerActionText);
+ this.deleteAction.setToolTipText(I18n.DeleteServerActionToolTip);
+ this.deleteAction.setImageDescriptor(null);
+ this.deleteAction.setEnabled(false);
+
+ // the edit action is only enabled when one server is selected
+ this.editAction = null;
+ this.editAction.setText(I18n.EditServerActionText);
+ this.editAction.setToolTipText(I18n.EditServerActionToolTip);
+ this.editAction.setImageDescriptor(null);
+ this.editAction.setEnabled(false);
+
+ // the new server action is always enabled
+ this.newAction = null;
+ this.newAction.setText(I18n.NewServerActionText);
+ this.newAction.setToolTipText(I18n.NewServerActionToolTip);
+ this.newAction.setImageDescriptor(null);
+ }
+
+ /**
+ * @since 0.6
+ */
+ private void constructContextMenu() {
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.add(this.newAction);
+ menuMgr.add(this.editAction);
+ menuMgr.add(this.deleteAction);
+ // menuMgr.setRemoveAllWhenShown(true);
+
+ Menu menu = menuMgr.createContextMenu(this.viewer.getTree());
+ this.viewer.getTree().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, this.viewer);
+ }
+
+ /**
+ * @since 0.6
+ */
+ private void constructToolBar() {
+ IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
+ toolBar.add(this.newAction);
+ toolBar.add(this.editAction);
+ toolBar.add(this.deleteAction);
+ toolBar.add(this.collapseAllAction);
+ }
+
+ /**
+ * @param parent the viewer's parent
+ * @since 0.6
+ */
+ private void constructTreeViewer( Composite parent ) {
+ this.provider = new RepositoryContentProvider();
+ this.viewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+ this.viewer.setContentProvider(this.provider);
+ this.viewer.setLabelProvider(this.provider);
+ 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);
+ }
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ * @since 0.6
+ */
+ @Override
+ public void createPartControl( Composite parent ) {
+ constructTreeViewer(parent);
+ constructActions();
+ constructToolBar();
+ constructContextMenu();
+ }
+
+ /**
+ * @return the tree viewer
+ * @since 0.6
+ */
+ TreeViewer getViewer() {
+ return this.viewer;
+ }
+
+ /**
+ * @param event the event being processed
+ * @since 0.6
+ */
+ void handleSelectionChanged( SelectionChangedEvent event ) {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ updateStatusLine(selection);
+ updateActionBars(selection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ * @since 0.6
+ */
+ @Override
+ public void setFocus() {
+ if (!this.viewer.getControl().isDisposed()) {
+ this.viewer.getControl().setFocus();
+ }
+ }
+
+ /**
+ * @param selection the current viewer selection (never
<code>null</code>)
+ * @since 0.6
+ */
+ private void updateActionBars( IStructuredSelection selection ) {
+ if (selection.isEmpty()) {
+ this.deleteAction.setEnabled(false);
+ this.editAction.setEnabled(false);
+ } else {
+ assert (selection.size() == 1);
+
+ IDnaObject obj = (IDnaObject)selection.getFirstElement();
+ boolean enable = (obj instanceof Server);
+ this.deleteAction.setEnabled(enable);
+ this.editAction.setEnabled(enable);
+ }
+ }
+
+ /**
+ * @param selection the current viewer selection (never
<code>null</code>)
+ * @since 0.6
+ */
+ private void updateStatusLine( IStructuredSelection selection ) {
+ assert (selection.size() < 2);
+
+ String msg = (selection.isEmpty() ? "" :
((IDnaObject)selection.getFirstElement()).getShortDescription()); //$NON-NLS-1$
+ getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/views/RepositoryView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishPage.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishPage.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishPage.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,415 @@
+/*
+ * 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.publish.ui.swt.wizards;
+
+import java.util.List;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.jboss.dna.publish.Status;
+import org.jboss.dna.publish.Status.Severity;
+import org.jboss.dna.publish.ui.swt.I18n;
+import org.jboss.dna.publish.ui.swt.wizards.PublishWizard.Type;
+
+/**
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class PublishPage extends WizardPage implements ModifyListener {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The repository control.
+ *
+ * @since 0.6
+ */
+ private Combo cbxRepository;
+
+ /**
+ * The server control.
+ *
+ * @since 0.6
+ */
+ private Combo cbxServer;
+
+ /**
+ * The workspace control.
+ *
+ * @since 0.6
+ */
+ private Combo cbxWorkspace;
+
+ /**
+ * Indicates if the resources are being published or unpublished.
+ *
+ * @since 0.6
+ */
+ private final Type type;
+
+ /**
+ * The repository where the workspace is located.
+ *
+ * @since 0.6
+ */
+ private String repository;
+
+ /**
+ * The server where the repository is located.
+ *
+ * @since 0.6
+ */
+ private String server;
+
+ /**
+ * The workspace where the resources are being published/unpublished.
+ *
+ * @since 0.6
+ */
+ private String workspace;
+
+ /**
+ * The collection of resources being published/unpublished.
+ *
+ * @since 0.6
+ */
+ private final List<IResource> resources;
+
+ /**
+ * The current validation status.
+ *
+ * @since 0.6
+ */
+ private Status status;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param type the publish or unpublish indicator
+ * @param resources the resources being published or unpublished (never
<code>null</code>)
+ * @since 0.6
+ */
+ public PublishPage( Type type,
+ List<IResource> resources ) {
+ super(PublishPage.class.getSimpleName());
+ setTitle((type == Type.PUBLISH) ? I18n.PublishPagePublishTitle :
I18n.PublishPageUnpublishTitle);
+
+ this.type = type;
+ this.resources = resources;
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ private void constructLocationPanel( Composite parent ) {
+ Group pnl = new Group(parent, SWT.NONE);
+ pnl.setText(I18n.PublishPageLocationGroupTitle);
+ pnl.setLayout(new GridLayout(2, false));
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ { // server row
+ Label lblServer = new Label(pnl, SWT.LEFT);
+ lblServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblServer.setText(I18n.PublishPageServerLabel);
+
+ this.cbxServer = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxServer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxServer.setToolTipText(I18n.PublishPageServerToolTip);
+ }
+
+ { // repository row
+ Label lblRepository = new Label(pnl, SWT.LEFT);
+ lblRepository.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
+ lblRepository.setText(I18n.PublishPageRepositoryLabel);
+
+ this.cbxRepository = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxRepository.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
false));
+ this.cbxRepository.setToolTipText(I18n.PublishPageRepositoryToolTip);
+ }
+
+ { // workspace row
+ Label lblWorkspace = new Label(pnl, SWT.LEFT);
+ lblWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
+ lblWorkspace.setText(I18n.PublishPageWorkspaceLabel);
+
+ this.cbxWorkspace = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxWorkspace.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
false));
+
+ if (type == Type.PUBLISH) {
+
this.cbxWorkspace.setToolTipText(I18n.PublishPageWorkspacePublishToolTip);
+ } else {
+
this.cbxWorkspace.setToolTipText(I18n.PublishPageWorkspaceUnpublishToolTip);
+ }
+ }
+ }
+
+ private void constructResourcesPanel( Composite parent ) {
+ Composite pnl = new Composite(parent, SWT.NONE);
+ pnl.setLayout(new GridLayout());
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Label lbl = new Label(pnl, SWT.LEFT);
+ lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+ if (type == Type.PUBLISH) {
+ lbl.setText(I18n.PublishPagePublishResourcesLabel);
+ } else {
+ lbl.setText(I18n.PublishPageUnpublishResourcesLabel);
+ }
+
+ org.eclipse.swt.widgets.List lstResources = new org.eclipse.swt.widgets.List(pnl,
SWT.BORDER | SWT.H_SCROLL
+
| SWT.V_SCROLL);
+ lstResources.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // set initial value
+ // TODO implement load resources
+ String[] data = new String[20];
+ for (int i = 0; i < 20; ++i) data[i] = "my/resource" + i +
".xmi"; //$NON-NLS-1$ //$NON-NLS-2$
+ lstResources.setItems(data);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl( Composite parent ) {
+ Composite pnlMain = new Composite(parent, SWT.NONE);
+ pnlMain.setLayout(new GridLayout());
+ pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ constructLocationPanel(pnlMain);
+ constructResourcesPanel(pnlMain);
+ setControl(pnlMain);
+
+ loadServers();
+ installLocationListeners();
+ }
+
+ /**
+ * Handler for when the repository control value is modified
+ *
+ * @since 0.6
+ */
+ void handleRepositoryModified() {
+ this.repository = this.cbxRepository.getText();
+ this.workspace = null;
+
+ // clear loaded workspaces
+ uninstallLocationListeners();
+ this.cbxWorkspace.removeAll();
+ reloadWorkspaces();
+ installLocationListeners();
+
+ updateState();
+ }
+
+ /**
+ * Handler for when the server control value is modified
+ *
+ * @since 0.6
+ */
+ void handleServerModified() {
+ this.server = this.cbxServer.getText();
+ this.repository = null;
+ this.workspace = null;
+
+ // clear loaded repositories and workspaces
+ uninstallLocationListeners();
+ this.cbxRepository.removeAll();
+ this.cbxWorkspace.removeAll();
+ reloadRepositories();
+ installLocationListeners();
+
+ updateState();
+ }
+
+ /**
+ * Handler for when the workspace control value is modified
+ *
+ * @since 0.6
+ */
+ void handleWorkspaceModified() {
+ this.workspace = this.cbxWorkspace.getText();
+ updateState();
+ }
+
+ /**
+ * Installs the combobox listeners.
+ *
+ * @since 0.6
+ */
+ private void installLocationListeners() {
+ this.cbxRepository.addModifyListener(this);
+ this.cbxServer.addModifyListener(this);
+ this.cbxWorkspace.addModifyListener(this);
+ }
+
+ private void loadServers() {
+ // TODO implement loadServers()
+ String[] data = new String[20];
+ for (int i = 0; i < 20; ++i) data[i] = "server" + i; //$NON-NLS-1$
+ this.cbxServer.setItems(data);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText( ModifyEvent e ) {
+ if (e.widget == this.cbxServer) {
+ handleServerModified();
+ } else if (e.widget == this.cbxRepository) {
+ handleRepositoryModified();
+ } else if (e.widget == this.cbxRepository) {
+ handleWorkspaceModified();
+ } else {
+ // should not happen
+ // TODO log
+ }
+ }
+
+ /**
+ * Reloads the repository combobox based on the newly selected server.
+ *
+ * @since 0.6
+ */
+ private void reloadRepositories() {
+ // TODO implement reloadRepositories()
+ // if only one repository set it on the combobox
+ // if no repositories ???
+ }
+
+ /**
+ * Reloads the repository combobox based on the newly selected server.
+ *
+ * @since 0.6
+ */
+ private void reloadWorkspaces() {
+ // TODO implement reloadRepositories()
+ // if only one workspace set it on the combobox
+ // if no workspaces ???
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ * @since 0.6
+ */
+ @Override
+ public void setVisible( boolean visible ) {
+ super.setVisible(visible);
+
+ if (visible) {
+ // set initial state
+ validate();
+
+ // set initial message
+ setMessage((type == Type.PUBLISH) ? I18n.PublishPagePublishOkStatusMsg :
I18n.PublishPageUnpublishOkStatusMsg);
+ }
+ }
+
+ /**
+ * Uninstalls the combobox listeners.
+ *
+ * @since 0.6
+ */
+ private void uninstallLocationListeners() {
+ this.cbxRepository.removeModifyListener(this);
+ this.cbxServer.removeModifyListener(this);
+ this.cbxWorkspace.removeModifyListener(this);
+ }
+
+ /**
+ * Updates message, message icon, and OK button enablement based on validation
results
+ *
+ * @since 0.6
+ */
+ private void updateState() {
+ // get the current state
+ validate();
+
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
+
+ // update page message
+ if (this.status.isError()) {
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ } else {
+ if (this.status.isWarning()) {
+ setMessage(this.status.getMessage(), IMessageProvider.WARNING);
+ } else if (this.status.isInfo()) {
+ setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
+ } else {
+ setMessage(I18n.ServerPageOkStatusMsg);
+ }
+ }
+ }
+
+ /**
+ * Validates all inputs and sets the validation status.
+ *
+ * @since 0.6
+ */
+ private void validate() {
+ String msg = null;
+ Severity severity = Severity.ERROR;
+
+ if (this.resources != null && this.resources.isEmpty()) {
+ // should not happen since action should not enable if nothing selected
+ msg = I18n.PublishPageNoResourcesStatusMsg;
+ } else if (this.server == null) {
+ int count = this.cbxServer.getItemCount();
+ msg = ((count == 0) ? I18n.PublishPageNoAvailableServersStatusMsg :
I18n.PublishPageMissingServerStatusMsg);
+ } else if (this.repository == null) {
+ int count = this.cbxRepository.getItemCount();
+ msg = ((count == 0) ? I18n.PublishPageNoAvailableRepositoriesStatusMsg :
I18n.PublishPageMissingRepositoryStatusMsg);
+ } else if (this.workspace == null) {
+ int count = this.cbxServer.getItemCount();
+ msg = ((count == 0) ? I18n.PublishPageNoAvailableWorkspacesStatusMsg :
I18n.PublishPageMissingWorkspaceStatusMsg);
+ } else {
+ severity = Severity.OK;
+ msg = ((type == Type.PUBLISH) ? I18n.PublishPagePublishOkStatusMsg :
I18n.PublishPageUnpublishOkStatusMsg);
+ }
+
+ this.status = new Status(severity, msg, null);
+ }
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishWizard.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishWizard.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishWizard.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,160 @@
+/*
+ * 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.publish.ui.swt.wizards;
+
+import java.util.List;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.dna.publish.ServerManager;
+import org.jboss.dna.publish.ui.swt.I18n;
+
+/**
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class PublishWizard extends Wizard {
+
+ //
===========================================================================================================================
+ // Constants
+ //
===========================================================================================================================
+
+ /**
+ * The wizard type.
+ *
+ * @since 0.6
+ */
+ public enum Type {
+ /**
+ * Indicates the wizard will be used to publish.
+ *
+ * @since 0.6
+ */
+ PUBLISH,
+
+ /**
+ * Indicates the wizard will be used to unpublish.
+ *
+ * @since 0.6
+ */
+ UNPUBLISH
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The wizard page containing all the controls that allow publishing/unpublishing of
resources.
+ *
+ * @since 0.6
+ */
+ private final PublishPage page;
+
+ /**
+ * The manager in charge of the server registry.
+ *
+ * @since 0.6
+ */
+ private final ServerManager serverManager;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param type the publishing or unpublishing indicator
+ * @param resources the resources being published or unpublished (never
<code>null</code>)
+ * @param serverManager the server manager in charge of the server registry (never
<code>null</code>)
+ * @since 0.6
+ */
+ public PublishWizard( Type type,
+ List<IResource> resources,
+ ServerManager serverManager ) {
+ this.page = new PublishPage(type, resources);
+ this.serverManager = serverManager;
+ setWindowTitle((type == Type.PUBLISH) ? I18n.PublishWizardPublishTitle :
I18n.PublishWizardUnpublishTitle);
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ * @since 0.6
+ */
+ @Override
+ public void addPages() {
+ addPage(this.page);
+ }
+
+ /**
+ * @return the server manager (never <code>null</code>)
+ * @since 0.6
+ */
+ protected ServerManager getServerManager() {
+ return this.serverManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ * @since 0.6
+ */
+ @Override
+ public boolean performFinish() {
+ // TODO implement performFinish()
+ // Status status = null;
+ return true; //!status.isError();
+ }
+
+ //
===========================================================================================================================
+ // Test UI
+ //
===========================================================================================================================
+
+ public static void main( String[] args ) {
+ Display display = new Display();
+
+ Shell shell = new Shell(display);
+ shell.setText("Shell"); //$NON-NLS-1$
+ shell.setSize(200, 200);
+ shell.open();
+
+ WizardDialog dialog = new WizardDialog(shell, new PublishWizard(Type.PUBLISH,
null, new ServerManager("/home/dan"))); //$NON-NLS-1$
+ dialog.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+
+ display.dispose();
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/PublishWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerPage.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerPage.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerPage.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,334 @@
+/*
+ * 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.publish.ui.swt.wizards;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.dna.publish.ServerManager;
+import org.jboss.dna.publish.Status;
+import org.jboss.dna.publish.domain.Server;
+import org.jboss.dna.publish.domain.validation.ServerValidator;
+import org.jboss.dna.publish.ui.swt.I18n;
+
+/**
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class ServerPage extends WizardPage {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The user password needed to login to the server.
+ *
+ * @since 0.6
+ */
+ private String password;
+
+ /**
+ * The current validation status.
+ *
+ * @since 0.6
+ */
+ private Status status;
+
+ /**
+ * The server URL.
+ *
+ * @since 0.6
+ */
+ private String url;
+
+ /**
+ * The user needed to login to the server.
+ *
+ * @since 0.6
+ */
+ private String user;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ public ServerPage() {
+ super(ServerPage.class.getSimpleName());
+ setTitle(I18n.ServerPageTitle);
+ }
+
+ public ServerPage( Server server ) {
+ super(ServerPage.class.getSimpleName());
+ setTitle(I18n.ServerPageTitle);
+
+ this.url = server.getUrl();
+ this.user = server.getUser();
+ this.password = server.getPassword();
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ private void constructAuthenticationPanel( Composite parent ) {
+ Group pnl = new Group(parent, SWT.NONE);
+ pnl.setText(I18n.ServerPageAuthenticationGroupTitle);
+ pnl.setLayout(new GridLayout(2, false));
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ { // user row
+ Label lblUser = new Label(pnl, SWT.LEFT);
+ lblUser.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblUser.setText(I18n.ServerPageUserLabel);
+
+ Text txtUser = new Text(pnl, SWT.BORDER);
+ txtUser.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ txtUser.setToolTipText(I18n.ServerPageUserToolTip);
+
+ // set initial value
+ if (this.user != null) {
+ txtUser.setText(this.user);
+ }
+
+ txtUser.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText( ModifyEvent e ) {
+ handleUserModified(((Text)e.widget).getText());
+ }
+ });
+ }
+
+ { // password row
+ Label lblPassword = new Label(pnl, SWT.LEFT);
+ lblPassword.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblPassword.setText(I18n.ServerPagePasswordLabel);
+
+ Text txtPassword = new Text(pnl, SWT.BORDER);
+ txtPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ txtPassword.setToolTipText(I18n.ServerPagePasswordToolTip);
+ txtPassword.setEchoChar('*');
+
+ // set initial value
+ if (this.password != null) {
+ txtPassword.setText(this.password);
+ }
+
+ txtPassword.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText( ModifyEvent e ) {
+ handlePasswordModified(((Text)e.widget).getText());
+ }
+ });
+ }
+
+ { // save button row
+ Button btn = new Button(pnl, SWT.CHECK | SWT.LEFT);
+ btn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ ((GridData)btn.getLayoutData()).horizontalSpan = 2;
+ btn.setText(I18n.ServerPageSavePasswordButton);
+ btn.setToolTipText(I18n.ServerPageSavePasswordToolTip);
+ }
+
+ { // save password message row
+ Label lblImage = new Label(pnl, SWT.NONE);
+ lblImage.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+
lblImage.setImage(Display.getDefault().getSystemImage(SWT.ICON_INFORMATION));
+
+ StyledText st = new StyledText(pnl, SWT.READ_ONLY | SWT.MULTI | SWT.NO_FOCUS
| SWT.WRAP);
+ st.setText(I18n.ServerPageSavePasswordLabel);
+
st.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ st.setCaret(null);
+ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ gd.grabExcessVerticalSpace = false;
+ gd.horizontalIndent = 4;
+ gd.verticalIndent = 8;
+ gd.widthHint = 100;
+ st.setLayoutData(gd);
+ }
+ }
+
+ private void constructUrlPanel( Composite parent ) {
+ Composite pnl = new Composite(parent, SWT.NONE);
+ pnl.setLayout(new GridLayout(2, false));
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label lblUrl = new Label(pnl, SWT.LEFT);
+ lblUrl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblUrl.setText(I18n.ServerPageUrlLabel);
+
+ Text txtUrl = new Text(pnl, SWT.BORDER);
+ txtUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ txtUrl.setToolTipText(I18n.ServerPageUrlToolTip);
+
+ // set initial value
+ if (this.url != null) {
+ txtUrl.setText(this.url);
+ }
+
+ txtUrl.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText( ModifyEvent e ) {
+ handleUrlModified(((Text)e.widget).getText());
+ }
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl( Composite parent ) {
+ Composite pnlMain = new Composite(parent, SWT.NONE);
+ pnlMain.setLayout(new GridLayout());
+ pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ constructUrlPanel(pnlMain);
+ constructAuthenticationPanel(pnlMain);
+ setControl(pnlMain);
+ }
+
+ /**
+ * @return the server represented by the dialog inputs
+ * @throws RuntimeException if called when all inputs are not valid
+ * @see #isPageComplete()
+ * @since 0.6
+ */
+ public Server getServer() {
+ if (!this.status.isError()) {
+ return new Server(this.url, this.user, this.password);
+ }
+
+ // should never be called if error status
+ throw new RuntimeException(I18n.ServerPageInvalidServerProperties);
+ }
+
+ /**
+ * @return the server manager obtained from the wizard
+ * @since 0.6
+ */
+ private ServerManager getServerManager() {
+ return ((ServerWizard)getWizard()).getServerManager();
+ }
+
+ /**
+ * Handler for when the password control value is modified
+ *
+ * @param newPassword the new password value
+ * @since 0.6
+ */
+ void handlePasswordModified( String newPassword ) {
+ this.password = newPassword;
+ updateState();
+ }
+
+ /**
+ * Handler for when the URL control value is modified
+ *
+ * @param newUrl the new URL value
+ * @since 0.6
+ */
+ void handleUrlModified( String newUrl ) {
+ this.url = newUrl;
+ updateState();
+ }
+
+ /**
+ * Handler for when the user control value is modified
+ *
+ * @param newUser the new user value
+ * @since 0.6
+ */
+ void handleUserModified( String newUser ) {
+ this.user = newUser;
+ updateState();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ * @since 0.6
+ */
+ @Override
+ public void setVisible( boolean visible ) {
+ super.setVisible(visible);
+
+ if (visible) {
+ // set initial state
+ validate();
+
+ // set initial message
+ setMessage(I18n.ServerPageOkStatusMsg);
+ }
+ }
+
+ /**
+ * Updates message, message icon, and OK button enablement based on validation
results
+ *
+ * @since 0.6
+ */
+ private void updateState() {
+ // get the current status
+ validate();
+
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
+
+ // update message
+ if (this.status.isError()) {
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ } else {
+ if (this.status.isWarning()) {
+ setMessage(this.status.getMessage(), IMessageProvider.WARNING);
+ } else if (this.status.isInfo()) {
+ setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
+ } else {
+ setMessage(I18n.ServerPageOkStatusMsg);
+ }
+ }
+ }
+
+ /**
+ * Validates all inputs and sets the validation status.
+ *
+ * @since 0.6
+ */
+ private void validate() {
+ this.status = ServerValidator.isValid(this.url, this.user, this.password,
getServerManager());
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerWizard.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerWizard.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerWizard.java 2009-06-23
18:44:56 UTC (rev 1062)
@@ -0,0 +1,144 @@
+/*
+ * 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.publish.ui.swt.wizards;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.dna.publish.ServerManager;
+import org.jboss.dna.publish.Status;
+import org.jboss.dna.publish.domain.Server;
+import org.jboss.dna.publish.ui.swt.I18n;
+
+/**
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class ServerWizard extends Wizard {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The wizard page containing all the controls that allow editing of server
properties.
+ *
+ * @since 0.6
+ */
+ private final ServerPage page;
+
+ /**
+ * The manager in charge of the server registry.
+ *
+ * @since 0.6
+ */
+ private final ServerManager serverManager;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param serverManager the server manager in charge of the server registry (never
<code>null</code>)
+ * @since 0.6
+ */
+ public ServerWizard( ServerManager serverManager ) {
+ this.page = new ServerPage();
+ this.serverManager = serverManager;
+ setWindowTitle(I18n.ServerWizardNewServerTitle);
+ }
+
+ /**
+ * @param serverManager the server manager in charge of the server registry (never
<code>null</code>)
+ * @param server the server whose properties are being edited (never
<code>null</code>)
+ * @since 0.6
+ */
+ public ServerWizard( ServerManager serverManager,
+ Server server ) {
+ this.page = new ServerPage(server);
+ this.serverManager = serverManager;
+ setWindowTitle(I18n.ServerWizardEditServerTitle);
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ * @since 0.6
+ */
+ @Override
+ public void addPages() {
+ addPage(this.page);
+ }
+
+ /**
+ * @return the server manager (never <code>null</code>)
+ * @since 0.6
+ */
+ protected ServerManager getServerManager() {
+ return this.serverManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ * @since 0.6
+ */
+ @Override
+ public boolean performFinish() {
+ Server server = this.page.getServer();
+ Status status = this.serverManager.addServer(server);
+ return !status.isError();
+ }
+
+ //
===========================================================================================================================
+ // Test UI
+ //
===========================================================================================================================
+
+ public static void main( String[] args ) {
+ Display display = new Display();
+
+ Shell shell = new Shell(display);
+ shell.setText("Shell"); //$NON-NLS-1$
+ shell.setSize(200, 200);
+ shell.open();
+
+ WizardDialog dialog = new WizardDialog(shell, new ServerWizard(new
ServerManager("/home/dan"))); //$NON-NLS-1$
+// WizardDialog dialog = new WizardDialog(shell, new ServerWizard(new
ServerManager("/home/dan"), new Server("file:", "user",
null)));
+ dialog.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+
+ display.dispose();
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/publish/ui/swt/wizards/ServerWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain