Author: elvisisking
Date: 2011-05-10 16:00:36 -0400 (Tue, 10 May 2011)
New Revision: 31195
Modified:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java
branches/jbosstools-3.2.x/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:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
===================================================================
---
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-05-10
18:33:59 UTC (rev 31194)
+++
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-05-10
20:00:36 UTC (rev 31195)
@@ -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:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java
===================================================================
---
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java 2011-05-10
18:33:59 UTC (rev 31194)
+++
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/ServerManager.java 2011-05-10
20:00:36 UTC (rev 31195)
@@ -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:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java
===================================================================
---
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java 2011-05-10
18:33:59 UTC (rev 31194)
+++
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/wizards/PublishPage.java 2011-05-10
20:00:36 UTC (rev 31195)
@@ -71,7 +71,7 @@
* more files to a repository.
*/
public final class PublishPage extends WizardPage implements IServerRegistryListener,
ModifyListener {
-
+
/**
* The default repository workspace area where files are published.
*/
@@ -307,6 +307,11 @@
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;
@@ -316,6 +321,11 @@
* 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.
@@ -339,6 +349,11 @@
private Repository repository;
/**
+ * <code>true</code> if the selected repository supports versioning
+ */
+ private boolean repositorySupportsVersioning;
+
+ /**
* The collection of resources selected by the user to be published or
* unpublished.
*/
@@ -613,16 +628,17 @@
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);
- chkVersioning.setSelection(this.versioning);
- chkVersioning.addSelectionListener(new SelectionAdapter() {
+ this.chkVersioning.setSelection(this.versioning);
+ this.chkVersioning.setEnabled(false);
+ this.chkVersioning.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*
@@ -634,10 +650,11 @@
}
});
- 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() {
+ 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}
*
@@ -767,6 +784,9 @@
this.repository = this.repositories.get(index);
}
+ // repository capabilities could affect the UI
+ updateRepositoryCapabilities();
+
// clear loaded workspaces
refreshWorkspaces();
@@ -878,7 +898,7 @@
* done
*/
boolean isVersioning() {
- return this.versioning;
+ return (this.repositorySupportsVersioning && this.versioning);
}
/**
@@ -964,6 +984,9 @@
this.cbxRepository.setEnabled(true);
}
}
+
+ // repository capabilities could affect the UI
+ updateRepositoryCapabilities();
// must reload workspaces
refreshWorkspaces();
@@ -1145,7 +1168,33 @@
updateState();
}
}
+
+ /**
+ * Some capabilities (like versioning) will not be supported by all repositories. This
could affect the UI.
+ */
+ private void updateRepositoryCapabilities() {
+ // versioning
+ this.repositorySupportsVersioning = true;
+ 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 enabled state of versioning controls
+ if ((this.chkVersioning != null) && (this.chkVersioning.getEnabled() !=
this.repositorySupportsVersioning)) {
+ this.chkVersioning.setEnabled(this.repositorySupportsVersioning);
+ this.linkPrefs.setEnabled(this.repositorySupportsVersioning);
+ }
+ }
+
/**
* Updates message, message icon, and OK button enablement based on
* validation results
Property changes on:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user
___________________________________________________________________
Added: svn:ignore
+ target
Modified:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html
===================================================================
---
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html 2011-05-10
18:33:59 UTC (rev 31194)
+++
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc/PublishDialog.html 2011-05-10
20:00:36 UTC (rev 31195)
@@ -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:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/doc.zip
===================================================================
(Binary files differ)