Author: elvisisking
Date: 2011-05-10 17:01:17 -0400 (Tue, 10 May 2011)
New Revision: 31197
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java
Log:
JBDS-1640 JBDevStudio 4.1(.x) tooling - ModeShape plugins must work with both SOA/EDS 5.1
and 5.2. Now detecting if versioning is supported and enabled by the ModeShape server. The
version checkbox is disabled if not supported. Checking in a ModeShape 2.5.0.Beta3 jar.
Will need 2.5.0 release jar in order to resolve this issue.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
===================================================================
(Binary files differ)
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-05-10
20:09:02 UTC (rev 31196)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-05-10
21:01:17 UTC (rev 31197)
@@ -119,7 +119,7 @@
publishPageServerToolTip = The server where the JCR repository is located
publishPageUnableToObtainWorkspaceAreas = Unable to obtain the workspace areas for
workspace "{0}"
publishPageVersionCheckBox = Version the published files
-publishPageVersionCheckBoxToolTip = The published files will be versioned on the
ModeShape server.
+publishPageVersionCheckBoxToolTip = The published files will be versioned on the
ModeShape server. Disabled when repository does not support, or has disabled, versioning.
publishPageUnpublishOkStatusMsg = Choose the location of the JCR repository where the
files will be unpublished, and then click "Finish".
publishPageUnpublishResourcesLabel = These files were selected and will be unpublished:
publishPageUnpublishTitle = Unpublish the selected files
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java 2011-05-10
20:09:02 UTC (rev 31196)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java 2011-05-10
21:01:17 UTC (rev 31197)
@@ -512,21 +512,29 @@
public Status publish( Workspace workspace,
String path,
File file,
- boolean version ) {
- CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
- CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
- CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+ boolean version) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
- Server server = workspace.getServer();
+ Server server = workspace.getServer();
- if (isRegistered(server)) {
- return this.delegate.publish(workspace, path, file, version);
- }
+ if (isRegistered(server)) {
+ if (version) {
+ return this.delegate.publish(workspace, path, file, true);
+ }
- // server must be registered in order to publish
- throw new
RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
- }
+ // If version is false it could mean that versioning is not supported by the
repository, or it is not enabled by the
+ // by the repository, or that the user does not want the file versioned. If repository
is running on an older server
+ // that did not have versioning, then the only publishing method available on the
server was the publish method without
+ // the version parameter.
+ return this.delegate.publish(workspace, path, file);
+ }
+ // server must be registered in order to publish
+ throw new
RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
+ }
+
/**
* @param listener the listener being unregistered and will no longer receive events
(never <code>null</code>)
* @return <code>true</code> if listener was removed
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java 2011-05-10
20:09:02 UTC (rev 31196)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java 2011-05-10
21:01:17 UTC (rev 31197)
@@ -67,1101 +67,1197 @@
import org.modeshape.web.jcr.rest.client.domain.Workspace;
/**
- * The <code>PublishPage</code> is a UI for publishing or unpublishing one or
more files to a repository.
+ * The <code>PublishPage</code> is a UI for publishing or unpublishing one
or
+ * more files to a repository.
*/
public final class PublishPage extends WizardPage implements IServerRegistryListener,
ModifyListener {
+
+ /**
+ * The default repository workspace area where files are published.
+ */
+ private static final String DEFAULT_WORKSPACE_AREA = "/files"; //$NON-NLS-1$
- /**
- * The default repository workspace area where files are published.
- */
- private static final String DEFAULT_WORKSPACE_AREA = "/files";
//$NON-NLS-1$
+ /**
+ * The key in the wizard <code>IDialogSettings</code> for the recurse flag.
+ */
+ private static final String RECURSE_KEY = "recurse"; //$NON-NLS-1$
- /**
- * The key in the wizard <code>IDialogSettings</code> for the recurse
flag.
- */
- private static final String RECURSE_KEY = "recurse"; //$NON-NLS-1$
+ /**
+ * The key in the wizard <code>IDialogSettings</code> for the workspace
area
+ * path segment.
+ */
+ private static final String WORKSPACE_AREA_KEY = "workspaceArea";
//$NON-NLS-1$
- /**
- * The key in the wizard <code>IDialogSettings</code> for the workspace
area path segment.
- */
- private static final String WORKSPACE_AREA_KEY = "workspaceArea";
//$NON-NLS-1$
+ /**
+ * Indicates if the file filter should be used.
+ */
+ private static boolean filterFiles = true;
- /**
- * Indicates if the file filter should be used.
- */
- private static boolean filterFiles = true;
+ /**
+ * @param container
+ * the project or folder whose files are being requested
+ * @param recurse
+ * the flag indicating if child containers should be traversed
+ * @param filter
+ * the file filter or <code>null</code> if not used
+ * @return the list of files contained in the specified container (never
+ * <code>null</code>)
+ * @throws CoreException
+ * if there is a problem finding the files
+ */
+ private static List<IFile> findFiles(IContainer container, boolean recurse,
PublishingFileFilter filter)
+ throws CoreException {
+ List<IFile> result = new ArrayList<IFile>();
- /**
- * @param container the project or folder whose files are being requested
- * @param recurse the flag indicating if child containers should be traversed
- * @param filter the file filter or <code>null</code> if not used
- * @return the list of files contained in the specified container (never
<code>null</code>)
- * @throws CoreException if there is a problem finding the files
- */
- private static List<IFile> findFiles( IContainer container,
- boolean recurse,
- PublishingFileFilter filter ) throws
CoreException {
- List<IFile> result = new ArrayList<IFile>();
+ if (((container instanceof IProject) && !((IProject) container).isOpen())
+ || ((filter != null) && !filter.accept(container))) {
+ return result;
+ }
- if (((container instanceof IProject) && !((IProject)container).isOpen())
|| ((filter != null) && !filter.accept(container))) {
- return result;
- }
+ // process container members
+ for (IResource member : container.members()) {
+ if (recurse && (member instanceof IContainer)) {
+ // don't select closed projects
+ if ((member instanceof IProject) && !((IProject) member).isOpen()) {
+ continue;
+ }
- // process container members
- for (IResource member : container.members()) {
- if (recurse && (member instanceof IContainer)) {
- // don't select closed projects
- if ((member instanceof IProject) && !((IProject)member).isOpen())
{
- continue;
- }
+ result.addAll(findFiles((IContainer) member, recurse, filter));
+ } else if ((member instanceof IFile) && ((IFile)
member).getLocation().toFile().exists()) {
+ if ((filter == null) || filter.accept(member)) {
+ result.add((IFile) member);
+ }
+ }
+ }
- result.addAll(findFiles((IContainer)member, recurse, filter));
- } else if ((member instanceof IFile) &&
((IFile)member).getLocation().toFile().exists()) {
- if ((filter == null) || filter.accept(member)) {
- result.add((IFile)member);
- }
- }
- }
+ return result;
+ }
- return result;
- }
+ /**
+ * Processes the specified list of files and for (1) each file found adds it
+ * to the result and (2) for each project or folder adds all contained
+ * files. For projects and folders processing will be recursive based on
+ * saved wizard settings.
+ *
+ * @param resources
+ * the resources being processed (never <code>null</code>)
+ * @param recurse
+ * the flag indicating if child containers should be traversed
+ * @param filter
+ * the file filter or <code>null</code> if not used
+ * @return the files being published or unpublished (never
<code>null</code>
+ * )
+ * @throws CoreException
+ * if there is a problem processing the resources
+ */
+ private static List<IFile> processResources(List<IResource> resources,
boolean recurse, PublishingFileFilter filter)
+ throws CoreException {
+ assert (resources != null);
+ List<IFile> result = new ArrayList<IFile>();
- /**
- * Processes the specified list of files and for (1) each file found adds it to the
result and (2) for each project or folder
- * adds all contained files. For projects and folders processing will be recursive
based on saved wizard settings.
- *
- * @param resources the resources being processed (never
<code>null</code>)
- * @param recurse the flag indicating if child containers should be traversed
- * @param filter the file filter or <code>null</code> if not used
- * @return the files being published or unpublished (never
<code>null</code>)
- * @throws CoreException if there is a problem processing the resources
- */
- private static List<IFile> processResources( List<IResource> resources,
- boolean recurse,
- PublishingFileFilter filter ) throws
CoreException {
- assert (resources != null);
- List<IFile> result = new ArrayList<IFile>();
+ // Project Map - the outer map. Its keys are IProjects and its values
+ // are a Parent Map
+ // Parent Map - the inner map. Its keys are IContainers (IProject,
+ // IFolder) and its values are a list of files
+ Map<IProject, Map<IContainer, List<IFile>>> projectMap = new
HashMap<IProject, Map<IContainer, List<IFile>>>();
- // Project Map - the outer map. Its keys are IProjects and its values are a
Parent Map
- // Parent Map - the inner map. Its keys are IContainers (IProject, IFolder) and
its values are a list of files
- Map<IProject, Map<IContainer, List<IFile>>> projectMap = new
HashMap<IProject, Map<IContainer, List<IFile>>>();
+ // Step 1: Process resources
+ // - For each file make sure there is a project entry and parent entry
+ // then add the file to the Parent Map.
+ // - For each folder make sure there is a project entry then add folder
+ // entry.
+ // - For each project make sure there is a project entry.
+ //
+ // Step 2: Process maps
+ // - In the Project Map, when the recurse flag is set, entries for
+ // projects that have a null value (parent map) will be
+ // traversed finding all child files and them to results.
+ // - In the internal parent map, when the recurse flag is set, entries
+ // for parents that have a null value (child
+ // collection) will be traversed finding all child files and add them to
+ // results.
+ //
+ // Step 3: Add files from Step 1 to results
- // Step 1: Process resources
- // - For each file make sure there is a project entry and parent entry then add
the file to the Parent Map.
- // - For each folder make sure there is a project entry then add folder entry.
- // - For each project make sure there is a project entry.
- //
- // Step 2: Process maps
- // - In the Project Map, when the recurse flag is set, entries for projects that
have a null value (parent map) will be
- // traversed finding all child files and them to results.
- // - In the internal parent map, when the recurse flag is set, entries for
parents that have a null value (child
- // collection) will be traversed finding all child files and add them to
results.
- //
- // Step 3: Add files from Step 1 to results
+ // Step 1 (see above for processing description)
+ for (IResource resource : resources) {
+ IFile file = null;
+ IProject project = null;
+ List<IFile> files = null;
+ Map<IContainer, List<IFile>> parentMap = null;
- // Step 1 (see above for processing description)
- for (IResource resource : resources) {
- IFile file = null;
- IProject project = null;
- List<IFile> files = null;
- Map<IContainer, List<IFile>> parentMap = null;
+ // see if resource is filtered
+ if ((filter != null) && !filter.accept(resource)) {
+ continue;
+ }
- // see if resource is filtered
- if ((filter != null) && !filter.accept(resource)) {
- continue;
- }
+ if (resource instanceof IFile) {
+ IContainer parent = null; // project or folder
+ file = (IFile) resource;
+ parent = file.getParent();
+ project = file.getProject();
- if (resource instanceof IFile) {
- IContainer parent = null; // project or folder
- file = (IFile)resource;
- parent = file.getParent();
- project = file.getProject();
+ // make sure there is a project entry
+ if (!projectMap.containsKey(project)) {
+ projectMap.put(project, null);
+ }
- // make sure there is a project entry
- if (!projectMap.containsKey(project)) {
- projectMap.put(project, null);
- }
+ parentMap = projectMap.get(project);
- parentMap = projectMap.get(project);
+ // make sure there is a parent entry
+ if (parentMap == null) {
+ parentMap = new HashMap<IContainer, List<IFile>>();
+ projectMap.put(project, parentMap);
+ }
- // make sure there is a parent entry
- if (parentMap == null) {
- parentMap = new HashMap<IContainer, List<IFile>>();
- projectMap.put(project, parentMap);
- }
+ files = parentMap.get(parent);
- files = parentMap.get(parent);
+ // make sure there is a files collection
+ if (files == null) {
+ files = new ArrayList<IFile>();
+ parentMap.put(parent, files);
+ }
- // make sure there is a files collection
- if (files == null) {
- files = new ArrayList<IFile>();
- parentMap.put(parent, files);
- }
+ // add file
+ files.add(file);
+ } else if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
+ project = folder.getProject();
- // add file
- files.add(file);
- } else if (resource instanceof IFolder) {
- IFolder folder = (IFolder)resource;
- project = folder.getProject();
+ // make sure there is a project entry
+ if (!projectMap.containsKey(project)) {
+ projectMap.put(project, null);
+ }
- // make sure there is a project entry
- if (!projectMap.containsKey(project)) {
- projectMap.put(project, null);
- }
+ parentMap = projectMap.get(project);
- parentMap = projectMap.get(project);
+ // make sure there is a folder entry
+ if (parentMap == null) {
+ parentMap = new HashMap<IContainer, List<IFile>>();
+ projectMap.put(project, parentMap);
+ }
- // make sure there is a folder entry
- if (parentMap == null) {
- parentMap = new HashMap<IContainer, List<IFile>>();
- projectMap.put(project, parentMap);
- }
+ // add folder only if not already there
+ if (!parentMap.containsKey(folder)) {
+ parentMap.put(folder, null);
+ }
+ } else if (resource instanceof IProject) {
+ project = (IProject) resource;
- // add folder only if not already there
- if (!parentMap.containsKey(folder)) {
- parentMap.put(folder, null);
- }
- } else if (resource instanceof IProject) {
- project = (IProject)resource;
+ // if map does not have entry create one
+ if (!projectMap.containsKey(project)) {
+ projectMap.put(project, null);
+ }
+ }
+ }
- // if map does not have entry create one
- if (!projectMap.containsKey(project)) {
- projectMap.put(project, null);
- }
- }
- }
+ // Step 2 (see above for processing description)
+ // Process projects that have nothing under them selected
+ for (IProject project : projectMap.keySet()) {
+ Map<IContainer, List<IFile>> parentMap = projectMap.get(project);
- // Step 2 (see above for processing description)
- // Process projects that have nothing under them selected
- for (IProject project : projectMap.keySet()) {
- Map<IContainer, List<IFile>> parentMap =
projectMap.get(project);
+ if (parentMap == null) {
+ result.addAll(findFiles(project, recurse, filter));
+ } else {
+ // process folders with no folder entries
+ for (IContainer folder : parentMap.keySet()) {
+ List<IFile> files = parentMap.get(folder);
- if (parentMap == null) {
- result.addAll(findFiles(project, recurse, filter));
- } else {
- // process folders with no folder entries
- for (IContainer folder : parentMap.keySet()) {
- List<IFile> files = parentMap.get(folder);
+ if (files == null) {
+ result.addAll(findFiles(folder, recurse, filter));
+ }
+ }
+ }
+ }
- if (files == null) {
- result.addAll(findFiles(folder, recurse, filter));
- }
- }
- }
- }
+ // Step 3 (see above for processing description)
+ for (IProject project : projectMap.keySet()) {
+ Map<IContainer, List<IFile>> parentMap = projectMap.get(project);
- // Step 3 (see above for processing description)
- for (IProject project : projectMap.keySet()) {
- Map<IContainer, List<IFile>> parentMap =
projectMap.get(project);
+ if (parentMap != null) {
+ for (Entry<IContainer, List<IFile>> entry : parentMap.entrySet()) {
+ if (entry.getValue() != null) {
+ result.addAll(entry.getValue());
+ }
+ }
+ }
+ }
- if (parentMap != null) {
- for (Entry<IContainer, List<IFile>> entry :
parentMap.entrySet()) {
- if (entry.getValue() != null) {
- result.addAll(entry.getValue());
- }
- }
- }
- }
+ return result;
+ }
- return result;
- }
+ /**
+ * The repository chooser control.
+ */
+ private Combo cbxRepository;
- /**
- * The repository chooser control.
- */
- private Combo cbxRepository;
+ /**
+ * The server chooser control.
+ */
+ private Combo cbxServer;
- /**
- * The server chooser control.
- */
- private Combo cbxServer;
+ /**
+ * The workspace chooser control.
+ */
+ private Combo cbxWorkspace;
- /**
- * The workspace chooser control.
- */
- private Combo cbxWorkspace;
+ /**
+ * The workspace area chooser control.
+ */
+ private Combo cbxWorkspaceAreas;
- /**
- * The workspace area chooser control.
- */
- private Combo cbxWorkspaceAreas;
+ /**
+ * The control indicating if the user wants to version resources (will be
<code>null</code> when unpublishing).
+ */
+ private Button chkVersioning;
- /**
- * The files being published or unpublished (never <code>null</code>).
- */
- private List<IFile> files;
+ /**
+ * The files being published or unpublished (never <code>null</code>).
+ */
+ private List<IFile> files;
- /**
- * The filter used to determine if a file should be included in publishing operations
(may be <code>null</code>).
- */
- private PublishingFileFilter filter;
+ /**
+ * The filter used to determine if a file should be included in publishing
+ * operations (may be <code>null</code>).
+ */
+ private PublishingFileFilter filter;
+
+ /**
+ * A hyperlink to the preference page (will be <code>null</code> when
unpublishing).
+ */
+ private Link linkPrefs;
- /**
- * The control containing all the files being published or unpublished.
- */
- private org.eclipse.swt.widgets.List lstResources;
+ /**
+ * The control containing all the files being published or unpublished.
+ */
+ private org.eclipse.swt.widgets.List lstResources;
- /**
- * Indicates if resources should be found recursively.
- */
- private boolean recurse = true;
+ /**
+ * Indicates if resources should be found recursively.
+ */
+ private boolean recurse = true;
- /**
- * A collection of repositories for the selected server (never
<code>null</code>).
- */
- private List<Repository> repositories;
+ /**
+ * A collection of repositories for the selected server (never
+ * <code>null</code>).
+ */
+ private List<Repository> repositories;
- /**
- * The repository where the workspace is located.
- */
- private Repository repository;
+ /**
+ * The repository where the workspace is located.
+ */
+ private Repository repository;
- /**
- * The collection of resources selected by the user to be published or unpublished.
- */
- private final List<IResource> resources;
+ /**
+ * <code>true</code> if the selected repository supports versioning
+ */
+ private boolean repositorySupportsVersioning;
- /**
- * The server where the repository is located.
- */
- private Server server;
+ /**
+ * The collection of resources selected by the user to be published or
+ * unpublished.
+ */
+ private final List<IResource> resources;
- /**
- * A collection of servers from the server registry (never
<code>null</code>).
- */
- private List<Server> servers;
+ /**
+ * The server where the repository is located.
+ */
+ private Server server;
- /**
- * The current validation status.
- */
- private Status status;
+ /**
+ * A collection of servers from the server registry (never
<code>null</code>
+ * ).
+ */
+ private List<Server> servers;
- /**
- * Indicates if publishing or unpublishing is being done.
- */
- private final Type type;
+ /**
+ * The current validation status.
+ */
+ private Status status;
- /**
- * Indicates if versioning of published resources should be done.
- */
- private boolean versioning = true;
+ /**
+ * Indicates if publishing or unpublishing is being done.
+ */
+ private final Type type;
- /**
- * The workspace where the resources are being published/unpublished (may be
<code>null</code>).
- */
- private Workspace workspace;
+ /**
+ * Indicates if versioning of published resources should be done.
+ */
+ private boolean versioning = true;
- /**
- * The path segment prepended to the resource project path.
- */
- private String workspaceArea;
+ /**
+ * The workspace where the resources are being published/unpublished (may be
+ * <code>null</code>).
+ */
+ private Workspace workspace;
- /**
- * A collection of workspaces for the selected server repository (never
<code>null</code>).
- */
- private List<Workspace> workspaces;
+ /**
+ * The path segment prepended to the resource project path.
+ */
+ private String workspaceArea;
- /**
- * @param type indicates if publishing or unpublishing is being done
- * @param resources the resources being published or unpublished (never
<code>null</code>)
- * @throws CoreException if there is a problem processing the input resources
- */
- public PublishPage( Type type,
- List<IResource> resources ) throws CoreException {
- super(PublishPage.class.getSimpleName());
- CheckArg.isNotNull(resources, "resources"); //$NON-NLS-1$
- setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text()
- :
RestClientI18n.publishPageUnpublishTitle.text());
- setPageComplete(false);
+ /**
+ * A collection of workspaces for the selected server repository (never
+ * <code>null</code>).
+ */
+ private List<Workspace> workspaces;
- this.type = type;
- this.resources = resources;
+ /**
+ * @param type
+ * indicates if publishing or unpublishing is being done
+ * @param resources
+ * the resources being published or unpublished (never
+ * <code>null</code>)
+ * @throws CoreException
+ * if there is a problem processing the input resources
+ */
+ public PublishPage(Type type, List<IResource> resources) throws CoreException {
+ super(PublishPage.class.getSimpleName());
+ CheckArg.isNotNull(resources, "resources"); //$NON-NLS-1$
+ setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text()
+ : RestClientI18n.publishPageUnpublishTitle.text());
+ setPageComplete(false);
+ this.type = type;
+ this.resources = resources;
+
// load filter with current preference value
IgnoredResourcesModel model = new IgnoredResourcesModel();
model.load(Activator.getDefault().getPreferenceStore().getString(IGNORED_RESOURCES_PREFERENCE));
this.filter = (filterFiles ? new PublishingFileFilter(model) : null);
- }
+ }
- private void constructLocationPanel( Composite parent ) {
- Group pnl = new Group(parent, SWT.NONE);
- pnl.setText(RestClientI18n.publishPageLocationGroupTitle.text());
- pnl.setLayout(new GridLayout(2, false));
- pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ private void constructLocationPanel(Composite parent) {
+ Group pnl = new Group(parent, SWT.NONE);
+ pnl.setText(RestClientI18n.publishPageLocationGroupTitle.text());
+ pnl.setLayout(new GridLayout(2, false));
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- // row 1: label combobox button
- // row 2: label combobox
- // row 3: label combobox
- // row 4: label textbox
+ // row 1: label combobox button
+ // row 2: label combobox
+ // row 3: label combobox
+ // row 4: label textbox
- { // row 1: server row
- Composite pnlServer = new Composite(pnl, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- pnlServer.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
- gd.horizontalSpan = 2;
- pnlServer.setLayoutData(gd);
+ { // row 1: server row
+ Composite pnlServer = new Composite(pnl, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ pnlServer.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gd.horizontalSpan = 2;
+ pnlServer.setLayoutData(gd);
- Label lblServer = new Label(pnlServer, SWT.LEFT);
- lblServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblServer.setText(RestClientI18n.publishPageServerLabel.text());
+ Label lblServer = new Label(pnlServer, SWT.LEFT);
+ lblServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblServer.setText(RestClientI18n.publishPageServerLabel.text());
- this.cbxServer = new Combo(pnlServer, SWT.DROP_DOWN | SWT.READ_ONLY);
- this.cbxServer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
this.cbxServer.setToolTipText(RestClientI18n.publishPageServerToolTip.text());
+ this.cbxServer = new Combo(pnlServer, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxServer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxServer.setToolTipText(RestClientI18n.publishPageServerToolTip.text());
- final IAction action = new NewServerAction(this.getShell(),
getServerManager());
- final Button btnNewServer = new Button(pnlServer, SWT.PUSH);
- btnNewServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
- btnNewServer.setText(RestClientI18n.publishPageNewServerButton.text());
- btnNewServer.setToolTipText(action.getToolTipText());
- btnNewServer.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- action.run();
- }
- });
+ final IAction action = new NewServerAction(this.getShell(), getServerManager());
+ final Button btnNewServer = new Button(pnlServer, SWT.PUSH);
+ btnNewServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ btnNewServer.setText(RestClientI18n.publishPageNewServerButton.text());
+ btnNewServer.setToolTipText(action.getToolTipText());
+ btnNewServer.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ action.run();
+ }
+ });
- // update page message first time selected to get rid of initial message by
forcing validation
- btnNewServer.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- updateInitialMessage();
- btnNewServer.removeSelectionListener(this);
- }
- });
- }
+ // update page message first time selected to get rid of initial
+ // message by forcing validation
+ btnNewServer.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateInitialMessage();
+ btnNewServer.removeSelectionListener(this);
+ }
+ });
+ }
- { // row 2: repository row
- Label lblRepository = new Label(pnl, SWT.LEFT);
- lblRepository.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
- lblRepository.setText(RestClientI18n.publishPageRepositoryLabel.text());
+ { // row 2: repository row
+ Label lblRepository = new Label(pnl, SWT.LEFT);
+ lblRepository.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblRepository.setText(RestClientI18n.publishPageRepositoryLabel.text());
- this.cbxRepository = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
- this.cbxRepository.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
false));
-
this.cbxRepository.setToolTipText(RestClientI18n.publishPageRepositoryToolTip.text());
- }
+ this.cbxRepository = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxRepository.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxRepository.setToolTipText(RestClientI18n.publishPageRepositoryToolTip.text());
+ }
- { // row 3: workspace row
- Label lblWorkspace = new Label(pnl, SWT.LEFT);
- lblWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
- lblWorkspace.setText(RestClientI18n.publishPageWorkspaceLabel.text());
+ { // row 3: workspace row
+ Label lblWorkspace = new Label(pnl, SWT.LEFT);
+ lblWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblWorkspace.setText(RestClientI18n.publishPageWorkspaceLabel.text());
- this.cbxWorkspace = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
- this.cbxWorkspace.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
false));
+ this.cbxWorkspace = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.cbxWorkspace.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- if (type == Type.PUBLISH) {
-
this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspacePublishToolTip.text());
- } else {
-
this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspaceUnpublishToolTip.text());
- }
- }
+ if (type == Type.PUBLISH) {
+ this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspacePublishToolTip.text());
+ } else {
+ this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspaceUnpublishToolTip.text());
+ }
+ }
- { // row 4: workspace area
- Label lblWorkspaceArea = new Label(pnl, SWT.LEFT);
- lblWorkspaceArea.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
-
lblWorkspaceArea.setText(RestClientI18n.publishPageWorkspaceAreaLabel.text());
+ { // row 4: workspace area
+ Label lblWorkspaceArea = new Label(pnl, SWT.LEFT);
+ lblWorkspaceArea.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lblWorkspaceArea.setText(RestClientI18n.publishPageWorkspaceAreaLabel.text());
- this.cbxWorkspaceAreas = new Combo(pnl, SWT.DROP_DOWN);
- this.cbxWorkspaceAreas.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
false));
-
this.cbxWorkspaceAreas.setToolTipText(RestClientI18n.publishPageWorkspaceAreaToolTip.text());
- }
- }
+ this.cbxWorkspaceAreas = new Combo(pnl, SWT.DROP_DOWN);
+ this.cbxWorkspaceAreas.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ this.cbxWorkspaceAreas.setToolTipText(RestClientI18n.publishPageWorkspaceAreaToolTip.text());
+ }
+ }
- private void constructResourcesPanel( Composite parent ) {
- Composite pnl = new Composite(parent, SWT.NONE);
- pnl.setLayout(new GridLayout());
- pnl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ private void constructResourcesPanel(Composite parent) {
+ Composite pnl = new Composite(parent, SWT.NONE);
+ pnl.setLayout(new GridLayout());
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- // pnl layout:
- // row 1: lbl
- // row 2: lstResources
- // row 3: recurse chkbox
- // row 4: versioning chkbox and link (only when publishing)
+ // pnl layout:
+ // row 1: lbl
+ // row 2: lstResources
+ // row 3: recurse chkbox
+ // row 4: versioning chkbox and link (only when publishing)
- { // row 1
- Label lbl = new Label(pnl, SWT.LEFT);
- lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ { // row 1
+ Label lbl = new Label(pnl, SWT.LEFT);
+ lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- if (type == Type.PUBLISH) {
- lbl.setText(RestClientI18n.publishPagePublishResourcesLabel.text());
- } else {
- lbl.setText(RestClientI18n.publishPageUnpublishResourcesLabel.text());
- }
- }
+ if (type == Type.PUBLISH) {
+ lbl.setText(RestClientI18n.publishPagePublishResourcesLabel.text());
+ } else {
+ lbl.setText(RestClientI18n.publishPageUnpublishResourcesLabel.text());
+ }
+ }
- { // row 2
- this.lstResources = new org.eclipse.swt.widgets.List(pnl, SWT.BORDER |
SWT.H_SCROLL
- | SWT.V_SCROLL);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 2;
- gd.minimumHeight = this.lstResources.getItemHeight() * 2; // set min height
- gd.heightHint = this.lstResources.getItemHeight() * 10; // set preferred
height
- this.lstResources.setLayoutData(gd);
- final org.eclipse.swt.widgets.List finalLst = this.lstResources;
+ { // row 2
+ this.lstResources = new org.eclipse.swt.widgets.List(pnl, SWT.BORDER | SWT.H_SCROLL |
SWT.V_SCROLL);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.horizontalSpan = 2;
+ gd.minimumHeight = this.lstResources.getItemHeight() * 2; // set min
+ // height
+ gd.heightHint = this.lstResources.getItemHeight() * 10; // set
+ // preferred
+ // height
+ this.lstResources.setLayoutData(gd);
+ final org.eclipse.swt.widgets.List finalLst = this.lstResources;
- // update page message first time selected to get rid of initial message by
forcing validation
- this.lstResources.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- // do the very first time to get rid of initial message then remove
listener
- updateInitialMessage();
- finalLst.removeSelectionListener(this);
- }
- });
+ // update page message first time selected to get rid of initial
+ // message by forcing validation
+ this.lstResources.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // do the very first time to get rid of initial message then
+ // remove listener
+ updateInitialMessage();
+ finalLst.removeSelectionListener(this);
+ }
+ });
- // load list with initial files
- loadFiles();
- }
+ // load list with initial files
+ loadFiles();
+ }
- { // row 3 recurse chkbox
- Button chkRecurse = new Button(pnl, SWT.CHECK);
- chkRecurse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- chkRecurse.setText(RestClientI18n.publishPageRecurseCheckBox.text());
-
chkRecurse.setToolTipText(RestClientI18n.publishPageRecurseCheckBoxToolTip.text());
+ { // row 3 recurse chkbox
+ Button chkRecurse = new Button(pnl, SWT.CHECK);
+ chkRecurse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ chkRecurse.setText(RestClientI18n.publishPageRecurseCheckBox.text());
+ chkRecurse.setToolTipText(RestClientI18n.publishPageRecurseCheckBoxToolTip.text());
- // set the recurse flag based on dialog settings
- if (getDialogSettings().get(RECURSE_KEY) != null) {
- this.recurse = getDialogSettings().getBoolean(RECURSE_KEY);
- }
+ // set the recurse flag based on dialog settings
+ if (getDialogSettings().get(RECURSE_KEY) != null) {
+ this.recurse = getDialogSettings().getBoolean(RECURSE_KEY);
+ }
- chkRecurse.setSelection(this.recurse);
- chkRecurse.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- handleRecurseChanged(((Button)e.widget).getSelection());
- }
- });
+ chkRecurse.setSelection(this.recurse);
+ chkRecurse.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleRecurseChanged(((Button) e.widget).getSelection());
+ }
+ });
- // update page message first time selected to get rid of initial message by
forcing validation
- chkRecurse.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- updateInitialMessage();
- ((Button)e.widget).removeSelectionListener(this);
- }
- });
- }
+ // update page message first time selected to get rid of initial
+ // message by forcing validation
+ chkRecurse.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateInitialMessage();
+ ((Button) e.widget).removeSelectionListener(this);
+ }
+ });
+ }
- if (this.type == Type.PUBLISH) {
- // row 4 versioning chkbox and link to open preference page
- Composite pnlVersioning = new Composite(pnl, SWT.NONE);
- pnlVersioning.setLayout(new GridLayout(2, false));
- ((GridLayout)pnlVersioning.getLayout()).marginWidth = 0;
- pnlVersioning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
- ((GridData)pnlVersioning.getLayoutData()).minimumHeight = 30;
+ if (this.type == Type.PUBLISH) {
+ // row 4 versioning chkbox and link to open preference page
+ Composite pnlVersioning = new Composite(pnl, SWT.NONE);
+ pnlVersioning.setLayout(new GridLayout(2, false));
+ ((GridLayout) pnlVersioning.getLayout()).marginWidth = 0;
+ pnlVersioning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
+ ((GridData) pnlVersioning.getLayoutData()).minimumHeight = 30;
- Button chkVersioning = new Button(pnlVersioning, SWT.CHECK);
- chkVersioning.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
false));
- chkVersioning.setText(RestClientI18n.publishPageVersionCheckBox.text());
-
chkVersioning.setToolTipText(RestClientI18n.publishPageVersionCheckBoxToolTip.text());
+ this.chkVersioning = new Button(pnlVersioning, SWT.CHECK);
+ this.chkVersioning.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ this.chkVersioning.setText(RestClientI18n.publishPageVersionCheckBox.text());
+ this.chkVersioning.setToolTipText(RestClientI18n.publishPageVersionCheckBoxToolTip.text());
- // set the version flag based on preference
- this.versioning =
Activator.getDefault().getPreferenceStore().getBoolean(ENABLE_RESOURCE_VERSIONING);
+ // set the version flag based on preference
+ this.versioning =
Activator.getDefault().getPreferenceStore().getBoolean(ENABLE_RESOURCE_VERSIONING);
- chkVersioning.setSelection(this.versioning);
- chkVersioning.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- handleVersioningChanged(((Button)e.widget).getSelection());
- }
- });
+ this.chkVersioning.setSelection(this.versioning);
+ this.chkVersioning.setEnabled(false);
+ this.chkVersioning.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleVersioningChanged(((Button) e.widget).getSelection());
+ }
+ });
- Link link = new Link(pnlVersioning, SWT.WRAP);
- link.setText(RestClientI18n.publishPageOpenPreferencePageLink.text());
- link.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- link.addSelectionListener(new SelectionAdapter() {
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- handleOpenPreferencePage();
- }
- });
- }
- }
+ this.linkPrefs = new Link(pnlVersioning, SWT.WRAP);
+ this.linkPrefs.setText(RestClientI18n.publishPageOpenPreferencePageLink.text());
+ this.linkPrefs.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ this.linkPrefs.setEnabled(false);
+ this.linkPrefs.addSelectionListener(new SelectionAdapter() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleOpenPreferencePage();
+ }
+ });
+ }
+ }
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl( Composite parent ) {
- Composite pnlMain = new Composite(parent, SWT.NONE);
- pnlMain.setLayout(new GridLayout());
- pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- constructLocationPanel(pnlMain);
- constructResourcesPanel(pnlMain);
- setControl(pnlMain);
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite pnlMain = new Composite(parent, SWT.NONE);
+ pnlMain.setLayout(new GridLayout());
+ pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ constructLocationPanel(pnlMain);
+ constructResourcesPanel(pnlMain);
+ setControl(pnlMain);
- // add combobox listeners
- this.cbxRepository.addModifyListener(this);
- this.cbxServer.addModifyListener(this);
- this.cbxWorkspace.addModifyListener(this);
- this.cbxWorkspaceAreas.addModifyListener(this);
+ // add combobox listeners
+ this.cbxRepository.addModifyListener(this);
+ this.cbxServer.addModifyListener(this);
+ this.cbxWorkspace.addModifyListener(this);
+ this.cbxWorkspaceAreas.addModifyListener(this);
- // register with the help system
- IWorkbenchHelpSystem helpSystem =
Activator.getDefault().getWorkbench().getHelpSystem();
- helpSystem.setHelp(pnlMain, PUBLISH_DIALOG_HELP_CONTEXT);
+ // register with the help system
+ IWorkbenchHelpSystem helpSystem =
Activator.getDefault().getWorkbench().getHelpSystem();
+ helpSystem.setHelp(pnlMain, PUBLISH_DIALOG_HELP_CONTEXT);
- // register to receive server registry events (this will populate the UI)
- getServerManager().addRegistryListener(this);
- }
+ // register to receive server registry events (this will populate the
+ // UI)
+ getServerManager().addRegistryListener(this);
+ }
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- */
- @Override
- public void dispose() {
- getServerManager().removeRegistryListener(this);
- super.dispose();
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ getServerManager().removeRegistryListener(this);
+ super.dispose();
+ }
- /**
- * @return the files to publish or unpublish (never <code>null</code>)
- */
- List<IFile> getFiles() {
- return this.files;
- }
+ /**
+ * @return the files to publish or unpublish (never <code>null</code>)
+ */
+ List<IFile> getFiles() {
+ return this.files;
+ }
- /**
- * @return the server manager obtained from the wizard
- */
- private ServerManager getServerManager() {
- return ((PublishWizard)getWizard()).getServerManager();
- }
+ /**
+ * @return the server manager obtained from the wizard
+ */
+ private ServerManager getServerManager() {
+ return ((PublishWizard) getWizard()).getServerManager();
+ }
- /**
- * @return thw workspace to use when publishing or unpublishing (page must be
complete)
- */
- Workspace getWorkspace() {
- assert isPageComplete();
- return this.workspace;
- }
+ /**
+ * @return thw workspace to use when publishing or unpublishing (page must
+ * be complete)
+ */
+ Workspace getWorkspace() {
+ assert isPageComplete();
+ return this.workspace;
+ }
- /**
- * @return the path segment prepended to the resource project path (never
<code>null</code> but can be empty)
- */
- String getWorkspaceArea() {
- return this.workspaceArea;
- }
+ /**
+ * @return the path segment prepended to the resource project path (never
+ * <code>null</code> but can be empty)
+ */
+ String getWorkspaceArea() {
+ return this.workspaceArea;
+ }
- /**
- * Opens the preference page.
- */
- void handleOpenPreferencePage() {
- // open preference page and only allow the pref page where the version setting
is
- PreferencesUtil.createPreferenceDialogOn(getShell(),
- MAIN_PREFERENCE_PAGE_ID,
- new String[] { MAIN_PREFERENCE_PAGE_ID
},
- null).open();
- }
+ /**
+ * Opens the preference page.
+ */
+ void handleOpenPreferencePage() {
+ // open preference page and only allow the pref page where the version
+ // setting is
+ PreferencesUtil.createPreferenceDialogOn(getShell(), MAIN_PREFERENCE_PAGE_ID,
+ new String[] { MAIN_PREFERENCE_PAGE_ID }, null).open();
+ }
- /**
- * Saves the recurse setting and reloads the files to be published or unpublished.
- *
- * @param selected the flag indicating the new recurse setting
- */
- void handleRecurseChanged( boolean selected ) {
- this.recurse = selected;
+ /**
+ * Saves the recurse setting and reloads the files to be published or
+ * unpublished.
+ *
+ * @param selected
+ * the flag indicating the new recurse setting
+ */
+ void handleRecurseChanged(boolean selected) {
+ this.recurse = selected;
- try {
- this.files = processResources(this.resources, isRecursing(), filter);
- loadFiles();
- } catch (CoreException e) {
- Activator.getDefault().log(new Status(Severity.ERROR,
RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
+ try {
+ this.files = processResources(this.resources, isRecursing(), filter);
+ loadFiles();
+ } catch (CoreException e) {
+ Activator.getDefault().log(
+ new Status(Severity.ERROR,
RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
- if (getControl().isVisible()) {
- MessageDialog.openError(getShell(),
- RestClientI18n.errorDialogTitle.text(),
-
RestClientI18n.publishPageRecurseProcessingErrorMsg.text());
- }
- }
- }
+ if (getControl().isVisible()) {
+ MessageDialog.openError(getShell(), RestClientI18n.errorDialogTitle.text(),
+ RestClientI18n.publishPageRecurseProcessingErrorMsg.text());
+ }
+ }
+ }
- /**
- * Handler for when the repository control value is modified
- */
- void handleRepositoryModified() {
- int index = this.cbxRepository.getSelectionIndex();
+ /**
+ * Handler for when the repository control value is modified
+ */
+ void handleRepositoryModified() {
+ int index = this.cbxRepository.getSelectionIndex();
- // make sure there is a selection
- if (index != -1) {
- this.repository = this.repositories.get(index);
- }
+ // make sure there is a selection
+ if (index != -1) {
+ this.repository = this.repositories.get(index);
+ }
- // clear loaded workspaces
- refreshWorkspaces();
+ // repository capabilities could affect the UI
+ updateRepositoryCapabilities();
- // update page state
- updateState();
- }
+ // clear loaded workspaces
+ refreshWorkspaces();
- /**
- * Handler for when the server control value is modified
- */
- void handleServerModified() {
- int index = this.cbxServer.getSelectionIndex();
+ // update page state
+ updateState();
+ }
- // make sure there is a selection
- if (index != -1) {
- this.server = this.servers.get(index);
- }
+ /**
+ * Handler for when the server control value is modified
+ */
+ void handleServerModified() {
+ int index = this.cbxServer.getSelectionIndex();
- // need to reload repositories since server changed
- refreshRepositories();
+ // make sure there is a selection
+ if (index != -1) {
+ this.server = this.servers.get(index);
+ }
- // update page state
- updateState();
- }
+ // need to reload repositories since server changed
+ refreshRepositories();
- /**
- * Saves the versioning setting.
- *
- * @param selected the flag indicating the new versioning setting
- */
- void handleVersioningChanged( boolean selected ) {
- this.versioning = selected;
- }
+ // update page state
+ updateState();
+ }
- /**
- * Handler for when the workspace area value is modified.
- */
- void handleWorkspaceAreaModified() {
- int index = this.cbxWorkspaceAreas.getSelectionIndex();
+ /**
+ * Saves the versioning setting.
+ *
+ * @param selected
+ * the flag indicating the new versioning setting
+ */
+ void handleVersioningChanged(boolean selected) {
+ this.versioning = selected;
+ }
- if (index == -1) {
- this.workspaceArea = this.cbxWorkspaceAreas.getText();
- } else {
- this.workspaceArea = this.cbxWorkspaceAreas.getItems()[index];
- }
- }
+ /**
+ * Handler for when the workspace area value is modified.
+ */
+ void handleWorkspaceAreaModified() {
+ int index = this.cbxWorkspaceAreas.getSelectionIndex();
- /**
- * Handler for when the workspace control value is modified.
- */
- void handleWorkspaceModified() {
- int index = this.cbxWorkspace.getSelectionIndex();
+ if (index == -1) {
+ this.workspaceArea = this.cbxWorkspaceAreas.getText();
+ } else {
+ this.workspaceArea = this.cbxWorkspaceAreas.getItems()[index];
+ }
+ }
- // make sure there is a selection
- if (index != -1) {
- Workspace newWorkspace = this.workspaces.get(index);
+ /**
+ * Handler for when the workspace control value is modified.
+ */
+ void handleWorkspaceModified() {
+ int index = this.cbxWorkspace.getSelectionIndex();
- if ((this.workspace == null) || !this.workspace.equals(newWorkspace)) {
- this.workspace = newWorkspace;
+ // make sure there is a selection
+ if (index != -1) {
+ Workspace newWorkspace = this.workspaces.get(index);
- // update workspace areas
- WorkspaceArea[] workspaceAreas = null;
+ if ((this.workspace == null) || !this.workspace.equals(newWorkspace)) {
+ this.workspace = newWorkspace;
- try {
- workspaceAreas =
getServerManager().getWorkspaceAreas(this.workspace);
- } catch (Exception e) {
- Activator.getDefault()
- .log(new Status(Severity.ERROR,
-
RestClientI18n.publishPageUnableToObtainWorkspaceAreas.text(this.workspace),
- e));
- }
+ // update workspace areas
+ WorkspaceArea[] workspaceAreas = null;
- if ((workspaceAreas == null) || (workspaceAreas.length == 0)) {
- // populate with default area name
- this.cbxWorkspaceAreas.setItems(new String[] { DEFAULT_WORKSPACE_AREA
});
- } else {
- String[] areaPaths = new String[workspaceAreas.length];
- int i = 0;
+ try {
+ workspaceAreas = getServerManager().getWorkspaceAreas(this.workspace);
+ } catch (Exception e) {
+ Activator.getDefault().log(
+ new Status(Severity.ERROR,
RestClientI18n.publishPageUnableToObtainWorkspaceAreas
+ .text(this.workspace), e));
+ }
- for (WorkspaceArea area : workspaceAreas) {
- areaPaths[i++] = area.getPath();
- }
+ if ((workspaceAreas == null) || (workspaceAreas.length == 0)) {
+ // populate with default area name
+ this.cbxWorkspaceAreas.setItems(new String[] { DEFAULT_WORKSPACE_AREA });
+ } else {
+ String[] areaPaths = new String[workspaceAreas.length];
+ int i = 0;
- this.cbxWorkspaceAreas.setItems(areaPaths);
- }
- }
- } else {
- this.workspaceArea = null;
- this.cbxWorkspaceAreas.removeAll();
- }
+ for (WorkspaceArea area : workspaceAreas) {
+ areaPaths[i++] = area.getPath();
+ }
- if (this.cbxWorkspaceAreas.getItemCount() != 0) {
- this.cbxWorkspaceAreas.select(0);
- }
+ this.cbxWorkspaceAreas.setItems(areaPaths);
+ }
+ }
+ } else {
+ this.workspaceArea = null;
+ this.cbxWorkspaceAreas.removeAll();
+ }
- updateState();
- }
+ if (this.cbxWorkspaceAreas.getItemCount() != 0) {
+ this.cbxWorkspaceAreas.select(0);
+ }
- /**
- * @return <code>true</code> if resources found recursively under
projects and folders should also be published or unpublished
- */
- boolean isRecursing() {
- return this.recurse;
- }
+ updateState();
+ }
- /**
- * @return <code>true</code> if versioning of published resources should
be done
- */
- boolean isVersioning() {
- return this.versioning;
- }
+ /**
+ * @return <code>true</code> if resources found recursively under projects
+ * and folders should also be published or unpublished
+ */
+ boolean isRecursing() {
+ return this.recurse;
+ }
- /**
- * Populates the list of files to be published based on the recurse flag and the list
of workspace selected resources.
- * Pre-condition is that {@link #processResources(List, boolean,
PublishingFileFilter)} has been called.
- */
- private void loadFiles() {
- this.lstResources.removeAll();
+ /**
+ * @return <code>true</code> if versioning of published resources should be
+ * done
+ */
+ boolean isVersioning() {
+ return (this.repositorySupportsVersioning && this.versioning);
+ }
- for (IResource resource : this.files) {
- this.lstResources.add(resource.getFullPath().toString());
- }
- }
+ /**
+ * Populates the list of files to be published based on the recurse flag and
+ * the list of workspace selected resources. Pre-condition is that
+ * {@link #processResources(List, boolean, PublishingFileFilter)} has been
+ * called.
+ */
+ private void loadFiles() {
+ this.lstResources.removeAll();
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText( ModifyEvent e ) {
- if (e.widget == this.cbxServer) {
- handleServerModified();
- } else if (e.widget == this.cbxRepository) {
- handleRepositoryModified();
- } else if (e.widget == this.cbxWorkspace) {
- handleWorkspaceModified();
- } else if (e.widget == this.cbxWorkspaceAreas) {
- handleWorkspaceAreaModified();
- } else {
- assert false; // should not happen
- }
- }
+ for (IResource resource : this.files) {
+ this.lstResources.add(resource.getFullPath().toString());
+ }
+ }
- /**
- * Refreshes the repository-related fields and controls based on the server registry.
This in turn causes the workspaces to also
- * to be refreshed.
- */
- private void refreshRepositories() {
- this.repository = null;
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (e.widget == this.cbxServer) {
+ handleServerModified();
+ } else if (e.widget == this.cbxRepository) {
+ handleRepositoryModified();
+ } else if (e.widget == this.cbxWorkspace) {
+ handleWorkspaceModified();
+ } else if (e.widget == this.cbxWorkspaceAreas) {
+ handleWorkspaceAreaModified();
+ } else {
+ assert false; // should not happen
+ }
+ }
- if (this.server == null) {
- this.repositories = Collections.emptyList();
- } else {
- try {
- this.repositories = new
ArrayList<Repository>(getServerManager().getRepositories(this.server));
- } catch (Exception e) {
- this.repositories = Collections.emptyList();
- String msg =
RestClientI18n.serverManagerGetRepositoriesExceptionMsg.text(this.server.getShortDescription());
- Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
- }
- }
+ /**
+ * Refreshes the repository-related fields and controls based on the server
+ * registry. This in turn causes the workspaces to also to be refreshed.
+ */
+ private void refreshRepositories() {
+ this.repository = null;
- // clear items
- this.cbxRepository.removeAll();
+ if (this.server == null) {
+ this.repositories = Collections.emptyList();
+ } else {
+ try {
+ this.repositories = new
ArrayList<Repository>(getServerManager().getRepositories(this.server));
+ } catch (Exception e) {
+ this.repositories = Collections.emptyList();
+ String msg =
RestClientI18n.serverManagerGetRepositoriesExceptionMsg.text(this.server
+ .getShortDescription());
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+ }
+ }
- // reload
- if (this.repositories.isEmpty()) {
- // disable control if necessary
- if (this.cbxRepository.getEnabled()) {
- this.cbxRepository.setEnabled(false);
- }
- } else if (this.repositories.size() == 1) {
- this.repository = this.repositories.get(0);
- this.cbxRepository.add(this.repository.getName());
- this.cbxRepository.select(0);
+ // clear items
+ this.cbxRepository.removeAll();
- // enable control if necessary
- if (!this.cbxRepository.getEnabled()) {
- this.cbxRepository.setEnabled(true);
- }
- } else {
- // add an item for each repository
- for (Repository repository : this.repositories) {
- this.cbxRepository.add(repository.getName());
- }
+ // reload
+ if (this.repositories.isEmpty()) {
+ // disable control if necessary
+ if (this.cbxRepository.getEnabled()) {
+ this.cbxRepository.setEnabled(false);
+ }
+ } else if (this.repositories.size() == 1) {
+ this.repository = this.repositories.get(0);
+ this.cbxRepository.add(this.repository.getName());
+ this.cbxRepository.select(0);
- // enable control if necessary
- if (!this.cbxRepository.getEnabled()) {
- this.cbxRepository.setEnabled(true);
- }
- }
+ // enable control if necessary
+ if (!this.cbxRepository.getEnabled()) {
+ this.cbxRepository.setEnabled(true);
+ }
+ } else {
+ // add an item for each repository
+ for (Repository repository : this.repositories) {
+ this.cbxRepository.add(repository.getName());
+ }
- // must reload workspaces
- refreshWorkspaces();
- }
+ // enable control if necessary
+ if (!this.cbxRepository.getEnabled()) {
+ this.cbxRepository.setEnabled(true);
+ }
+ }
+
+ // repository capabilities could affect the UI
+ updateRepositoryCapabilities();
- /**
- * Refreshes the server-related fields and controls based on the server registry.
This in turn causes the repositories and
- * workspaces to also to be refreshed.
- */
- void refreshServers() {
- this.server = null;
- this.servers = new ArrayList<Server>(getServerManager().getServers());
+ // must reload workspaces
+ refreshWorkspaces();
+ }
- // clear server combo
- this.cbxServer.removeAll();
+ /**
+ * Refreshes the server-related fields and controls based on the server
+ * registry. This in turn causes the repositories and workspaces to also to
+ * be refreshed.
+ */
+ void refreshServers() {
+ this.server = null;
+ this.servers = new ArrayList<Server>(getServerManager().getServers());
- if (this.servers.size() == 0) {
- // disable control if necessary
- if (this.cbxServer.getEnabled()) {
- this.cbxServer.setEnabled(false);
- }
- } else if (this.servers.size() == 1) {
- this.server = this.servers.get(0);
- this.cbxServer.add(this.server.getName());
- this.cbxServer.select(0);
+ // clear server combo
+ this.cbxServer.removeAll();
- // enable control if necessary
- if (!this.cbxServer.getEnabled()) {
- this.cbxServer.setEnabled(true);
- }
- } else {
- // add an item for each server
- for (Server server : this.servers) {
- this.cbxServer.add(server.getName());
- }
+ if (this.servers.size() == 0) {
+ // disable control if necessary
+ if (this.cbxServer.getEnabled()) {
+ this.cbxServer.setEnabled(false);
+ }
+ } else if (this.servers.size() == 1) {
+ this.server = this.servers.get(0);
+ this.cbxServer.add(this.server.getName());
+ this.cbxServer.select(0);
- // enable control if necessary
- if (!this.cbxServer.getEnabled()) {
- this.cbxServer.setEnabled(true);
- }
- }
+ // enable control if necessary
+ if (!this.cbxServer.getEnabled()) {
+ this.cbxServer.setEnabled(true);
+ }
+ } else {
+ // add an item for each server
+ for (Server server : this.servers) {
+ this.cbxServer.add(server.getName());
+ }
- // must reload repositories
- refreshRepositories();
- }
+ // enable control if necessary
+ if (!this.cbxServer.getEnabled()) {
+ this.cbxServer.setEnabled(true);
+ }
+ }
- /**
- * Refreshes the workspace-related fields and controls based on the server registry.
- */
- private void refreshWorkspaces() {
- this.workspace = null;
+ // must reload repositories
+ refreshRepositories();
+ }
- if (this.repository == null) {
- this.workspaces = Collections.emptyList();
- } else {
- try {
- this.workspaces = new
ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
- } catch (Exception e) {
- this.workspaces = Collections.emptyList();
- String msg =
RestClientI18n.serverManagerGetWorkspacesExceptionMsg.text(this.repository);
- Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
- }
- }
+ /**
+ * Refreshes the workspace-related fields and controls based on the server
+ * registry.
+ */
+ private void refreshWorkspaces() {
+ this.workspace = null;
- // clear items
- this.cbxWorkspace.removeAll();
- this.cbxWorkspaceAreas.removeAll();
+ if (this.repository == null) {
+ this.workspaces = Collections.emptyList();
+ } else {
+ try {
+ this.workspaces = new
ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
+ } catch (Exception e) {
+ this.workspaces = Collections.emptyList();
+ String msg =
RestClientI18n.serverManagerGetWorkspacesExceptionMsg.text(this.repository);
+ Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
+ }
+ }
- // reload
- if (this.workspaces.isEmpty()) {
- // disable controls if necessary
- if (this.cbxWorkspace.getEnabled()) {
- this.cbxWorkspace.setEnabled(false);
- }
+ // clear items
+ this.cbxWorkspace.removeAll();
+ this.cbxWorkspaceAreas.removeAll();
- if (this.cbxWorkspaceAreas.getEnabled()) {
- this.cbxWorkspaceAreas.setEnabled(false);
- }
- } else if (this.workspaces.size() == 1) {
- Workspace temp = this.workspaces.get(0);
- this.cbxWorkspace.add(temp.getName());
- this.cbxWorkspace.select(0);
+ // reload
+ if (this.workspaces.isEmpty()) {
+ // disable controls if necessary
+ if (this.cbxWorkspace.getEnabled()) {
+ this.cbxWorkspace.setEnabled(false);
+ }
- // enable controls if necessary
- if (!this.cbxWorkspace.getEnabled()) {
- this.cbxWorkspace.setEnabled(true);
- }
+ if (this.cbxWorkspaceAreas.getEnabled()) {
+ this.cbxWorkspaceAreas.setEnabled(false);
+ }
+ } else if (this.workspaces.size() == 1) {
+ Workspace temp = this.workspaces.get(0);
+ this.cbxWorkspace.add(temp.getName());
+ this.cbxWorkspace.select(0);
- if (!this.cbxWorkspaceAreas.getEnabled()) {
- this.cbxWorkspaceAreas.setEnabled(true);
- }
- } else {
- // add an item for each workspace
- for (Workspace workspace : this.workspaces) {
- this.cbxWorkspace.add(workspace.getName());
- }
+ // enable controls if necessary
+ if (!this.cbxWorkspace.getEnabled()) {
+ this.cbxWorkspace.setEnabled(true);
+ }
- // enable controls if necessary
- if (!this.cbxWorkspace.getEnabled()) {
- this.cbxWorkspace.setEnabled(true);
- }
+ if (!this.cbxWorkspaceAreas.getEnabled()) {
+ this.cbxWorkspaceAreas.setEnabled(true);
+ }
+ } else {
+ // add an item for each workspace
+ for (Workspace workspace : this.workspaces) {
+ this.cbxWorkspace.add(workspace.getName());
+ }
- if (!this.cbxWorkspaceAreas.getEnabled()) {
- this.cbxWorkspaceAreas.setEnabled(true);
- }
- }
- }
+ // enable controls if necessary
+ if (!this.cbxWorkspace.getEnabled()) {
+ this.cbxWorkspace.setEnabled(true);
+ }
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.tools.modeshape.rest.IServerRegistryListener#serverRegistryChanged(org.jboss.tools.modeshape.rest.ServerRegistryEvent)
- */
- @Override
- public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
- // should only be a new server event
- if (event.isNew()) {
- refreshServers();
- updateState();
- }
+ if (!this.cbxWorkspaceAreas.getEnabled()) {
+ this.cbxWorkspaceAreas.setEnabled(true);
+ }
+ }
+ }
- return null;
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.tools.modeshape.rest.IServerRegistryListener#serverRegistryChanged(org.jboss.tools.modeshape.rest.ServerRegistryEvent)
+ */
+ @Override
+ public Exception[] serverRegistryChanged(ServerRegistryEvent event) {
+ // should only be a new server event
+ if (event.isNew()) {
+ refreshServers();
+ updateState();
+ }
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- @Override
- public void setVisible( boolean visible ) {
- super.setVisible(visible);
+ return null;
+ }
- if (visible) {
- // set initial status
- validate();
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
- // update OK/Finish button enablement
- setPageComplete(!this.status.isError());
+ if (visible) {
+ // set initial status
+ validate();
- // set initial message
- if (this.status.isOk()) {
- String msg = ((this.type == Type.PUBLISH) ?
RestClientI18n.publishPagePublishOkStatusMsg.text()
- :
RestClientI18n.publishPageUnpublishOkStatusMsg.text());
- setMessage(msg, IMessageProvider.NONE);
- } else {
- setMessage(this.status.getMessage(), IMessageProvider.ERROR);
- }
- }
- }
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
- */
- @Override
- public void setWizard( IWizard newWizard ) {
- super.setWizard(newWizard);
+ // set initial message
+ if (this.status.isOk()) {
+ String msg = ((this.type == Type.PUBLISH) ?
RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ setMessage(msg, IMessageProvider.NONE);
+ } else {
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ }
+ }
+ }
- try {
- this.files = processResources(this.resources, isRecursing(), this.filter);
- } catch (CoreException e) {
- Activator.getDefault().log(new Status(Severity.ERROR,
RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
- }
- }
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
+ */
+ @Override
+ public void setWizard(IWizard newWizard) {
+ super.setWizard(newWizard);
- /**
- * Updates the initial page message.
- */
- void updateInitialMessage() {
- String msg = ((this.type == Type.PUBLISH) ?
RestClientI18n.publishPagePublishOkStatusMsg.text()
- :
RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ try {
+ this.files = processResources(this.resources, isRecursing(), this.filter);
+ } catch (CoreException e) {
+ Activator.getDefault().log(
+ new Status(Severity.ERROR,
RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
+ }
+ }
- if (msg.equals(getMessage())) {
- updateState();
- }
- }
+ /**
+ * Updates the initial page message.
+ */
+ void updateInitialMessage() {
+ String msg = ((this.type == Type.PUBLISH) ?
RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
- /**
- * Updates message, message icon, and OK button enablement based on validation
results
- */
- void updateState() {
- // get the current state
- validate();
+ if (msg.equals(getMessage())) {
+ updateState();
+ }
+ }
+
+ /**
+ * Some capabilities (like versioning) will not be supported by all repositories. This
could affect the UI.
+ */
+ private void updateRepositoryCapabilities() {
+ // versioning
+ this.repositorySupportsVersioning = true;
- // update OK/Finish button enablement
- setPageComplete(!this.status.isError());
+ if (this.repository == null) {
+ this.repositorySupportsVersioning = false;
+ } else {
+ Object supportsVersioning =
this.repository.getMetadata().get(javax.jcr.Repository.OPTION_VERSIONING_SUPPORTED);
+
+ if (supportsVersioning == null) {
+ this.repositorySupportsVersioning = false;
+ } else {
+ this.repositorySupportsVersioning =
Boolean.parseBoolean(supportsVersioning.toString());
+ }
+ }
- // update page message
- if (this.status.isError()) {
- setMessage(this.status.getMessage(), IMessageProvider.ERROR);
- } else {
- if (this.status.isWarning()) {
- setMessage(this.status.getMessage(), IMessageProvider.WARNING);
- } else if (this.status.isInfo()) {
- setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
- } else {
- setMessage(this.status.getMessage(), IMessageProvider.NONE);
- }
- }
- }
+ // update enabled state of versioning controls
+ if ((this.chkVersioning != null) && (this.chkVersioning.getEnabled() !=
this.repositorySupportsVersioning)) {
+ this.chkVersioning.setEnabled(this.repositorySupportsVersioning);
+ this.linkPrefs.setEnabled(this.repositorySupportsVersioning);
+ }
+ }
- /**
- * Validates all inputs and sets the validation status.
- */
- private void validate() {
- String msg = null;
- Severity severity = Severity.ERROR;
+ /**
+ * Updates message, message icon, and OK button enablement based on
+ * validation results
+ */
+ void updateState() {
+ // get the current state
+ validate();
- if ((this.resources == null) || this.resources.isEmpty()
- || this.files.isEmpty()) {
- msg = ((type == Type.PUBLISH) ?
RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text()
- :
RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
- } else if (this.server == null) {
- int count = this.cbxServer.getItemCount();
- msg = ((count == 0) ?
RestClientI18n.publishPageNoAvailableServersStatusMsg.text()
- :
RestClientI18n.publishPageMissingServerStatusMsg.text());
- } else if (this.repository == null) {
- int count = this.cbxRepository.getItemCount();
- msg = ((count == 0) ?
RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text()
- :
RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
- } else if (this.workspace == null) {
- int count = this.cbxWorkspace.getItemCount();
- msg = ((count == 0) ?
RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text()
- :
RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
- } else {
- severity = Severity.OK;
- msg = ((type == Type.PUBLISH) ?
RestClientI18n.publishPagePublishOkStatusMsg.text()
- :
RestClientI18n.publishPageUnpublishOkStatusMsg.text());
- }
+ // update OK/Finish button enablement
+ setPageComplete(!this.status.isError());
- this.status = new Status(severity, msg, null);
- }
+ // update page message
+ if (this.status.isError()) {
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ } else {
+ if (this.status.isWarning()) {
+ setMessage(this.status.getMessage(), IMessageProvider.WARNING);
+ } else if (this.status.isInfo()) {
+ setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
+ } else {
+ setMessage(this.status.getMessage(), IMessageProvider.NONE);
+ }
+ }
+ }
- /**
- * Processing done after wizard is finished. Wizard was not canceled.
- */
- void wizardFinished() {
- // update dialog settings
- getDialogSettings().put(RECURSE_KEY, this.recurse);
- getDialogSettings().put(WORKSPACE_AREA_KEY, this.workspaceArea);
- }
+ /**
+ * Validates all inputs and sets the validation status.
+ */
+ private void validate() {
+ String msg = null;
+ Severity severity = Severity.ERROR;
+ if ((this.resources == null) || this.resources.isEmpty() || this.files.isEmpty()) {
+ msg = ((type == Type.PUBLISH) ?
RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text()
+ : RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
+ } else if (this.server == null) {
+ int count = this.cbxServer.getItemCount();
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableServersStatusMsg.text()
+ : RestClientI18n.publishPageMissingServerStatusMsg.text());
+ } else if (this.repository == null) {
+ int count = this.cbxRepository.getItemCount();
+ msg = ((count == 0) ?
RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text()
+ : RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
+ } else if (this.workspace == null) {
+ int count = this.cbxWorkspace.getItemCount();
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text()
+ : RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
+ } else {
+ severity = Severity.OK;
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ }
+
+ this.status = new Status(severity, msg, null);
+ }
+
+ /**
+ * Processing done after wizard is finished. Wizard was not canceled.
+ */
+ void wizardFinished() {
+ // update dialog settings
+ getDialogSettings().put(RECURSE_KEY, this.recurse);
+ getDialogSettings().put(WORKSPACE_AREA_KEY, this.workspaceArea);
+ }
+
}
Property changes on: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user
___________________________________________________________________
Added: svn:ignore
+ target
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html 2011-05-10
20:09:02 UTC (rev 31196)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html 2011-05-10
21:01:17 UTC (rev 31197)
@@ -54,8 +54,9 @@
</tr>
<tr>
<td align="right"><strong>Version
Checkbox</strong> </td>
- <td>when checked the files being published will be marked as versionable within
the ModeShape repository
- (initially set to the preference value)</td>
+ <td>when checked, the files being published will be marked as versionable
within the ModeShape repository
+ (initially set to the preference value). If disabled, the selected ModeShape
repository either does not support versioning or
+ does not have versioning enabled.</td>
</tr>
<tr>
<td align="right"><strong>Preference Page
Link</strong> </td>
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
===================================================================
(Binary files differ)