Author: elvisisking
Date: 2009-05-29 17:20:49 -0400 (Fri, 29 May 2009)
New Revision: 953
Added:
branches/eclipse/org.jboss.dna.publish/.classpath
branches/eclipse/org.jboss.dna.publish/.project
branches/eclipse/org.jboss.dna.publish/.settings/
branches/eclipse/org.jboss.dna.publish/.settings/org.eclipse.jdt.core.prefs
branches/eclipse/org.jboss.dna.publish/META-INF/
branches/eclipse/org.jboss.dna.publish/META-INF/MANIFEST.MF
branches/eclipse/org.jboss.dna.publish/build.properties
branches/eclipse/org.jboss.dna.publish/icons/
branches/eclipse/org.jboss.dna.publish/icons/full/
branches/eclipse/org.jboss.dna.publish/icons/full/cview16/
branches/eclipse/org.jboss.dna.publish/icons/full/cview16/repository.gif
branches/eclipse/org.jboss.dna.publish/icons/full/obj16/
branches/eclipse/org.jboss.dna.publish/icons/full/obj16/repository.gif
branches/eclipse/org.jboss.dna.publish/icons/full/obj16/server.gif
branches/eclipse/org.jboss.dna.publish/icons/full/obj16/workspace.gif
branches/eclipse/org.jboss.dna.publish/jettison-1.1-sources.jar
branches/eclipse/org.jboss.dna.publish/jettison-1.1.jar
branches/eclipse/org.jboss.dna.publish/plugin.properties
branches/eclipse/org.jboss.dna.publish/plugin.xml
branches/eclipse/org.jboss.dna.publish/src/
branches/eclipse/org.jboss.dna.publish/src/org/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/Activator.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/I18n.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/IConstants.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ServerManager.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/PublishAction.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/UnpublishAction.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/IDnaObject.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Repository.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Server.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Workspace.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/i18n.properties
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/IUiConstants.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/UiUtil.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/DeleteServerDialog.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/ServerDialog.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryContentProvider.java
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryView.java
Log:
Added: branches/eclipse/org.jboss.dna.publish/.classpath
===================================================================
--- branches/eclipse/org.jboss.dna.publish/.classpath (rev 0)
+++ branches/eclipse/org.jboss.dna.publish/.classpath 2009-05-29 21:20:49 UTC (rev 953)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib"
path="jettison-1.1.jar"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: branches/eclipse/org.jboss.dna.publish/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish/.project
===================================================================
--- branches/eclipse/org.jboss.dna.publish/.project (rev 0)
+++ branches/eclipse/org.jboss.dna.publish/.project 2009-05-29 21:20:49 UTC (rev 953)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.dna.publish</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/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/eclipse/org.jboss.dna.publish/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish/.settings/org.eclipse.jdt.core.prefs 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,7 @@
+#Wed May 20 08:35:05 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/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish/META-INF/MANIFEST.MF
===================================================================
--- branches/eclipse/org.jboss.dna.publish/META-INF/MANIFEST.MF
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish/META-INF/MANIFEST.MF 2009-05-29 21:20:49 UTC
(rev 953)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.jboss.dna.publish; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.dna.publish.Activator
+Bundle-Vendor: %bundleVendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Bundle-ClassPath: dnaPublish.jar,
+ jettison-1.1.jar
Property changes on: branches/eclipse/org.jboss.dna.publish/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish/build.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish/build.properties (rev
0)
+++ branches/eclipse/org.jboss.dna.publish/build.properties 2009-05-29 21:20:49 UTC (rev
953)
@@ -0,0 +1,9 @@
+bin.includes = plugin.xml,\
+ META-INF/,\
+ plugin.properties,\
+ jettison-1.1.jar,\
+ icons/,\
+ dnaPublish.jar
+jars.compile.order = dnaPublish.jar
+src.includes = src/
+source.dnaPublish.jar = src/
Property changes on: branches/eclipse/org.jboss.dna.publish/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish/icons/full/cview16/repository.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish/icons/full/cview16/repository.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish/icons/full/obj16/repository.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish/icons/full/obj16/repository.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish/icons/full/obj16/server.gif
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish/icons/full/obj16/server.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish/icons/full/obj16/workspace.gif
===================================================================
(Binary files differ)
Property changes on:
branches/eclipse/org.jboss.dna.publish/icons/full/obj16/workspace.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish/jettison-1.1-sources.jar
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish/jettison-1.1-sources.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish/jettison-1.1.jar
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish/jettison-1.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish/plugin.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish/plugin.properties (rev
0)
+++ branches/eclipse/org.jboss.dna.publish/plugin.properties 2009-05-29 21:20:49 UTC (rev
953)
@@ -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 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/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish/plugin.xml
===================================================================
--- branches/eclipse/org.jboss.dna.publish/plugin.xml (rev 0)
+++ branches/eclipse/org.jboss.dna.publish/plugin.xml 2009-05-29 21:20:49 UTC (rev 953)
@@ -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.unpublishAction"
+ label="%unpublishAction.label"
+ class="org.jboss.dna.publish.actions.UnpublishAction"
+ menubarPath="org.jboss.dna.publish.contextMenu/group1"
+ enablesFor="*">
+ </action>
+
+ <!-- Publish action -->
+ <action
+ id="org.jboss.dna.publish.publishAction"
+ label="%publishAction.label"
+ class="org.jboss.dna.publish.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.views.RepositoryView"
+ fastViewWidthRatio="0.25"
+ icon="icons/full/cview16/repository.gif">
+ </view>
+ </extension>
+
+</plugin>
Property changes on: branches/eclipse/org.jboss.dna.publish/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/Activator.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/Activator.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/Activator.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -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;
+
+import static org.jboss.dna.publish.IConstants.PLUGIN_ID;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class Activator extends AbstractUIPlugin {
+
+ //
===========================================================================================================================
+ // Class Fields
+ //
===========================================================================================================================
+
+ /**
+ * The shared plugin instance.
+ *
+ * @since 0.6
+ */
+ private static Activator plugin;
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * @param key the relative path to the image file
+ * @return the image descriptor or <code>null</code>
+ * @since 0.6
+ */
+ private ImageDescriptor createImageDescriptor( String key ) {
+ try {
+ URL url = new URL(getBundle().getEntry("/").toString() + key);
//$NON-NLS-1$
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
+ ImageRegistry registry = getImageRegistry();
+ registry.put(key, descriptor);
+ return descriptor;
+ } catch (final MalformedURLException e) {
+ // TODO log this or return missing image
+ return null;
+ }
+ }
+
+ /**
+ * @return the shared instance or <code>null</code> if bundle is not
started
+ * @since 0.6
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param path the path
+ * @return the image descriptor for the image file at the given plug-in relative
path
+ * @since 0.6
+ */
+ public static ImageDescriptor getImageDescriptor( String path ) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ /**
+ * Retrieves the image associated with the specified key from the {@link
org.eclipse.jface.resource.ImageRegistry image
+ * registry}, creating the image and registering it if it doesn't already exist.
A <code>null</code> key will cause the
+ * missing image descriptor to be returned.
+ *
+ * @param relativePathToImage the relative path to the image to retrieve. This must
be in the form of the path to the image
+ * file relative to this plug-in's folder (can be
<code>null</code>).
+ * @return the image associated with the specified path or the default missing image
+ * @since 0.6
+ */
+ public final Image getImage( String relativePathToImage ) {
+ final ImageRegistry registry = getImageRegistry();
+ Image img = registry.get(relativePathToImage);
+
+ if (img != null) {
+ return img;
+ }
+
+ // image has never been cached
+ try {
+ createImageDescriptor(relativePathToImage);
+ img = registry.get(relativePathToImage);
+ return (img != null ? img :
ImageDescriptor.getMissingImageDescriptor().createImage());
+ } catch (SWTException e) {
+ // TODO log this or return missing image
+ return null;
+ }
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The server manager of this plugin.
+ *
+ * @since 0.6
+ */
+ private ServerManager serverMgr;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * Constructs the plugin activator.
+ * <p>
+ * Note: If this is called outside the OSGi framework you
<strong>MUST</strong> also call {@link #initialize(String)}.
+ *
+ * @since 0.6
+ * @see #initialize(String)
+ */
+ public Activator() {
+ // nothing to do but wanted javadocs for the default constructor
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * @return the {@link ServerManager Server Manager} or <code>null</code>
if not plugin is not initialized
+ * @see #initialize(String)
+ * @since 0.6
+ */
+ public ServerManager getServerManager() {
+ return this.serverMgr;
+ }
+
+ /**
+ * Performs plugin initialization. One thing it does is initialize the {@link
ServerManager}.
+ * <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>).
+ *
+ * @since 0.6
+ */
+ public void initialize( String stateLocationPath ) {
+ plugin = this;
+ serverMgr = new ServerManager(stateLocationPath);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * When the OSGi framework is not running (i.e., <code>context</code> is
<code>null</code>) you <strong>MUST</strong> also
+ * call {@link #initialize(String)}.
+ *
+ * @see
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ * @since 0.6
+ * @see #initialize(String)
+ */
+ @Override
+ public void start( BundleContext context ) throws Exception {
+ if (context != null) {
+ super.start(context);
+ initialize(plugin.getStateLocation().toFile().getAbsolutePath());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Also informs the {@link ServerManager} to shutdown.
+ * <p>
+ * Note: This can safely be called when the OSGi framework is not running (i.e.,
<code>context</code> is <code>null</code>).
+ *
+ * @see
org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ * @since 0.6
+ */
+ @Override
+ public void stop( BundleContext context ) throws Exception {
+ serverMgr.saveState();
+
+ if (context != null) {
+ super.stop(context);
+ }
+
+ plugin = null;
+ serverMgr = null;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/Activator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/I18n.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/I18n.java
(rev 0)
+++ branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/I18n.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,76 @@
+/*
+ * 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;
+
+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 ServerDialogEditTitle;
+ public static String ServerDialogNewTitle;
+ public static String ServerDialogPasswordLabel;
+ public static String ServerDialogSavePasswordButton;
+ public static String ServerDialogSavePasswordLabel;
+ public static String ServerDialogUserLabel;
+ public static String ServerDialogUrlLabel;
+
+ public static String NewServerActionText;
+ public static String NewServerActionToolTip;
+
+ public static String RepositoryInvalidNameMsg;
+ public static String RepositoryInvalidServerMsg;
+ public static String RepositoryShortDescription;
+
+ public static String ServerShortDescription;
+ public static String ServerInvalidPasswordMsg;
+ public static String ServerInvalidUrlMsg;
+ public static String ServerInvalidUserMsg;
+
+ public static String WorkspaceInvalidNameMsg;
+ public static String WorkspaceInvalidRepositoryMsg;
+ public static String WorkspaceShortDescription;
+
+ static {
+ // load message bundle
+ NLS.initializeMessages(I18n.class.getPackage() + "i18n", I18n.class);
//$NON-NLS-1$
+ }
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/I18n.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/IConstants.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/IConstants.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/IConstants.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,12 @@
+package org.jboss.dna.publish;
+
+public interface IConstants {
+
+ /**
+ * The Plug-in's identifier.
+ *
+ * @since 0.6
+ */
+ public static final String PLUGIN_ID = "org.jboss.dna.publish";
//$NON-NLS-1$
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/IConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ServerManager.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ServerManager.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ServerManager.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,141 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.dna.publish.domain.Server;
+
+/**
+ * The Server Manager class managers the creation, deletion, and editing of servers.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class ServerManager {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * @since 0.6
+ */
+ private final String stateLocationPath;
+
+ /**
+ * @since 0.6
+ */
+ private final List<Server> servers;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * @param stateLocationPath the directory where the {@link Server} registry} is
persisted (may be <code>null</code> if
+ * persistence is not desired)
+ * @since 0.6
+ */
+ public ServerManager( String path ) {
+ this.servers = Collections.synchronizedList(new ArrayList<Server>());
+ this.stateLocationPath = path;
+ restoreState();
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * Registers the specified <code>Server</code>.
+ *
+ * @param server the server being added
+ * @return a status indicating if the server was added to the registry
+ * @since 0.6
+ */
+ public IStatus addServer( Server server ) {
+ if (!this.servers.contains(server)) {
+ this.servers.add(server);
+ return Status.OK_STATUS;
+ }
+
+ // TODO implement error status
+ return null;
+ }
+
+ /**
+ * @return an unmodifiable collection of registered servers (never
<code>null</code>)
+ * @since 0.6
+ */
+ public Collection<Server> getServers() {
+ return Collections.unmodifiableCollection(this.servers);
+ }
+
+ /**
+ * @param server the server being removed
+ * @return a status indicating if the specified server was removed from the registry
+ * @since 0.6
+ */
+ public IStatus removeServer( Server server ) {
+ if (this.servers.remove(server)) {
+ return Status.OK_STATUS;
+ }
+
+ // TODO implement error status
+ return null;
+ }
+
+ /**
+ * @since 0.6
+ */
+ private IStatus restoreState() {
+ if (this.stateLocationPath != null) {
+ // TODO implement
+ }
+
+ // do nothing of there is no save location
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Saves the {@link Server} registry to the file system.
+ *
+ * @return a status indicating if the registry was successfully saved
+ * @since 0.6
+ */
+ public IStatus saveState() {
+ if (this.stateLocationPath != null) {
+ // TODO implement
+ }
+
+ // do nothing of there is no save location
+ return Status.OK_STATUS;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ServerManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/PublishAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/PublishAction.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/PublishAction.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,78 @@
+/*
+ * 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.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+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 {
+
+ /**
+ * 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/src/org/jboss/dna/publish/actions/PublishAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/UnpublishAction.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/UnpublishAction.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/actions/UnpublishAction.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -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.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/src/org/jboss/dna/publish/actions/UnpublishAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/IDnaObject.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/IDnaObject.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/IDnaObject.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,60 @@
+/*
+ * 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.domain;
+
+import java.util.List;
+
+/**
+ * The IDnaObject class defines a business object.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public interface IDnaObject {
+
+ /**
+ * @return an ordered list of children (never <code>null</code>)
+ * @since 0.6
+ */
+ List<? extends IDnaObject> getChildren();
+
+ /**
+ * @return the object name (never <code>null</code>)
+ * @since 0.6
+ */
+ String getName();
+
+ /**
+ * @return the parent or <code>null</code>
+ * @since 0.6
+ */
+ IDnaObject getParent();
+
+ /**
+ * @return a description suitable for use in a tooltip (never
<code>null</code>)
+ * @since 0.6
+ */
+ String getShortDescription();
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/IDnaObject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Repository.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Repository.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Repository.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,214 @@
+/*
+ * 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.domain;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.dna.publish.I18n;
+
+/**
+ * The Repository class is the business object for a DNA repository.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class Repository implements IDnaObject {
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * This method validates a proposed name and should be called before constructing a
{@link Repository}.
+ *
+ * @param proposedName the name being validated
+ * @return <code>true</code> if the name is valid
+ * @since 0.6
+ */
+ public static boolean validateName( String proposedName ) {
+ return ((proposedName != null) && (proposedName.length() != 0));
+ }
+
+ /**
+ * This method validates a proposed {@link Server server} and should be called before
constructing a {@link Repository}.
+ *
+ * @param proposedServer the server being tested
+ * @return <code>true</code> if the server is valid
+ */
+ public static boolean validateServer( Server proposedServer ) {
+ return (proposedServer != null);
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The repository name.
+ *
+ * @since 0.6
+ */
+ private final String name;
+
+ /**
+ * The server where this repository resides.
+ *
+ * @since 0.6
+ */
+ private final Server server;
+
+ // TODO root publishing path
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * Constructs a new <code>Repository</code>.
+ *
+ * @param name the repository name
+ * @param server the server where this repository resides
+ * @see #validateName(String)
+ * @see #validateServer(Server)
+ * @throws RuntimeException if any of the input parameters are invalid
+ * @since 0.6
+ */
+ public Repository( String name,
+ Server server ) {
+ // validate inputs first
+ if (!validateName(name)) {
+ throw new RuntimeException(NLS.bind(I18n.RepositoryInvalidNameMsg, name));
+ }
+
+ if (!validateServer(server)) {
+ throw new RuntimeException(I18n.RepositoryInvalidServerMsg);
+ }
+
+ // OK to construct
+ this.name = name;
+ this.server = server;
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (this == obj) return true;
+ if ((obj == null) || (getClass() != obj.getClass())) return false;
+
+ // must have another server
+ Repository otherRepository = (Repository)obj;
+ return (this.name.equals(otherRepository.name) &&
this.server.equals(otherRepository.server));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getChildren()
+ * @since 0.6
+ */
+ @Override
+ public List<? extends IDnaObject> getChildren() {
+ // a repository's children are workspaces
+ Collection<Workspace> kids = getWorkspaces();
+ return Arrays.asList(kids.toArray(new IDnaObject[kids.size()]));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getName()
+ * @since 0.6
+ */
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getParent()
+ * @since 0.6
+ */
+ @Override
+ public IDnaObject getParent() {
+ // a repository's parent is a server
+ return getServer();
+ }
+
+ /**
+ * @return the server where this repository is located
+ * @since 0.6
+ */
+ public Server getServer() {
+ return this.server;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getShortDescription()
+ * @since 0.6
+ */
+ @Override
+ public String getShortDescription() {
+ return NLS.bind(I18n.RepositoryShortDescription, this.name,
this.server.getShortDescription());
+ }
+
+ /**
+ * @return the DNA repository workspaces (never <code>null</code>)
+ * @since 0.6
+ */
+ public Collection<Workspace> getWorkspaces() {
+ // TODO implement
+ return Collections.emptyList();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ * @since 0.6
+ */
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 31 * hash + this.name.hashCode();
+ hash = 31 * hash + this.server.hashCode();
+ return hash;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Repository.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Server.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Server.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Server.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,256 @@
+/*
+ * 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.domain;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.dna.publish.I18n;
+
+/**
+ * The Server class is the business object for a server that is hosting one or more DNA
repositories.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class Server implements IDnaObject {
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * This method validates a proposed server URL and should be called before
constructing a {@link Server}.
+ *
+ * @param proposedUrl the URL being validated
+ * @return <code>true</code> if the URL is valid
+ * @since 0.6
+ */
+ public static boolean validateUrl( String proposedUrl ) {
+ return ((proposedUrl != null) && (proposedUrl.length() != 0));
+ }
+
+ /**
+ * This method validates a proposed server authentication user and should be called
before constructing a {@link Server}.
+ *
+ * @param proposedUser the user being validated
+ * @return <code>true</code> if the user is valid
+ * @since 0.6
+ */
+ public static boolean validateUser( String proposedUser ) {
+ return ((proposedUser != null) && (proposedUser.length() != 0));
+ }
+
+ /**
+ * This method validates a proposed server authentication password and should be
called before constructing a {@link Server}.
+ *
+ * @param proposedPassword the password being validated
+ * @return <code>true</code> if the password is valid
+ * @since 0.6
+ */
+ public static boolean validatePassword( String proposedPassword ) {
+ return ((proposedPassword != null) && (proposedPassword.length() != 0));
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The server URL.
+ *
+ * @since 0.6
+ */
+ private final String url;
+
+ /**
+ * The user name to use when logging on to the server.
+ *
+ * @since 0.6
+ */
+ private final String user;
+
+ /**
+ * The password to use when logging on to the server.
+ *
+ * @since 0.6
+ */
+ private final String pswd;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * Constructs on new <code>Server</code>.
+ *
+ * @param url the server URL
+ * @param user the server authentication user
+ * @param pswd the server authentication password
+ * @see #validateUrl(String)
+ * @see #validateUser(String)
+ * @see #validatePassword(String)
+ * @throws RuntimeException if any of the input parameters are invalid
+ * @since 0.6
+ */
+ public Server( String url,
+ String user,
+ String pswd ) {
+ // valid inputs first
+ if (!validateUrl(url)) {
+ throw new RuntimeException(NLS.bind(I18n.ServerInvalidUrlMsg, url));
+ }
+
+ if (!validateUrl(user)) {
+ throw new RuntimeException(NLS.bind(I18n.ServerInvalidUserMsg, user));
+ }
+
+ if (!validateUrl(pswd)) {
+ throw new RuntimeException(NLS.bind(I18n.ServerInvalidPasswordMsg, pswd));
+ }
+
+ // OK to construct
+ this.url = url;
+ this.user = user;
+ this.pswd = pswd;
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (this == obj) return true;
+ if ((obj == null) || (getClass() != obj.getClass())) return false;
+
+ // must have another server
+ Server otherServer = (Server)obj;
+ return (this.url.equals(otherServer.url) &&
this.user.equals(otherServer.user));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getChildren()
+ * @see #getRepositories()
+ * @since 0.6
+ */
+ @Override
+ public List<? extends IDnaObject> getChildren() {
+ // a server's children are repositories
+ Collection<Repository> kids = getRepositories();
+ return Arrays.asList(kids.toArray(new IDnaObject[kids.size()]));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getName()
+ * @since 0.6
+ */
+ @Override
+ public String getName() {
+ return getUrl();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getParent()
+ * @since 0.6
+ */
+ @Override
+ public IDnaObject getParent() {
+ // a server does not have a parent
+ return null;
+ }
+
+ /**
+ * @return the server authentication password
+ * @since 0.6
+ */
+ public String getPassword() {
+ return this.pswd;
+ }
+
+ /**
+ * @return the server DNA repositories (never <code>null</code>)
+ * @since 0.6
+ */
+ public Collection<Repository> getRepositories() {
+ // TODO implement
+ return Collections.emptyList();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getShortDescription()
+ * @since 0.6
+ */
+ @Override
+ public String getShortDescription() {
+ return NLS.bind(I18n.ServerShortDescription, this.url, this.user);
+ }
+
+ /**
+ * @return the server URL
+ * @since 0.6
+ */
+ public String getUrl() {
+ return this.url;
+ }
+
+ /**
+ * @return the server authentication user
+ * @since 0.6
+ */
+ public String getUser() {
+ return this.user;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ * @since 0.6
+ */
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 31 * hash + this.url.hashCode();
+ hash = 31 * hash + this.user.hashCode();
+ return hash;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Server.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Workspace.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Workspace.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Workspace.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,179 @@
+/*
+ * 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.domain;
+
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.dna.publish.I18n;
+
+/**
+ * The Workspace class is the business object for a DNA repository workspace.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public class Workspace implements IDnaObject {
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * This method validates a proposed name and should be called before constructing a
{@link Workspace}.
+ *
+ * @param proposedName the name being validated
+ * @return <code>true</code> if the name is valid
+ * @since 0.6
+ */
+ public static boolean validateName( String proposedName ) {
+ return ((proposedName != null) && (proposedName.length() != 0));
+ }
+
+ /**
+ * This method validates a proposed {@link Repository repository} and should be
called before constructing a {@link Workspace}
+ * .
+ *
+ * @param proposedRepository the repository being tested
+ * @return <code>true</code> if the repository is valid
+ */
+ public static boolean validateRepository( Repository proposedRepository ) {
+ return (proposedRepository != null);
+ }
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ /**
+ * The workspace name.
+ *
+ * @since 0.6
+ */
+ private final String name;
+
+ /**
+ * The repository where this workspace resides.
+ *
+ * @since 0.6
+ */
+ private final Repository repository;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * Constructs a new <code>Workspace</code>.
+ *
+ * @param name the workspace name
+ * @param server the repository where this workspace resides
+ * @see #validateName(String)
+ * @see #validateRepository(Server)
+ * @throws RuntimeException if any of the input parameters are invalid
+ * @since 0.6
+ */
+ public Workspace( String name,
+ Repository repository ) {
+ // validate inputs first
+ if (!validateName(name)) {
+ throw new RuntimeException(NLS.bind(I18n.WorkspaceInvalidNameMsg, name));
+ }
+
+ if (!validateRepository(repository)) {
+ throw new RuntimeException(I18n.WorkspaceInvalidRepositoryMsg);
+ }
+
+ // OK to construct
+ this.name = name;
+ this.repository = repository;
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (this == obj) return true;
+ if ((obj == null) || (getClass() != obj.getClass())) return false;
+
+ // must have another server
+ Workspace otherWorkspace = (Workspace)obj;
+ return (this.name.equals(otherWorkspace.name) &&
this.repository.equals(otherWorkspace.repository));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getChildren()
+ * @since 0.6
+ */
+ @Override
+ public List<? extends IDnaObject> getChildren() {
+ // workspaces don't have children for 0.6 (this will change for future
versions)
+ return Collections.emptyList();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getName()
+ * @since 0.6
+ */
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getParent()
+ * @since 0.6
+ */
+ @Override
+ public IDnaObject getParent() {
+ // a workspace's parent is a repository
+ return this.repository;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.publish.domain.IDnaObject#getShortDescription()
+ * @since 0.6
+ */
+ @Override
+ public String getShortDescription() {
+ return NLS.bind(I18n.WorkspaceShortDescription, this.name,
this.repository.getShortDescription());
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/domain/Workspace.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/i18n.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/i18n.properties
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/i18n.properties 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,35 @@
+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
+
+RepositoryInvalidNameMsg = The value "{0}" is not a valid repository name
+RepositoryInvalidServerMsg = A repository server cannot be null
+RepositoryShortDescription = DNA Repository: Name: {0}, {1}
+
+ServerDialogEditTitle = Edit Server
+ServerDialogNewTitle = New Server
+ServerDialogPasswordLabel = Password:
+ServerDialogSavePasswordButton = Save password
+ServerDialogSavePasswordLabel = Saved secret data is stored on your computer in a file
that's difficult, but not impossible, for an intruder to read.
+ServerDialogUserLabel = User:
+ServerDialogUrlLabel = URL:
+
+ServerShortDescription = DNA Server: URL={0} User={1}
+ServerInvalidPasswordMsg = The value "{0}" is not a valid server authentication
password
+ServerInvalidUrlMsg = The value "{0}" is not a valid server URL
+ServerInvalidUserMsg = The value "{0}" is not a valid server authentication
user
+
+WorkspaceInvalidNameMsg = The value "{0}" is not a valid repository name
+WorkspaceInvalidRepositoryMsg = A workspace repository cannot be null
+WorkspaceShortDescription = DNA Repository Workspace: Name: {0}, {1}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/i18n.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/IUiConstants.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/IUiConstants.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/IUiConstants.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+public interface IUiConstants {
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/IUiConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/UiUtil.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/UiUtil.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/UiUtil.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,94 @@
+/*
+ * 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;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.dna.publish.Activator;
+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;
+
+/**
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class UiUtil {
+
+ //
===========================================================================================================================
+ // Constants
+ //
===========================================================================================================================
+
+ private static final String ICON_PATH = "icons/full/"; //$NON-NLS-1$
+
+ public static final String OBJ16 = ICON_PATH + "obj16/"; //$NON-NLS-1$
+
+ private static final String REPOSITORY_IMAGE_PATH = OBJ16 +
"repository.gif"; //$NON-NLS-1$
+
+ private static final String SERVER_IMAGE_PATH = OBJ16 + "server.gif";
//$NON-NLS-1$
+
+ private static final String WORKSPACE_IMAGE_PATH = OBJ16 + "workspace.gif";
//$NON-NLS-1$
+
+ //
===========================================================================================================================
+ // Class Methods
+ //
===========================================================================================================================
+
+ /**
+ * @param obj the object whose image is being requested
+ * @return the image or <code>null</code>
+ * @since 0.6
+ */
+ public static ImageDescriptor getImage( Object obj ) {
+ if (obj instanceof Workspace) {
+ return Activator.getImageDescriptor(WORKSPACE_IMAGE_PATH);
+ }
+
+ if (obj instanceof Repository) {
+ return Activator.getImageDescriptor(REPOSITORY_IMAGE_PATH);
+ }
+
+ if (obj instanceof Server) {
+ return Activator.getImageDescriptor(SERVER_IMAGE_PATH);
+ }
+
+ // should have an icon for every business object
+ assert (!(obj instanceof IDnaObject));
+
+ return null;
+ }
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ /**
+ * Don't allow public construction.
+ *
+ * @since 0.6
+ */
+ private UiUtil() {
+ // nothing to do
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/UiUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/DeleteServerDialog.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/DeleteServerDialog.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/DeleteServerDialog.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,121 @@
+/*
+ * 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.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.I18n;
+import org.jboss.dna.publish.domain.IDnaObject;
+import org.jboss.dna.publish.domain.Server;
+
+/**
+ * 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/src/org/jboss/dna/publish/ui/dialogs/DeleteServerDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/ServerDialog.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/ServerDialog.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/ServerDialog.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,192 @@
+/*
+ * 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.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.dna.publish.I18n;
+import org.jboss.dna.publish.domain.Server;
+
+/**
+ * The <code>EditServerDialog</code> class provides a UI for editing a {@link
org.jboss.dna.publish.domain.Server server}'s
+ * properties.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public class ServerDialog extends Dialog {
+
+ //
===========================================================================================================================
+ // Fields
+ //
===========================================================================================================================
+
+ private String pswd;
+
+ private String url;
+
+ private String user;
+
+ //
===========================================================================================================================
+ // Constructors
+ //
===========================================================================================================================
+
+ public ServerDialog( Shell parent ) {
+ super(parent);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ public ServerDialog( Shell parent,
+ Server server ) {
+ this(parent);
+
+ this.url = server.getUrl();
+ this.user = server.getUser();
+ this.pswd = server.getPassword();
+ }
+
+ //
===========================================================================================================================
+ // Methods
+ //
===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#close()
+ */
+ @Override
+ public boolean close() {
+ boolean closed = super.close();
+
+ // make sure if cancel was pressed that the call to get classpath jars does not
return anything
+ if (getReturnCode() != Window.OK) {
+ this.pswd = null;
+ this.url = null;
+ this.user = null;
+ }
+
+ return closed;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ * @since 0.6
+ */
+ @Override
+ protected void configureShell( Shell shell ) {
+ super.configureShell(shell);
+ shell.setText(this.url == null ? I18n.ServerDialogNewTitle :
I18n.ServerDialogEditTitle);
+ }
+
+ private void constructAuthenticationPanel( Composite parent ) {
+ Group pnl = new Group(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ pnl.setLayout(layout);
+
+ GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
+ pnl.setLayoutData(gd);
+
+ // user row
+ Label lbl = new Label(pnl, SWT.LEFT);
+ lbl.setText(I18n.ServerDialogUserLabel);
+
+ // password row
+ lbl = new Label(pnl, SWT.LEFT);
+ lbl.setText(I18n.ServerDialogPasswordLabel);
+
+ // save password row
+ Button btn = new Button(parent, SWT.CHECK | SWT.LEFT);
+ btn.setText(I18n.ServerDialogSavePasswordButton);
+
+ // save password message row
+ StyledText st = new StyledText(parent, SWT.READ_ONLY | SWT.MULTI | SWT.NO_FOCUS |
SWT.WRAP);
+ st.setText(I18n.ServerDialogSavePasswordLabel);
+
st.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ st.setCaret(null);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.grabExcessVerticalSpace = false;
+ gd.horizontalIndent = 4;
+ gd.verticalIndent = 8;
+ st.setLayoutData(gd);
+ }
+
+ private void constructUrlPanel( Composite parent ) {
+ // Composite pnl = new Composite(parent, SWT.NONE);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @since 0.6
+ */
+ @Override
+ protected Control createDialogArea( Composite parent ) {
+ Composite pnlMain = new Composite(parent, SWT.NONE);
+ constructUrlPanel(parent);
+ constructAuthenticationPanel(parent);
+
+ return pnlMain;
+ }
+
+ /**
+ * @return the server authentication password
+ * @since 0.6
+ */
+ public String getPassword() {
+ return this.pswd;
+ }
+
+ /**
+ * @return the server authentication user
+ * @since 0.6
+ */
+ public String getUser() {
+ return this.user;
+ }
+
+ /**
+ * @return the server URL
+ * @since 0.6
+ */
+ public String getUrl() {
+ return this.url;
+ }
+
+}
Property changes on:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/dialogs/ServerDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryContentProvider.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryContentProvider.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryContentProvider.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,181 @@
+/*
+ * 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.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.Activator;
+import org.jboss.dna.publish.domain.IDnaObject;
+
+/**
+ * The RepositoryContentProvider is a content and label provider for DNA repositories.
+ *
+ * @author Dan Florian
+ * @since 0.6
+ */
+public final class RepositoryContentProvider implements ITreeContentProvider,
ILabelProvider {
+
+ /**
+ * {@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 ) {
+ // TODO implement
+ return null;
+ }
+
+ /**
+ * {@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/src/org/jboss/dna/publish/ui/views/RepositoryContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryView.java
===================================================================
---
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryView.java
(rev 0)
+++
branches/eclipse/org.jboss.dna.publish/src/org/jboss/dna/publish/ui/views/RepositoryView.java 2009-05-29
21:20:49 UTC (rev 953)
@@ -0,0 +1,256 @@
+/*
+ * 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.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.I18n;
+import org.jboss.dna.publish.domain.IDnaObject;
+import org.jboss.dna.publish.domain.Server;
+
+/**
+ * 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/src/org/jboss/dna/publish/ui/views/RepositoryView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF