JBoss Tools SVN: r23591 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-07-20 09:07:57 -0400 (Tue, 20 Jul 2010)
New Revision: 23591
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
Log:
https://jira.jboss.org/browse/JBIDE-6637
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-07-20 13:03:35 UTC (rev 23590)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-07-20 13:07:57 UTC (rev 23591)
@@ -55,6 +55,8 @@
{CDIPreferences.STEREOTYPE_IS_ANNOTATED_TYPED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeIsAnnotatedTyped_label},
{CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInQualifierTypeMember_label},
{CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label},
+ {CDIPreferences.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingTargetAnnotationInQualifierType_label},
+ {CDIPreferences.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingRetentionAnnotationInQualifierType_label},
},
CDICorePlugin.PLUGIN_ID
);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java 2010-07-20 13:03:35 UTC (rev 23590)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java 2010-07-20 13:07:57 UTC (rev 23591)
@@ -55,6 +55,8 @@
public static String CDIValidatorConfigurationBlock_pb_stereotypeIsAnnotatedTyped_label;
public static String CDIValidatorConfigurationBlock_pb_missingNonbindingInQualifierTypeMember_label;
public static String CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label;
+ public static String CDIValidatorConfigurationBlock_pb_missingTargetAnnotationInQualifierType_label;
+ public static String CDIValidatorConfigurationBlock_pb_missingRetentionAnnotationInQualifierType_label;
// Scope
public static String CDIValidatorConfigurationBlock_section_scope;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties 2010-07-20 13:03:35 UTC (rev 23590)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties 2010-07-20 13:07:57 UTC (rev 23591)
@@ -44,6 +44,8 @@
CDIValidatorConfigurationBlock_pb_stereotypeIsAnnotatedTyped_label=Stereotype has @Typed:
CDIValidatorConfigurationBlock_pb_missingNonbindingInQualifierTypeMember_label=Missing @Nonbinding in qualifier type member:
CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label=Missing @Nonbinding in interceptor binding type member:
+CDIValidatorConfigurationBlock_pb_missingTargetAnnotationInQualifierType_label=Missing @Target({METHOD, FIELD, PARAMETER, TYPE}) annutation in qualifier annotation type
+CDIValidatorConfigurationBlock_pb_missingRetentionAnnotationInQualifierType_label=Missing @Retention(RUNTIME) annutation in qualifier annotation type
##Scope
CDIValidatorConfigurationBlock_section_scope=Scope
15 years, 9 months
JBoss Tools SVN: r23590 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-07-20 09:03:35 -0400 (Tue, 20 Jul 2010)
New Revision: 23590
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-6637
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2010-07-20 12:28:02 UTC (rev 23589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2010-07-20 13:03:35 UTC (rev 23590)
@@ -78,6 +78,9 @@
// is not annotated @Nonbinding (9.5.2 non-portable)
public static final String MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER = INSTANCE.createSeverityOption("missingNonbindingInInterceptorBindingTypeMember"); //$NON-NLS-1$
+ public static final String MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE = INSTANCE.createSeverityOption("missingTargetAnnotationInQualifierType"); //$NON-NLS-1$
+ public static final String MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE = INSTANCE.createSeverityOption("missingRetentionAnnotationInQualifierType"); //$NON-NLS-1$
+
//Scope group
// - bean class or producer method or field specifies multiple scope type annotations (2.4.3)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-07-20 12:28:02 UTC (rev 23589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-07-20 13:03:35 UTC (rev 23590)
@@ -1796,8 +1796,77 @@
* - array-valued or annotation-valued member of a qualifier type is not annotated @Nonbinding (Non-Portable behavior)
*/
validateAnnotationMembers(qualifier, CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER, CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER, CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER);
+
+ /*
+ * Qualifier annotation type should be annotated with @Target({METHOD, FIELD, PARAMETER, TYPE})
+ */
+ try {
+ validateQualifierAnnotationTypeAnnotations(qualifier, resource);
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
}
+ private void validateQualifierAnnotationTypeAnnotations(IQualifier qualifier, IResource resource) throws JavaModelException {
+ /*
+ * Qualifier annotation type should be annotated with @Target({METHOD, FIELD, PARAMETER, TYPE})
+ * Qualifier annotation type should be annotated with @Retention(RUNTIME)
+ */
+ IAnnotationDeclaration target = qualifier.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
+ if(target == null) {
+ addError(CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, CDIPreferences.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, CDIUtil.convertToSourceReference(qualifier.getSourceType().getNameRange()), resource);
+ } else {
+ IMemberValuePair[] ps = target.getDeclaration().getMemberValuePairs();
+ boolean ok = false;
+ for (IMemberValuePair p: ps) {
+ if(!"value".equals(p.getMemberName())) continue;
+ Object o = p.getValue();
+ if(o instanceof Object[]) {
+ ok = true;
+ Object[] os = (Object[])o;
+ Set<String> vs = new HashSet<String>();
+ for (Object q: os) {
+ String s = q.toString();
+ int i = s.lastIndexOf('.');
+ if(i >= 0) s = s.substring(i + 1);
+ vs.add(s);
+ }
+ for (String s: new String[]{"TYPE", "METHOD", "FIELD", "PARAMETER"}) {
+ if(!vs.contains(s)) ok = false;
+ }
+ }
+ }
+ if(!ok) {
+ addError(CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, CDIPreferences.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, target, resource);
+ }
+ }
+
+ /*
+ * Qualifier annotation type should be annotated with @Retention(RUNTIME)
+ */
+ IAnnotationDeclaration retention = qualifier.getAnnotationDeclaration(CDIConstants.RETENTION_ANNOTATION_TYPE_NAME);
+ if(retention == null) {
+ addError(CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, CDIPreferences.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, CDIUtil.convertToSourceReference(qualifier.getSourceType().getNameRange()), resource);
+ } else {
+ IMemberValuePair[] ps = retention.getDeclaration().getMemberValuePairs();
+ boolean ok = false;
+ for (IMemberValuePair p: ps) {
+ if(!"value".equals(p.getMemberName())) continue;
+ Object o = p.getValue();
+ if(o != null) {
+ ok = true;
+ String s = o.toString();
+ int i = s.lastIndexOf('.');
+ if(i >= 0) s = s.substring(i + 1);
+ if(!"RUNTIME".equals(s)) ok = false;
+ }
+ }
+ if(!ok) {
+ addError(CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, CDIPreferences.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, retention, resource);
+ }
+ }
+ }
+
private void validateInterceptorBinding(IInterceptorBinding binding) {
if(binding==null) {
return;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-07-20 12:28:02 UTC (rev 23589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-07-20 13:03:35 UTC (rev 23590)
@@ -42,6 +42,8 @@
public static String MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER;
public static String MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER;
public static String MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER;
+ public static String MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE;
+ public static String MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE;
public static String MULTIPLE_SCOPE_TYPE_ANNOTATIONS;
public static String MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-07-20 12:28:02 UTC (rev 23589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-07-20 13:03:35 UTC (rev 23590)
@@ -21,6 +21,8 @@
MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER=Array-valued member of a qualifier type should be annotated @Nonbinding [JSR-299 �5.2.5]
MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER=Annotation-valued member of an interceptor binding type should be annotated @Nonbinding [JSR-299 �9.5.2]
MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER=Array-valued member of an interceptor binding type should be annotated @Nonbinding [JSR-299 �9.5.2]
+MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE=Qualifier annotation type should be annotated with @Target('{'METHOD, FIELD, PARAMETER, TYPE'}')
+MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE=Qualifier annotation type should be annotated with @Retention(RUNTIME)
MULTIPLE_SCOPE_TYPE_ANNOTATIONS=Bean class or producer method or field specifies multiple scope type annotations
MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE=Bean does not explicitly declare a scope when there is no default scope
15 years, 9 months
JBoss Tools SVN: r23589 - workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-20 08:28:02 -0400 (Tue, 20 Jul 2010)
New Revision: 23589
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
Log:
Some small comments
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20 11:27:20 UTC (rev 23588)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20 12:28:02 UTC (rev 23589)
@@ -53,7 +53,11 @@
IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
+
+ // Locally zip it up into the remote tmp folder
IStatus sup = super.publishModule(method, server, module, publishType, delta, monitor);
+
+ // set up needed vars
IDeployableServer server2 = ServerConverter.getDeployableServer(server);
String depRoot = getDeployRoot(module, ServerConverter.getDeployableServer(server));
RSEPublishMethod method2 = (RSEPublishMethod)method;
@@ -62,6 +66,8 @@
IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(lastMod, server2, method2.getRemoteRootFolder());
IPath tempDestFolder = RSEPublishMethod.findModuleFolderWithDefault(lastMod, server2, method2.getRemoteTemporaryFolder());
String name = sourcePath.lastSegment();
+
+ // Now transfer the file to RSE
try {
method2.getFileService().upload(sourcePath.toFile(), tempDestFolder.toString(), name, true, null, null, new NullProgressMonitor());
method2.getFileService().move(tempDestFolder.toString(), name, destFolder.toString(), name, new NullProgressMonitor());
15 years, 9 months
JBoss Tools SVN: r23588 - in workspace/rstryker/rse/as/plugins: org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-20 07:27:20 -0400 (Tue, 20 Jul 2010)
New Revision: 23588
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
Log:
Primarily added RSE jst zipped publisher
cleanup to some api's
Removal of some references to hardcoded local deployment method
JBIDE-6580
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2010-07-20 11:27:20 UTC (rev 23588)
@@ -95,6 +95,11 @@
priority="2"
zipDelegate="true">
</publisher>
+ <publisher
+ class="org.jboss.ide.eclipse.archives.webtools.modules.rse.RSEZippedJSTPublisher"
+ priority="3"
+ zipDelegate="true">
+ </publisher>
</extension>
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * TODO: Logging and Progress Monitors
+ ******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.modules;
import org.eclipse.core.runtime.CoreException;
@@ -16,36 +28,45 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-public class WTPZippedPublisher extends PublishUtil implements IJBossServerPublisher {
+public class WTPZippedPublisher implements IJBossServerPublisher {
private int moduleState = IServer.PUBLISH_STATE_NONE;
public boolean accepts(String method, IServer server, IModule[] module) {
IDeployableServer ds = ServerConverter.getDeployableServer(server);
IModule lastMod = (module == null || module.length == 0 ) ? null : module[module.length -1];
- if( LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method) && lastMod == null)
+ if( getPublishMethod().equals(method) && lastMod == null)
return true;
- return LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method)
+ return getPublishMethod().equals(method)
&& ModuleCoreNature.isFlexibleProject(lastMod.getProject())
&& ds != null && ds.zipsWTPDeployments();
}
+
+ protected String getPublishMethod() {
+ return LocalPublishMethod.LOCAL_PUBLISH_METHOD;
+ }
public int getPublishState() {
return moduleState;
}
+ protected String getDeployRoot(IModule[] module, IDeployableServer ds) {
+ String deployRoot = PublishUtil.getDeployRootFolder(
+ module, ds, ds.getDeployFolder(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return deployRoot;
+ }
+
public IStatus publishModule(
IJBossServerPublishMethod method,
IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
+ // Build all parts together at once.
+ // When a call for [ear, childWar] comes in, ignore it.
if( module.length > 1 ) {
return Status.OK_STATUS;
}
-
IDeployableServer ds = ServerConverter.getDeployableServer(server);
- String deployRoot = PublishUtil.getDeployRootFolder(
- module, ds, ds.getDeployFolder(),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
-
+ String deployRoot = getDeployRoot(module, ds);
LocalZippedPublisherUtil util = new LocalZippedPublisherUtil();
return util.publishModule(server, deployRoot, module, publishType, delta, monitor);
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -12,123 +12,64 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.modules.rse;
-import java.io.File;
-import java.util.ArrayList;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.IModuleFile;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.archives.webtools.modules.WTPZippedPublisher;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
-import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.LocalCopyCallback;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.rse.core.AbstractJSTPublisher;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod;
-public class RSEZippedJSTPublisher extends AbstractJSTPublisher {
+public class RSEZippedJSTPublisher extends WTPZippedPublisher {
- private RSEPublishMethod method;
-
- @Override
- protected String getTargetedPublishMethodId() {
+ protected String getPublishMethod() {
return RSEPublishMethod.RSE_ID;
}
-
- @Override
- protected boolean zipSettingsMatch() {
- // TODO handle this
- return true;
+
+ /**
+ * Here we put the deployment first in a temporary remote deploy folder
+ * Then during the publishModule call, we'll also upload it to remote machine
+ */
+ protected String getDeployRoot(IModule[] module, IDeployableServer ds) {
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(ds.getServer()).
+ append(IJBossServerConstants.TEMP_REMOTE_DEPLOY).makeAbsolute();
+ deployRoot.toFile().mkdirs();
+ return deployRoot.toString();
}
@Override
- public IStatus publishModule(IJBossServerPublishMethod method,
- IServer server, IModule[] module, int publishType,
- IModuleResourceDelta[] delta, IProgressMonitor monitor)
- throws CoreException {
- this.method = (RSEPublishMethod)method;
- return super.publishModule(method, server, module, publishType, delta, monitor);
- }
-
- @Override
- protected IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
- String folder = PublishUtil.getDeployRootFolder(
- moduleTree, server,
- method.getRemoteRootFolder().toString(),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return PublishUtil.getDeployPath(moduleTree, folder);
- }
-
- @Override
- protected IPublishCopyCallbackHandler getCallbackHandler(IPath path, IServer server,
- IJBossServerPublishMethod method) {
- IPath tempRoot = JBossServerCorePlugin.getServerStateLocation(server)
- .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
- IPath remoteRoot = JBossServerCorePlugin.getServerStateLocation(server)
- .append(IJBossServerConstants.TEMP_REMOTE_DEPLOY).makeAbsolute();
- return new LocalCopyCallback(server, remoteRoot, tempRoot);
- }
-
- protected class RSERemotePublishHandler implements IPublishCopyCallbackHandler {
- public IPath root;
- private ArrayList<IPath> createdFolders = new ArrayList<IPath>();
- public RSERemotePublishHandler(IPath path) {
- this.root = path;
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+ IStatus sup = super.publishModule(method, server, module, publishType, delta, monitor);
+ IDeployableServer server2 = ServerConverter.getDeployableServer(server);
+ String depRoot = getDeployRoot(module, ServerConverter.getDeployableServer(server));
+ RSEPublishMethod method2 = (RSEPublishMethod)method;
+ IPath sourcePath = PublishUtil.getDeployPath(module, depRoot);
+ IModule lastMod = module[module.length-1];
+ IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(lastMod, server2, method2.getRemoteRootFolder());
+ IPath tempDestFolder = RSEPublishMethod.findModuleFolderWithDefault(lastMod, server2, method2.getRemoteTemporaryFolder());
+ String name = sourcePath.lastSegment();
+ try {
+ method2.getFileService().upload(sourcePath.toFile(), tempDestFolder.toString(), name, true, null, null, new NullProgressMonitor());
+ method2.getFileService().move(tempDestFolder.toString(), name, destFolder.toString(), name, new NullProgressMonitor());
+ } catch( SystemMessageException sme ) {
+ // TODO fix or return error
+ sme.printStackTrace();
}
- public IStatus[] copyFile(IModuleFile mf, IPath path,
- IProgressMonitor monitor) throws CoreException {
- File file = PublishUtil.getFile(mf);
- IPath remotePath = root.append(path);
- try {
- method.getFileService().upload(file, remotePath.removeLastSegments(1).toString(),
- remotePath.lastSegment(), true, null, null, monitor);
- } catch( SystemMessageException sme ) {
- System.err.println("failed to copy to " + remotePath.toString()); //$NON-NLS-1$
- }
- return null;
- }
- public IStatus[] deleteResource(IPath path, IProgressMonitor monitor)
- throws CoreException {
- IPath remotePath = root.append(path);
- try {
- method.getFileService().delete(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), monitor);
- } catch( SystemMessageException sme ) {
- System.err.println("failed to delete " + remotePath.toString()); //$NON-NLS-1$
- }
- return null;
- }
-
- public IStatus[] makeDirectoryIfRequired(IPath dir,
- IProgressMonitor monitor) throws CoreException {
- if( dir.segmentCount() > 0 )
- makeDirectoryIfRequired(dir.removeLastSegments(1), monitor);
- IPath toMake = root.append(dir);
- if( createdFolders.contains(toMake))
- return new IStatus[]{Status.OK_STATUS};
- try {
- method.getFileService().createFolder(toMake.removeLastSegments(1).toString(), toMake.lastSegment(), monitor);
- } catch( SystemMessageException sme ) {
- System.err.println("failed to make folder " + toMake.toString()); //$NON-NLS-1$
- }
- createdFolders.add(toMake);
- return null;
- }
+ return sup;
}
-
- @Override
- protected void finishPublish(int publishType, IModule[] moduleTree,
- IDeployableServer server, IProgressMonitor monitor) {
- // do nothing
- }
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -150,7 +150,8 @@
PublisherWrapper wrapper;
while(i.hasNext()) {
wrapper = i.next();
- if( wrapper.publisher.accepts(deployMethod, server, module))
+ IJBossServerPublisher publisher = wrapper.publisher;
+ if( publisher.accepts(deployMethod, server, module))
return wrapper.getNewInstance();
}
return null;
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -36,6 +36,7 @@
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
@@ -83,7 +84,9 @@
public static String getDeployRootFolder(IModule[] moduleTree,
IDeployableServer server, String defaultFolder, String moduleProperty) {
- return getDeployRootFolder(moduleTree, LocalPublishMethod.LOCAL_PUBLISH_METHOD, server, defaultFolder, moduleProperty);
+ IJBossServerPublishMethodType type = DeploymentPreferenceLoader.getCurrentDeploymentMethodType(server.getServer());
+ return getDeployRootFolder(moduleTree, type.getId(),
+ server, defaultFolder, moduleProperty);
}
public static String getDeployRootFolder(IModule[] moduleTree, String publishMethod,
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -38,9 +38,11 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public abstract class AbstractJSTPublisher implements IJBossServerPublisher {
@@ -58,7 +60,7 @@
IDeployableServer ds = ServerConverter.getDeployableServer(server);
boolean shouldAccept = ds != null
&& ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && zipSettingsMatch();
+ && zipSettingsMatch(server);
return shouldAccept;
}
@@ -139,9 +141,22 @@
/**
* Check whether the current zip settings for the publish method
* match with what this publisher expects.
+ * @param the server
* @return
*/
- protected abstract boolean zipSettingsMatch();
+ protected boolean zipSettingsMatch(IServer server) {
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean settingZips = ds.zipsWTPDeployments();
+ return requiresZips() == settingZips;
+ }
+
+ /**
+ * Check whether the current publisher requires the zip flag
+ *
+ * @param the server
+ * @return
+ */
+ protected abstract boolean requiresZips();
private IPublishCopyCallbackHandler getCallbackHandler(IPath path) {
return getCallbackHandler(path, server.getServer(), publishMethod);
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -28,8 +28,11 @@
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class RSEJSTPublisher extends AbstractJSTPublisher {
@@ -39,13 +42,17 @@
protected String getTargetedPublishMethodId() {
return RSEPublishMethod.RSE_ID;
}
-
+
+ /*
+ * This publisher does not handle zipped deployments
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.as.rse.core.AbstractJSTPublisher#requiresZips()
+ */
@Override
- protected boolean zipSettingsMatch() {
- // TODO handle this
+ protected boolean requiresZips() {
return false;
}
-
+
@Override
public IStatus publishModule(IJBossServerPublishMethod method,
IServer server, IModule[] module, int publishType,
@@ -122,4 +129,6 @@
IDeployableServer server, IProgressMonitor monitor) {
// do nothing
}
+
+
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -22,8 +22,12 @@
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.as.core.publishers.AbstractPublishMethod;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
public class RSEPublishMethod extends AbstractPublishMethod {
@@ -103,5 +107,13 @@
}
return null;
}
+
+ public static IPath findModuleFolderWithDefault(IModule module, IDeployableServer server, IPath startingPath) {
+ IModule[] moduleTree = new IModule[]{module};
+ String folder = PublishUtil.getDeployRootFolder(
+ moduleTree, server, startingPath.toString(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return PublishUtil.getDeployPath(moduleTree, folder).removeLastSegments(1);
+ }
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -76,26 +76,13 @@
return status;
}
- protected IPath findModuleFolderWithDefault(IModule module, IDeployableServer server, IPath startingPath) {
- IModule[] moduleTree = new IModule[]{module};
- String folder = PublishUtil.getDeployRootFolder(
- moduleTree, server, startingPath.toString(),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return PublishUtil.getDeployPath(moduleTree, folder).removeLastSegments(1);
- }
- protected IPath findDestinationFolder(IModule module, IDeployableServer server) {
- return findModuleFolderWithDefault(module, server, method.getRemoteRootFolder());
- }
- protected IPath findTempDestinationFolder(IModule module, IDeployableServer server) {
- return findModuleFolderWithDefault(module, server, method.getRemoteTemporaryFolder());
- }
protected IStatus publish(IDeployableServer server, IModule module, boolean updateTimestamp, IProgressMonitor monitor) throws CoreException {
SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
if( delegate != null ) {
IPath sourcePath = delegate.getGlobalSourcePath();
- IPath destFolder = findDestinationFolder(module, server);
- IPath tempDestFolder = findTempDestinationFolder(module, server);
+ IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(module, server, method.getRemoteRootFolder());
+ IPath tempDestFolder = RSEPublishMethod.findModuleFolderWithDefault(module, server, method.getRemoteTemporaryFolder());
String name = sourcePath.lastSegment();
try {
@@ -122,7 +109,7 @@
SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
if( delegate != null ) {
IPath sourcePath = delegate.getGlobalSourcePath();
- IPath destFolder = findDestinationFolder(module, server);
+ IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(module, server, method.getRemoteRootFolder());
String name = sourcePath.lastSegment();
try {
method.getFileService().delete(destFolder.toString(), name, new NullProgressMonitor());
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -56,11 +56,13 @@
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -287,7 +289,7 @@
zipDeployWTPProjects = toolkit.createButton(composite,
Messages.EditorZipDeployments, SWT.CHECK);
- boolean zippedPublisherAvailable = isLocalZippedPublisherAvailable();
+ boolean zippedPublisherAvailable = isZippedPublisherAvailable();
boolean value = getServer().zipsWTPDeployments();
zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
@@ -315,11 +317,19 @@
return section;
}
- protected boolean isLocalZippedPublisherAvailable() {
+ protected boolean isZippedPublisherAvailable() {
+ /*
+ * Maybe use IJBossServerPublishMethodType type = DeploymentPreferenceLoader.getCurrentDeploymentMethodType(getServer());
+ * But this class has no reference to the server, and it also might not want to go by stored data,
+ * but rather the combo in the ModuleDeploymentPage somehow?
+ */
+
+ // String method = DeploymentPreferenceLoader.getCurrentDeploymentMethodType(getServer()).getId();
+ String method = LocalPublishMethod.LOCAL_PUBLISH_METHOD;
IJBossServerPublisher[] publishers =
ExtensionManager.getDefault().getZippedPublishers();
for( int i = 0; i < publishers.length; i++ ) {
- if( publishers[i].accepts(LocalPublishMethod.LOCAL_PUBLISH_METHOD, getServer().getServer(), null))
+ if( publishers[i].accepts(method, getServer().getServer(), null))
return true;
}
return false;
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2010-07-20 11:07:29 UTC (rev 23587)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2010-07-20 11:27:20 UTC (rev 23588)
@@ -31,7 +31,9 @@
import org.jboss.ide.eclipse.as.core.publishers.JstPublisher;
import org.jboss.ide.eclipse.as.core.publishers.SingleFilePublisher;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.ModuleUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
@@ -195,8 +197,10 @@
private IPath getDeployPath() {
ModuleServer ms = selection[0];
IModule[] module = ms.module;
+ IJBossServerPublishMethodType type =
+ DeploymentPreferenceLoader.getCurrentDeploymentMethodType(ms.server);
IJBossServerPublisher publisher = ExtensionManager.getDefault()
- .getPublisher(ms.getServer(), module, "local");
+ .getPublisher(ms.getServer(), module, type.getId());
IPath path = null;
IDeployableServer deployableServer = ServerConverter
.getDeployableServer(ms.server);
15 years, 9 months
JBoss Tools SVN: r23587 - /.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-07-20 07:07:29 -0400 (Tue, 20 Jul 2010)
New Revision: 23587
Added:
org.jboss.tools.seam.text.ext.test/
Log:
Initial import.
15 years, 9 months
JBoss Tools SVN: r23586 - in workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui: jbossui/org/jboss/tools/as and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-20 06:03:35 -0400 (Tue, 20 Jul 2010)
New Revision: 23586
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/EditorExtensionManager.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentTypeUI.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/RSEDeploymentPreferenceUI.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/schema/DeployMethodUI.exsd
Log:
RSE branch why weren't these files added??
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/EditorExtensionManager.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/EditorExtensionManager.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/EditorExtensionManager.java 2010-07-20 10:03:35 UTC (rev 23586)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+
+public class EditorExtensionManager {
+
+ private static EditorExtensionManager instance;
+ public static EditorExtensionManager getDefault() {
+ if( instance == null )
+ instance = new EditorExtensionManager();
+ return instance;
+ }
+
+ private HashMap<String, IDeploymentTypeUI> publishMethodUIMap = null;
+ public IDeploymentTypeUI getPublishPreferenceUI(String deployType) {
+ if( publishMethodUIMap == null )
+ loadPublishPreferenceEditors();
+ return publishMethodUIMap.get(deployType);
+ }
+
+ public IDeploymentTypeUI[] getPublishPreferenceUIs() {
+ if( publishMethodUIMap == null )
+ loadPublishPreferenceEditors();
+ Collection<IDeploymentTypeUI> col = publishMethodUIMap.values();
+ return (IDeploymentTypeUI[]) col.toArray(new IDeploymentTypeUI[col.size()]);
+ }
+ private void loadPublishPreferenceEditors() {
+ publishMethodUIMap = new HashMap<String, IDeploymentTypeUI>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ JBossServerUIPlugin.PLUGIN_ID, "DeployMethodUI"); //$NON-NLS-1$
+ for( int i = 0; i < cf.length; i++ ) {
+ try {
+ IDeploymentTypeUI ui = (IDeploymentTypeUI) cf[i].createExecutableExtension("class"); //$NON-NLS-1$
+ if( ui != null && cf[i].getAttribute("deployMethodId") != null) { //$NON-NLS-1$
+ publishMethodUIMap.put(cf[i].getAttribute("deployMethodId"), ui); //$NON-NLS-1$
+ }
+ } catch(CoreException ce ) {
+ // TODO log
+ }
+ }
+ }
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentTypeUI.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentTypeUI.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentTypeUI.java 2010-07-20 10:03:35 UTC (rev 23586)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+
+public interface IDeploymentTypeUI {
+ /**
+ * The parent in this call has no layout and is basically a positioned,
+ * but unconfigured, composite.
+ *
+ * Fill her up!
+ *
+ * Don't forget this UI element is a singleton, similar to a factory,
+ * so you should probably make your first widget in the parent a
+ * new class which extends Composite and can maintain state.
+ *
+ * @param parent
+ * @param page
+ */
+ public void fillComposite(Composite parent, ModuleDeploymentPage page);
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/RSEDeploymentPreferenceUI.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/RSEDeploymentPreferenceUI.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-07-20 10:03:35 UTC (rev 23586)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.as.rse.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.jboss.ide.eclipse.as.ui.UIUtil;
+import org.jboss.ide.eclipse.as.ui.editor.IDeploymentTypeUI;
+import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
+
+public class RSEDeploymentPreferenceUI implements IDeploymentTypeUI {
+
+ public RSEDeploymentPreferenceUI() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void fillComposite(Composite parent,
+ ModuleDeploymentPage page) {
+ parent.setLayout(new FillLayout());
+ new RSEDeploymentPreferenceComposite(parent, SWT.NONE, page);
+ }
+
+ public static class RSEDeploymentPreferenceComposite extends Composite {
+ private ModuleDeploymentPage page;
+ public RSEDeploymentPreferenceComposite(Composite parent, int style, ModuleDeploymentPage page) {
+ super(parent, style);
+ this.page = page;
+ setLayout(new FormLayout());
+ Label l = new Label(this, SWT.NONE);
+ l.setLayoutData(UIUtil.createFormData2(0, 5, 0,70,0,5,100,-5));
+ l.setText("This belongs to rse");
+ }
+ }
+
+
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/schema/DeployMethodUI.exsd
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/schema/DeployMethodUI.exsd (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/schema/DeployMethodUI.exsd 2010-07-20 10:03:35 UTC (rev 23586)
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.as.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.as.ui" id="DeployMethodUI" name="org.jboss.ide.as.ui.deployMethodUI"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="ui"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="ui">
+ <complexType>
+ <attribute name="deployMethodId" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.ide.eclipse.as.ui.editor.IDeploymentTypeUI"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
15 years, 9 months
JBoss Tools SVN: r23585 - in workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as: core/publishers and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-20 06:02:36 -0400 (Tue, 20 Jul 2010)
New Revision: 23585
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethodType.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerPublishMethodType.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java
Log:
RSE branch why weren't these files added??
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.publishers;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+
+public abstract class AbstractPublishMethod implements IJBossServerPublishMethod {
+ public abstract String getPublishMethodId();
+ public IJBossServerPublishMethodType getPublishMethodType() {
+ return ExtensionManager.getDefault().getPublishMethod(getPublishMethodId());
+ }
+ public void publishStart(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+ }
+
+ public int publishFinish(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+ IModule[] modules = behaviour.getServer().getModules();
+ boolean allpublished= true;
+ for (int i = 0; i < modules.length; i++) {
+ if(behaviour.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
+ allpublished=false;
+ }
+ return allpublished ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;
+ }
+
+ public int getServerPublishState(DeployableServerBehavior behaviour) {
+ IModule[] modules = behaviour.getServer().getModules();
+ boolean allpublished= true;
+ for (int i = 0; i < modules.length; i++) {
+ if(behaviour.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
+ allpublished=false;
+ }
+ if(allpublished)
+ return IServer.PUBLISH_STATE_NONE;
+ return IServer.PUBLISH_STATE_INCREMENTAL;
+ }
+
+ public int publishModule(DeployableServerBehavior behaviour, int kind,
+ int deltaKind, IModule[] module, IProgressMonitor monitor)
+ throws CoreException {
+ // kind = [incremental, full, auto, clean] = [1,2,3,4]
+ // delta = [no_change, added, changed, removed] = [0,1,2,3]
+ if( module.length == 0 ) return IServer.PUBLISH_STATE_NONE;
+ int modulePublishState = behaviour.getServer().getModulePublishState(module);
+ int publishType = behaviour.getPublishType(kind, deltaKind, modulePublishState);
+ IJBossServerPublisher publisher;
+
+ // Let the publisher decide what to do
+ if( module.length > 0 ) {
+ publisher = ExtensionManager.getDefault().getPublisher(behaviour.getServer(), module, getPublishMethodId());
+ IModuleResourceDelta[] deltas = new IModuleResourceDelta[]{};
+ if( deltaKind != ServerBehaviourDelegate.REMOVED)
+ deltas = behaviour.getPublishedResourceDelta(module);
+ if( publisher != null ) {
+ try {
+ IStatus result = publisher.publishModule(
+ this,
+ behaviour.getServer(), module,
+ publishType, deltas, monitor);
+ if( result != null )
+ ServerLogger.getDefault().log(behaviour.getServer(), result);
+ } catch( CoreException ce) {
+ // Let the user know
+ ServerLogger.getDefault().log(behaviour.getServer(), ce.getStatus());
+ throw ce;
+ }
+ return publisher.getPublishState();
+ }
+ return IServer.PUBLISH_STATE_INCREMENTAL;
+ }
+ return IServer.PUBLISH_STATE_NONE;
+ }
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethodType.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethodType.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethodType.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server;
+
+public interface IJBossServerPublishMethodType {
+ public String getId();
+ public String getName();
+ public boolean accepts(String serverTypeId);
+ public IJBossServerPublishMethod createPublishMethod();
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerPublishMethodType.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerPublishMethodType.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerPublishMethodType.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
+
+public class ServerPublishMethodType implements IJBossServerPublishMethodType {
+
+ private String typeId, name;
+ private String[] serverTypes;
+ private IConfigurationElement element;
+ public ServerPublishMethodType(IConfigurationElement element) {
+ this.element = element;
+ this.typeId = element.getAttribute("id"); //$NON-NLS-1$
+ this.name = element.getAttribute("name"); //$NON-NLS-1$
+ String tmp = element.getAttribute("serverTypes"); //$NON-NLS-1$
+ serverTypes = tmp.split(","); //$NON-NLS-1$
+ // clean
+ for( int i = 0; i < serverTypes.length; i++ )
+ serverTypes[i] = serverTypes[i].trim();
+ }
+
+ public String getId() {
+ return typeId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public boolean accepts(String serverTypeId) {
+ return Arrays.asList(serverTypes).contains(serverTypeId);
+ }
+
+ public IJBossServerPublishMethod createPublishMethod() {
+ try {
+ return (IJBossServerPublishMethod) element.createExecutableExtension("class"); //$NON-NLS-1$
+ } catch( CoreException ce ) {
+ }
+ return null;
+ }
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.rse.core;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.eclipse.wst.server.core.util.ModuleFile;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+
+public abstract class AbstractJSTPublisher implements IJBossServerPublisher {
+ protected IModuleResourceDelta[] delta;
+ protected IDeployableServer server;
+ protected int publishState = IServer.PUBLISH_STATE_NONE;
+ protected IJBossServerPublishMethod publishMethod;
+
+ public AbstractJSTPublisher() {}
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( !method.equals(getTargetedPublishMethodId()))
+ return false;
+ if( module == null )
+ return true;
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean shouldAccept = ds != null
+ && ModuleCoreNature.isFlexibleProject(module[0].getProject())
+ && zipSettingsMatch();
+ return shouldAccept;
+ }
+
+ public int getPublishState() {
+ return publishState;
+ }
+
+ public IStatus publishModule(IJBossServerPublishMethod method,
+ IServer server, IModule[] module, int publishType,
+ IModuleResourceDelta[] delta, IProgressMonitor monitor)
+ throws CoreException {
+ IStatus status = null;
+ this.server = ServerConverter.getDeployableServer(server);
+ this.delta = delta;
+ this.publishMethod = method;
+
+ boolean deleted = false;
+ for( int i = 0; i < module.length; i++ ) {
+ if( module[i].isExternal() )
+ deleted = true;
+ }
+
+ if (publishType == REMOVE_PUBLISH ) {
+ status = unpublish(this.server, module, monitor);
+ } else {
+ if( deleted ) {
+ publishState = IServer.PUBLISH_STATE_UNKNOWN;
+ } else {
+ if (publishType == FULL_PUBLISH ) {
+ status = fullPublish(module, module[module.length-1], monitor);
+ } else if (publishType == INCREMENTAL_PUBLISH) {
+ status = incrementalPublish(module, module[module.length-1], monitor);
+ }
+ }
+ }
+ return status;
+ }
+
+ /**
+ * Get the publish method this publisher is associated with
+ * @return
+ */
+ protected abstract String getTargetedPublishMethodId();
+
+ /**
+ * Get the callback handler to be used for building the module.
+ * If the module is to be published locally, this may be a handler which only copies locally.
+ * If the module is to be zipped & published locally, this may be
+ * a handler which zips to a temporary directory, and allows the finish method to move the file
+ *
+ * @param path
+ * @param server
+ * @param method
+ * @return
+ */
+ protected abstract IPublishCopyCallbackHandler getCallbackHandler(IPath path, IServer server, IJBossServerPublishMethod method);
+
+ /**
+ * Gets the actual deploy path for this module
+ *
+ * @param moduleTree
+ * @param server
+ * @return
+ */
+ protected abstract IPath getDeployPath(IModule[] moduleTree, IDeployableServer server);
+
+ /**
+ * Finish up the publishing. This may be moving a final zipped entity into the proper
+ * folder or sending it over the wire to a remote machine.
+ *
+ * @param publishType
+ * @param moduleTree
+ * @param server
+ * @param monitor
+ */
+ protected abstract void finishPublish(int publishType, IModule[] moduleTree, IDeployableServer server, IProgressMonitor monitor);
+
+ /**
+ * Check whether the current zip settings for the publish method
+ * match with what this publisher expects.
+ * @return
+ */
+ protected abstract boolean zipSettingsMatch();
+
+ private IPublishCopyCallbackHandler getCallbackHandler(IPath path) {
+ return getCallbackHandler(path, server.getServer(), publishMethod);
+ }
+
+ protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
+ IPath deployPath = getDeployPath(moduleTree, server);
+ IPublishCopyCallbackHandler callback = getCallbackHandler(deployPath);
+ IModuleResource[] members = PublishUtil.getResources(module);
+
+ // First delete it
+ // if the module we're publishing is a project, not a binary, clean it's folder
+ if( !(new Path(module.getName()).segmentCount() > 1 ))
+ callback.deleteResource(new Path("/"), monitor); //$NON-NLS-1$
+
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
+
+ if( !PublishUtil.deployPackaged(moduleTree) && !PublishUtil.isBinaryObject(moduleTree)) {
+ PublishCopyUtil util = new PublishCopyUtil(callback);
+ list.addAll(Arrays.asList(util.publishFull(members, monitor)));
+ } else if( PublishUtil.isBinaryObject(moduleTree))
+ list.addAll(Arrays.asList(copyBinaryModule(moduleTree, monitor)));
+ else {
+ // A child that must be zipped
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
+ append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+
+ try {
+ File temp = deployRoot.toFile().createTempFile(module.getName(), ".tmp", deployRoot.toFile()); //$NON-NLS-1$
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ String parentFolder = deployPath.removeLastSegments(1).toString();
+ handler.makeDirectoryIfRequired(new Path(parentFolder), new NullProgressMonitor());
+ ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
+ handler.copyFile(mf, deployPath, new NullProgressMonitor());
+ } catch( IOException ioe) {
+ list.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe));
+ }
+ }
+
+ if( list.size() > 0 )
+ return createMultiStatus(list, module);
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
+ IStatus[] results = new IStatus[] {};
+ IPath deployPath = getDeployPath(moduleTree, server);
+ if( !PublishUtil.deployPackaged(moduleTree) && !PublishUtil.isBinaryObject(moduleTree)) {
+ IPublishCopyCallbackHandler handler = getCallbackHandler(deployPath);
+ results = new PublishCopyUtil(handler).publishDelta(delta, monitor);
+ } else if( delta.length > 0 ) {
+ if( PublishUtil.isBinaryObject(moduleTree))
+ results = copyBinaryModule(moduleTree, monitor);
+ else {
+ IPath localDeployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
+ append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+ try {
+ File temp = File.createTempFile(module.getName(), ".tmp", localDeployRoot.toFile()); //$NON-NLS-1$
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile);
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ String parentFolder = deployPath.removeLastSegments(1).toString();
+ handler.makeDirectoryIfRequired(new Path(parentFolder), new NullProgressMonitor());
+ ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
+ handler.copyFile(mf, deployPath, new NullProgressMonitor());
+ } catch( IOException ioe) {
+ IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe);
+ results = new IStatus[] { s };
+ }
+ }
+ }
+
+ if( results != null && results.length > 0 ) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_INC_FAIL,
+ NLS.bind(Messages.IncrementalPublishFail, module.getName()), null);
+ for( int i = 0; i < results.length; i++ )
+ ms.add(results[i]);
+ return ms;
+ }
+
+ IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS,
+ NLS.bind(Messages.CountModifiedMembers, PublishUtil.countChanges(delta), module.getName()), null);
+ return ret;
+ }
+
+ protected IStatus createMultiStatus(List<IStatus> list, IModule module) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_FAIL,
+ NLS.bind(Messages.FullPublishFail, module.getName()), null);
+ for( int i = 0; i < list.size(); i++ )
+ ms.add(list.get(i));
+ return ms;
+ }
+
+ protected IStatus[] copyBinaryModule(IModule[] moduleTree, IProgressMonitor monitor) {
+ try {
+ IPath destinationPath = getDeployPath(moduleTree, server);
+ IModuleResource[] members = PublishUtil.getResources(moduleTree);
+ File source = PublishUtil.getFile(members[0]);
+ if( source != null ) {
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ IPath localFilePath = new Path(source.getAbsolutePath());
+ ModuleFile mf = new ModuleFile(localFilePath.toFile(), localFilePath.lastSegment(), localFilePath);
+ handler.copyFile(mf, destinationPath, new NullProgressMonitor());
+ } else {
+// IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_COPY_BINARY_FAIL,
+// NLS.bind(Messages.CouldNotPublishModule,
+// moduleTree[moduleTree.length-1]), null);
+// return new IStatus[] {s};
+ // TODO
+ }
+ } catch( CoreException ce ) {
+ return new IStatus[] {ce.getStatus()};
+ }
+ return new IStatus[]{Status.OK_STATUS};
+ }
+
+ protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
+ IProgressMonitor monitor) throws CoreException {
+ IPath remotePath = getDeployPath(module, server);
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ handler.deleteResource(remotePath, monitor);
+ return Status.OK_STATUS;
+ }
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * TODO: Logging and Progress Monitors
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.rse.core;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+
+public class RSEJSTPublisher extends AbstractJSTPublisher {
+
+ private RSEPublishMethod method;
+
+ @Override
+ protected String getTargetedPublishMethodId() {
+ return RSEPublishMethod.RSE_ID;
+ }
+
+ @Override
+ protected boolean zipSettingsMatch() {
+ // TODO handle this
+ return false;
+ }
+
+ @Override
+ public IStatus publishModule(IJBossServerPublishMethod method,
+ IServer server, IModule[] module, int publishType,
+ IModuleResourceDelta[] delta, IProgressMonitor monitor)
+ throws CoreException {
+ this.method = (RSEPublishMethod)method;
+ return super.publishModule(method, server, module, publishType, delta, monitor);
+ }
+
+ @Override
+ protected IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
+ String folder = PublishUtil.getDeployRootFolder(
+ moduleTree, server,
+ method.getRemoteRootFolder().toString(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return PublishUtil.getDeployPath(moduleTree, folder);
+ }
+
+ @Override
+ protected IPublishCopyCallbackHandler getCallbackHandler(IPath path, IServer server,
+ IJBossServerPublishMethod method) {
+ return new RSERemotePublishHandler(path);
+ }
+
+ protected class RSERemotePublishHandler implements IPublishCopyCallbackHandler {
+ public IPath root;
+ private ArrayList<IPath> createdFolders = new ArrayList<IPath>();
+ public RSERemotePublishHandler(IPath path) {
+ this.root = path;
+ }
+ public IStatus[] copyFile(IModuleFile mf, IPath path,
+ IProgressMonitor monitor) throws CoreException {
+ File file = PublishUtil.getFile(mf);
+ IPath remotePath = root.append(path);
+ try {
+ method.getFileService().upload(file, remotePath.removeLastSegments(1).toString(),
+ remotePath.lastSegment(), true, null, null, monitor);
+ } catch( SystemMessageException sme ) {
+ System.err.println("failed to copy to " + remotePath.toString()); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public IStatus[] deleteResource(IPath path, IProgressMonitor monitor)
+ throws CoreException {
+ IPath remotePath = root.append(path);
+ try {
+ method.getFileService().delete(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), monitor);
+ } catch( SystemMessageException sme ) {
+ System.err.println("failed to delete " + remotePath.toString()); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public IStatus[] makeDirectoryIfRequired(IPath dir,
+ IProgressMonitor monitor) throws CoreException {
+ if( dir.segmentCount() > 0 )
+ makeDirectoryIfRequired(dir.removeLastSegments(1), monitor);
+ IPath toMake = root.append(dir);
+ if( createdFolders.contains(toMake))
+ return new IStatus[]{Status.OK_STATUS};
+ try {
+ method.getFileService().createFolder(toMake.removeLastSegments(1).toString(), toMake.lastSegment(), monitor);
+ } catch( SystemMessageException sme ) {
+ System.err.println("failed to make folder " + toMake.toString()); //$NON-NLS-1$
+ }
+ createdFolders.add(toMake);
+ return null;
+ }
+ }
+
+ @Override
+ protected void finishPublish(int publishType, IModule[] moduleTree,
+ IDeployableServer server, IProgressMonitor monitor) {
+ // do nothing
+ }
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.rse.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.services.files.IFileService;
+import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.jboss.ide.eclipse.as.core.publishers.AbstractPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+
+public class RSEPublishMethod extends AbstractPublishMethod {
+
+ public static final String RSE_ID = "rse"; //$NON-NLS-1$
+
+ @Override
+ public String getPublishMethodId() {
+ return RSE_ID;
+ }
+
+ private IFileServiceSubSystem fileSubSystem = null;
+ private IPath remoteRootFolder;
+ private IPath remoteTemporaryFolder;
+ public void publishStart(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+ loadRemoteDeploymentDetails();
+ if (fileSubSystem != null && !fileSubSystem.isConnected()) {
+ try {
+ fileSubSystem.connect(monitor, false);
+ } catch (Exception e) {
+ }
+ }
+ super.publishStart(behaviour, monitor);
+ }
+ public IPath getRemoteRootFolder() {
+ return remoteRootFolder;
+ }
+ public IPath getRemoteTemporaryFolder() {
+ return remoteTemporaryFolder;
+ }
+ public IFileServiceSubSystem getFileServiceSubSystem() {
+ return fileSubSystem;
+ }
+ public IFileService getFileService() {
+ return fileSubSystem.getFileService();
+ }
+
+ public int publishFinish(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+ return super.publishFinish(behaviour, monitor);
+ }
+
+ protected void loadRemoteDeploymentDetails() throws CoreException{
+ // TODO obviously fix this
+ this.remoteRootFolder = new Path("/home/rob/redhat/deploy"); //$NON-NLS-1$
+ this.remoteTemporaryFolder = new Path("/home/rob/redhat/tmp"); //$NON-NLS-1$
+ String CONNECTION_NAME = "Local"; //$NON-NLS-1$ //TODO obviously get this from somewhere else
+ IHost host = findHost(CONNECTION_NAME);
+ if( host != null ) {
+ fileSubSystem = findFileTransferSubSystem(host);
+ } else {
+ // TODO error host not found in RSE
+ }
+ }
+
+ protected IHost findHost(String connectionName) {
+ IHost[] allHosts = RSECorePlugin.getTheSystemRegistry().getHosts();
+ for( int i = 0; i < allHosts.length; i++ ) {
+ if( allHosts[i].getAliasName().equals(connectionName))
+ return allHosts[i];
+ }
+ return null;
+ }
+
+ /* approved files subsystems *
+ ftp.files
+ local.files
+ ssh.files
+ */
+ protected static List<String> APPROVED_FILE_SYSTEMS =
+ Arrays.asList(new String[]{ "ftp.files", "local.files", "ssh.files"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected IFileServiceSubSystem findFileTransferSubSystem(IHost host) {
+ ISubSystem[] systems = RSECorePlugin.getTheSystemRegistry().getSubSystems(host);
+ for( int i = 0; i < systems.length; i++ ) {
+ if( APPROVED_FILE_SYSTEMS.contains(systems[i].getConfigurationId()))
+ return (IFileServiceSubSystem)systems[i];
+ }
+ return null;
+ }
+
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java 2010-07-20 10:02:36 UTC (rev 23585)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.rse.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+
+public class SingleFileRSEPublisher implements IJBossServerPublisher {
+
+ private IDeployableServer server;
+ private RSEPublishMethod method;
+ private int publishState = IServer.PUBLISH_STATE_NONE;
+ public SingleFileRSEPublisher() {
+ }
+
+ public int getPublishState() {
+ return publishState;
+ }
+
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( RSEPublishMethod.RSE_ID.equals(method)
+ && module != null && module.length > 0
+ && module[module.length-1] != null
+ && module[module.length-1].getModuleType().getId().equals(SingleDeployableFactory.MODULE_TYPE))
+ return true;
+ return false;
+ }
+
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+
+ this.server = ServerConverter.getDeployableServer(server);
+ this.method = (RSEPublishMethod)method;
+ IModule module2 = module[0];
+
+ IStatus status = null;
+ if(publishType == REMOVE_PUBLISH){
+ status = unpublish(this.server, module2, monitor);
+ } else if( publishType == FULL_PUBLISH ){
+ // if there's no change, do nothing. Otherwise, on change or add, re-publish
+ status = publish(this.server, module2, true, monitor);
+ } else if( publishType == INCREMENTAL_PUBLISH ) {
+ status = publish(this.server, module2, false, monitor);
+ }
+ return status;
+
+ }
+ protected IPath findModuleFolderWithDefault(IModule module, IDeployableServer server, IPath startingPath) {
+ IModule[] moduleTree = new IModule[]{module};
+ String folder = PublishUtil.getDeployRootFolder(
+ moduleTree, server, startingPath.toString(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return PublishUtil.getDeployPath(moduleTree, folder).removeLastSegments(1);
+ }
+ protected IPath findDestinationFolder(IModule module, IDeployableServer server) {
+ return findModuleFolderWithDefault(module, server, method.getRemoteRootFolder());
+ }
+ protected IPath findTempDestinationFolder(IModule module, IDeployableServer server) {
+ return findModuleFolderWithDefault(module, server, method.getRemoteTemporaryFolder());
+ }
+
+ protected IStatus publish(IDeployableServer server, IModule module, boolean updateTimestamp, IProgressMonitor monitor) throws CoreException {
+ SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
+ if( delegate != null ) {
+ IPath sourcePath = delegate.getGlobalSourcePath();
+ IPath destFolder = findDestinationFolder(module, server);
+ IPath tempDestFolder = findTempDestinationFolder(module, server);
+ String name = sourcePath.lastSegment();
+
+ try {
+ method.getFileService().upload(sourcePath.toFile(), tempDestFolder.toString(), name, true, null, null, new NullProgressMonitor());
+ method.getFileService().move(tempDestFolder.toString(), name, destFolder.toString(), name, new NullProgressMonitor());
+ } catch( SystemMessageException sme ) {
+ // TODO fix
+ sme.printStackTrace();
+ }
+ // TODO log?
+// publishState = IServer.PUBLISH_STATE_FULL;
+// Exception e = l.e != null ? l.e : new Exception(
+// NLS.bind(Messages.CopyFileError, tempDestFile, destFile));
+// return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_PUBLISH_FAIL,
+// NLS.bind(Messages.CouldNotPublishModule, module.getName()), e);
+ }
+ Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
+ IEventCodes.SINGLE_FILE_PUBLISH_SUCCESS,
+ NLS.bind(Messages.ModulePublished,module.getName()), null);
+ return status;
+ }
+
+ protected IStatus unpublish(IDeployableServer server, IModule module, IProgressMonitor monitor) throws CoreException {
+ SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
+ if( delegate != null ) {
+ IPath sourcePath = delegate.getGlobalSourcePath();
+ IPath destFolder = findDestinationFolder(module, server);
+ String name = sourcePath.lastSegment();
+ try {
+ method.getFileService().delete(destFolder.toString(), name, new NullProgressMonitor());
+ } catch( SystemMessageException sme ) {
+ // TODO fix
+ sme.printStackTrace();
+ }
+ }
+ Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_SUCCESS,
+ NLS.bind(Messages.ModuleDeleted, module.getName()), null);
+ return status;
+ }
+}
15 years, 9 months
JBoss Tools SVN: r23584 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-07-20 06:02:23 -0400 (Tue, 20 Jul 2010)
New Revision: 23584
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
Log:
https://jira.jboss.org/browse/JBIDE-3315
Remove exporter's properties with the exporter.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2010-07-20 10:00:57 UTC (rev 23583)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2010-07-20 10:02:23 UTC (rev 23584)
@@ -190,7 +190,7 @@
for (String deleted : deletedExporterIds) {
configuration.setAttribute( getLaunchAttributePrefix( deleted ), (String)null);
configuration.setAttribute(getLaunchAttributePrefix(deleted ) + ".extension_id", (String)null); //$NON-NLS-1$
- configuration.setAttribute(getLaunchAttributePrefix(deleted), (String)null);
+ configuration.setAttribute(getLaunchAttributePrefix(deleted) + ".properties", (String)null); //$NON-NLS-1$
}
configuration.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, names);
15 years, 9 months
JBoss Tools SVN: r23583 - in workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules: rse and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-20 06:00:57 -0400 (Tue, 20 Jul 2010)
New Revision: 23583
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
Log:
RSE - not sure why this wasn't added
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20 10:00:57 UTC (rev 23583)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * TODO: Logging and Progress Monitors
+ ******************************************************************************/
+package org.jboss.ide.eclipse.archives.webtools.modules.rse;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.LocalCopyCallback;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.rse.core.AbstractJSTPublisher;
+import org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod;
+
+public class RSEZippedJSTPublisher extends AbstractJSTPublisher {
+
+ private RSEPublishMethod method;
+
+ @Override
+ protected String getTargetedPublishMethodId() {
+ return RSEPublishMethod.RSE_ID;
+ }
+
+ @Override
+ protected boolean zipSettingsMatch() {
+ // TODO handle this
+ return true;
+ }
+
+ @Override
+ public IStatus publishModule(IJBossServerPublishMethod method,
+ IServer server, IModule[] module, int publishType,
+ IModuleResourceDelta[] delta, IProgressMonitor monitor)
+ throws CoreException {
+ this.method = (RSEPublishMethod)method;
+ return super.publishModule(method, server, module, publishType, delta, monitor);
+ }
+
+ @Override
+ protected IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
+ String folder = PublishUtil.getDeployRootFolder(
+ moduleTree, server,
+ method.getRemoteRootFolder().toString(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return PublishUtil.getDeployPath(moduleTree, folder);
+ }
+
+ @Override
+ protected IPublishCopyCallbackHandler getCallbackHandler(IPath path, IServer server,
+ IJBossServerPublishMethod method) {
+ IPath tempRoot = JBossServerCorePlugin.getServerStateLocation(server)
+ .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+ IPath remoteRoot = JBossServerCorePlugin.getServerStateLocation(server)
+ .append(IJBossServerConstants.TEMP_REMOTE_DEPLOY).makeAbsolute();
+ return new LocalCopyCallback(server, remoteRoot, tempRoot);
+ }
+
+ protected class RSERemotePublishHandler implements IPublishCopyCallbackHandler {
+ public IPath root;
+ private ArrayList<IPath> createdFolders = new ArrayList<IPath>();
+ public RSERemotePublishHandler(IPath path) {
+ this.root = path;
+ }
+ public IStatus[] copyFile(IModuleFile mf, IPath path,
+ IProgressMonitor monitor) throws CoreException {
+ File file = PublishUtil.getFile(mf);
+ IPath remotePath = root.append(path);
+ try {
+ method.getFileService().upload(file, remotePath.removeLastSegments(1).toString(),
+ remotePath.lastSegment(), true, null, null, monitor);
+ } catch( SystemMessageException sme ) {
+ System.err.println("failed to copy to " + remotePath.toString()); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public IStatus[] deleteResource(IPath path, IProgressMonitor monitor)
+ throws CoreException {
+ IPath remotePath = root.append(path);
+ try {
+ method.getFileService().delete(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), monitor);
+ } catch( SystemMessageException sme ) {
+ System.err.println("failed to delete " + remotePath.toString()); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public IStatus[] makeDirectoryIfRequired(IPath dir,
+ IProgressMonitor monitor) throws CoreException {
+ if( dir.segmentCount() > 0 )
+ makeDirectoryIfRequired(dir.removeLastSegments(1), monitor);
+ IPath toMake = root.append(dir);
+ if( createdFolders.contains(toMake))
+ return new IStatus[]{Status.OK_STATUS};
+ try {
+ method.getFileService().createFolder(toMake.removeLastSegments(1).toString(), toMake.lastSegment(), monitor);
+ } catch( SystemMessageException sme ) {
+ System.err.println("failed to make folder " + toMake.toString()); //$NON-NLS-1$
+ }
+ createdFolders.add(toMake);
+ return null;
+ }
+ }
+
+ @Override
+ protected void finishPublish(int publishType, IModule[] moduleTree,
+ IDeployableServer server, IProgressMonitor monitor) {
+ // do nothing
+ }
+}
15 years, 9 months
JBoss Tools SVN: r23582 - in workspace/rstryker/rse/as/plugins: org.jboss.ide.eclipse.as.core and 13 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-20 05:55:16 -0400 (Tue, 20 Jul 2010)
New Revision: 23582
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
Removed:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishMethod.exsd
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
trying to update rse branch
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF 2010-07-20 09:55:16 UTC (rev 23582)
@@ -27,7 +27,10 @@
org.jboss.ide.eclipse.as.wtp.core,
org.jboss.ide.eclipse.as.wtp.ui,
org.eclipse.emf.common;bundle-version="2.5.0",
- org.eclipse.emf.ecore;bundle-version="2.5.0"
+ org.eclipse.emf.ecore;bundle-version="2.5.0",
+ org.eclipse.rse.core;bundle-version="3.1.100";resolution:=optional,
+ org.eclipse.rse.subsystems.files.core;bundle-version="3.2.0";resolution:=optional,
+ org.eclipse.rse.services;bundle-version="3.2.0";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.ide.eclipse.archives.webtools,
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2010-07-20 09:55:16 UTC (rev 23582)
@@ -22,7 +22,13 @@
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.common.frameworks,
org.eclipse.jst.jee,
- org.eclipse.core.commands
+ org.eclipse.core.commands,
+ org.eclipse.rse.core;bundle-version="3.1.100",
+ org.eclipse.rse.subsystems.files.core;bundle-version="3.2.0",
+ org.eclipse.rse.services;bundle-version="3.2.0",
+ org.eclipse.rse.services.files.ftp;bundle-version="3.0.200",
+ org.eclipse.rse.services.local;bundle-version="2.1.200",
+ org.eclipse.rse.services.ssh;bundle-version="3.0.1"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.core,
org.jboss.ide.eclipse.as.core.extensions.descriptors,
@@ -35,7 +41,8 @@
org.jboss.ide.eclipse.as.core.server.internal,
org.jboss.ide.eclipse.as.core.server.internal.launch,
org.jboss.ide.eclipse.as.core.server.xpl,
- org.jboss.ide.eclipse.as.core.util
+ org.jboss.ide.eclipse.as.core.util,
+ org.jboss.ide.eclipse.as.rse.core
Bundle-ClassPath: dom4j-1.6.1.jar,
jaxen-1.1-beta-6.jar,
getopt.jar,
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -11,6 +11,7 @@
package org.jboss.ide.eclipse.as.core;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -24,9 +25,11 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.IPollerFailureHandler;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
/**
@@ -214,4 +217,40 @@
return publisher;
}
}
+
+ private ServerPublishMethodType[] publishMethodTypes;
+ public ServerPublishMethodType[] getPublishMethodTypes() {
+ if(publishMethodTypes == null )
+ publishMethodTypes = loadPublishMethodTypes();
+ return publishMethodTypes;
+ }
+
+ public ServerPublishMethodType[] loadPublishMethodTypes() {
+ ArrayList<ServerPublishMethodType> types = new ArrayList<ServerPublishMethodType>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(JBossServerCorePlugin.PLUGIN_ID, "publishMethod"); //$NON-NLS-1$
+ for( int i = 0; i < cf.length; i++ ) {
+ types.add(new ServerPublishMethodType(cf[i]));
+ }
+ return types.toArray(new ServerPublishMethodType[types.size()]);
+ }
+
+ public IJBossServerPublishMethodType getPublishMethod(String id) {
+ ServerPublishMethodType[] publishMethods = getPublishMethodTypes();
+ for( int i = 0; i < publishMethods.length; i++ )
+ if( publishMethods[i].getId().equals(id))
+ return publishMethods[i];
+ return null;
+ }
+
+ public IJBossServerPublishMethodType[] findPossiblePublishMethods(IServer server) {
+ ArrayList<IJBossServerPublishMethodType> list = new ArrayList<IJBossServerPublishMethodType>();
+ list.addAll(Arrays.asList(getPublishMethodTypes()));
+ Iterator<IJBossServerPublishMethodType> i = list.iterator();
+ while(i.hasNext()) {
+ if( !i.next().accepts(server.getServerType().getId()))
+ i.remove();
+ }
+ return list.toArray(new IJBossServerPublishMethodType[list.size()]);
+ }
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1,90 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.core.publishers;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
-import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
-public class LocalPublishMethod implements IJBossServerPublishMethod {
+public class LocalPublishMethod extends AbstractPublishMethod {
public static final String LOCAL_PUBLISH_METHOD = "local"; //$NON-NLS-1$
-
+
+ @Override
public String getPublishMethodId() {
return LOCAL_PUBLISH_METHOD;
}
-
- public boolean accepts(String methodType) {
- return getPublishMethodId().equals(methodType);
- }
-
- public void publishStart(DeployableServerBehavior behaviour,
- IProgressMonitor monitor) throws CoreException {
- }
-
- public int publishFinish(DeployableServerBehavior behaviour,
- IProgressMonitor monitor) throws CoreException {
- IModule[] modules = behaviour.getServer().getModules();
- boolean allpublished= true;
- for (int i = 0; i < modules.length; i++) {
- if(behaviour.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
- allpublished=false;
- }
- return allpublished ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;
- }
-
- public int getServerPublishState(DeployableServerBehavior behaviour) {
- IModule[] modules = behaviour.getServer().getModules();
- boolean allpublished= true;
- for (int i = 0; i < modules.length; i++) {
- if(behaviour.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
- allpublished=false;
- }
- if(allpublished)
- return IServer.PUBLISH_STATE_NONE;
- return IServer.PUBLISH_STATE_INCREMENTAL;
- }
-
- public int publishModule(DeployableServerBehavior behaviour, int kind,
- int deltaKind, IModule[] module, IProgressMonitor monitor)
- throws CoreException {
- // kind = [incremental, full, auto, clean] = [1,2,3,4]
- // delta = [no_change, added, changed, removed] = [0,1,2,3]
- if( module.length == 0 ) return IServer.PUBLISH_STATE_NONE;
- int modulePublishState = behaviour.getServer().getModulePublishState(module);
- int publishType = behaviour.getPublishType(kind, deltaKind, modulePublishState);
- IJBossServerPublisher publisher;
-
- // Let the publisher decide what to do
- if( module.length > 0 ) {
- publisher = ExtensionManager.getDefault().getPublisher(behaviour.getServer(), module, getPublishMethodId());
- IModuleResourceDelta[] deltas = new IModuleResourceDelta[]{};
- if( deltaKind != ServerBehaviourDelegate.REMOVED)
- deltas = behaviour.getPublishedResourceDelta(module);
- if( publisher != null ) {
- try {
- IStatus result = publisher.publishModule(
- this,
- behaviour.getServer(), module,
- publishType, deltas, monitor);
- if( result != null )
- ServerLogger.getDefault().log(behaviour.getServer(), result);
- } catch( CoreException ce) {
- // Let the user know
- ServerLogger.getDefault().log(behaviour.getServer(), ce.getStatus());
- throw ce;
- }
- return publisher.getPublishState();
- }
- return IServer.PUBLISH_STATE_INCREMENTAL;
- }
- return IServer.PUBLISH_STATE_NONE;
- }
-
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -80,12 +80,18 @@
return count;
}
+
public static String getDeployRootFolder(IModule[] moduleTree,
IDeployableServer server, String defaultFolder, String moduleProperty) {
+ return getDeployRootFolder(moduleTree, LocalPublishMethod.LOCAL_PUBLISH_METHOD, server, defaultFolder, moduleProperty);
+ }
+
+ public static String getDeployRootFolder(IModule[] moduleTree, String publishMethod,
+ IDeployableServer server, String defaultFolder, String moduleProperty) {
String folder = defaultFolder;
// TODO bug 286699
DeploymentPreferences prefs = DeploymentPreferenceLoader.loadPreferencesFromServer(server.getServer());
- DeploymentTypePrefs typePrefs = prefs.getOrCreatePreferences("local"); //$NON-NLS-1$
+ DeploymentTypePrefs typePrefs = prefs.getOrCreatePreferences(publishMethod);
DeploymentModulePrefs modPrefs = typePrefs.getModulePrefs(moduleTree[0]);
if( modPrefs != null ) {
String loc = modPrefs.getProperty(moduleProperty);
@@ -234,18 +240,23 @@
* Just package into a jar raw. Don't think about it, just do it
*/
public static IStatus[] packModuleIntoJar(IModule module, IPath destination)throws CoreException {
+ ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
+ IModuleResource[] resources = pm.members();
+ return packModuleIntoJar(module.getName(), resources, destination);
+ }
+
+ public static IStatus[] packModuleIntoJar(String moduleName, IModuleResource[] resources, IPath destination)throws CoreException {
+
String dest = destination.toString();
ModulePackager packager = null;
try {
packager = new ModulePackager(dest, false);
- ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
- IModuleResource[] resources = pm.members();
for (int i = 0; i < resources.length; i++) {
doPackModule(resources[i], packager);
}
} catch (IOException e) {
IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_ASSEMBLE_FAIL,
- "unable to assemble module " + module.getName(), e); //$NON-NLS-1$
+ "unable to assemble module " + moduleName, e); //$NON-NLS-1$
return new IStatus[]{status};
}
finally{
@@ -255,7 +266,7 @@
}
catch(IOException e){
IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_ASSEMBLE_FAIL,
- "unable to assemble module "+ module.getName(), e); //$NON-NLS-1$
+ "unable to assemble module "+ moduleName, e); //$NON-NLS-1$
return new IStatus[]{status};
}
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.core.server;
import org.eclipse.core.runtime.CoreException;
@@ -3,9 +13,9 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
public interface IJBossServerPublishMethod {
- public String getPublishMethodId();
- public boolean accepts(String methodType);
+ public IJBossServerPublishMethodType getPublishMethodType();
public void publishStart(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
public int publishFinish(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -26,8 +26,10 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.internal.launch.DeployableLaunchConfiguration;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
public class DeployableServerBehavior extends ServerBehaviourDelegate {
@@ -73,8 +75,11 @@
*
* @return
*/
- protected IJBossServerPublishMethod createPublishMethod() {
- return new LocalPublishMethod(); // TODO FIX THIS
+ public IJBossServerPublishMethod createPublishMethod() {
+ IJBossServerPublishMethodType type = DeploymentPreferenceLoader.getCurrentDeploymentMethodType(getServer());
+ if( type != null )
+ return type.createPublishMethod();
+ return new LocalPublishMethod(); // sensible default
}
public IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) {
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -563,7 +563,7 @@
IModuleFile mf = (IModuleFile) resource;
path = path.append(mf.getModuleRelativePath()).append(name);
IStatus[] stats = handler.makeDirectoryIfRequired(path.removeLastSegments(1), monitor);
- if( stats.length > 0 && !stats[0].isOK())
+ if( stats != null && stats.length > 0 && !stats[0].isOK())
addArrayToList(status, stats);
addArrayToList(status, handler.copyFile(mf, path, monitor));
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.core.util;
import java.io.ByteArrayInputStream;
@@ -13,12 +23,24 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.internal.Server;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.tools.jmx.core.IMemento;
import org.jboss.tools.jmx.core.util.XMLMemento;
public class DeploymentPreferenceLoader {
public static final String DEPLOYMENT_PREFERENCES_KEY = "org.jboss.ide.eclipse.as.core.util.deploymentPreferenceKey"; //$NON-NLS-1$
+ public static final String CURRENT_METHOD_PROPERTY = "publishMethod"; //$NON-NLS-1$
+ public static IJBossServerPublishMethodType getCurrentDeploymentMethodType(IServer server) {
+ DeploymentPreferences prefs = DeploymentPreferenceLoader.loadPreferencesFromServer(server);
+ String type = prefs.getProperty(DeploymentPreferenceLoader.CURRENT_METHOD_PROPERTY);
+ if( type != null ) {
+ return ExtensionManager.getDefault().getPublishMethod(type);
+ }
+ return null;
+ }
+
public static DeploymentPreferences loadPreferencesFromFile(IServer server) {
File f = getFile(server);
InputStream is = null;
@@ -92,6 +114,30 @@
protected XMLMemento getMemento() {
return memento;
}
+ public String getProperty(String key) {
+ IMemento[] children = memento.getChildren("property"); //$NON-NLS-1$
+ for( int i = 0; i < children.length; i++ ) {
+ if( key.equals(children[i].getString("key"))) { //$NON-NLS-1$
+ return children[i].getString("value"); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ public void setProperty(String key, String val) {
+ IMemento[] children = memento.getChildren("property"); //$NON-NLS-1$
+ for( int i = 0; i < children.length; i++ ) {
+ if( key.equals(children[i].getString("key"))) { //$NON-NLS-1$
+ children[i].putString("key", key); //$NON-NLS-1$
+ children[i].putString("value", val);//$NON-NLS-1$
+ return;
+ }
+ }
+ // not found
+ IMemento child = memento.createChild("property"); //$NON-NLS-1$
+ child.putString("key", key);//$NON-NLS-1$
+ child.putString("value", val);//$NON-NLS-1$
+ }
}
public static class DeploymentTypePrefs {
@@ -107,7 +153,6 @@
String id = mementos[i].getString("id"); //$NON-NLS-1$
this.children.put(id, new DeploymentModulePrefs(id, mementos[i]));
}
- // TODO properties?
}
public DeploymentModulePrefs getModulePrefs(IModule module) {
@@ -123,6 +168,31 @@
}
return children.get(module.getId());
}
+
+ public String getProperty(String key) {
+ IMemento[] children = memento.getChildren("property"); //$NON-NLS-1$
+ for( int i = 0; i < children.length; i++ ) {
+ if( key.equals(children[i].getString("key"))) { //$NON-NLS-1$
+ return children[i].getString("value"); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ public void setProperty(String key, String val) {
+ IMemento[] children = memento.getChildren("property"); //$NON-NLS-1$
+ for( int i = 0; i < children.length; i++ ) {
+ if( key.equals(children[i].getString("key"))) { //$NON-NLS-1$
+ children[i].putString("key", key); //$NON-NLS-1$
+ children[i].putString("value", val);//$NON-NLS-1$
+ return;
+ }
+ }
+ // not found
+ IMemento child = memento.createChild("property"); //$NON-NLS-1$
+ child.putString("key", key);//$NON-NLS-1$
+ child.putString("value", val);//$NON-NLS-1$
+ }
}
public static class DeploymentModulePrefs {
private String id;
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -48,6 +48,7 @@
/* Files or folders inside the TOOLING */
public static final String LOG = "log"; //$NON-NLS-1$
public static final String TEMP_DEPLOY = "tempDeploy"; //$NON-NLS-1$
+ public static final String TEMP_REMOTE_DEPLOY = "tempRemoteDeploy"; //$NON-NLS-1$
public static final String JBOSSTOOLS_TMP = "jbosstoolsTemp"; //$NON-NLS-1$
public static final String TMP = "tmp"; //$NON-NLS-1$
public static final String CONFIG_IN_METADATA = "jbossConfig"; //$NON-NLS-1$
@@ -72,7 +73,6 @@
/*
* Property keys stored in the server object
*/
- public static final String DEPLOYMENT_METHOD = "org.jboss.ide.eclipse.as.core.server.attributes.deploymentMethod"; //$NON-NLS-1$
public static final String STARTUP_POLLER_KEY = "org.jboss.ide.eclipse.as.core.server.attributes.startupPollerKey"; //$NON-NLS-1$
public static final String SHUTDOWN_POLLER_KEY = "org.jboss.ide.eclipse.as.core.server.attributes.shutdownPollerKey"; //$NON-NLS-1$
public static final String SERVER_USERNAME = "org.jboss.ide.eclipse.as.core.server.userName"; //$NON-NLS-1$
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties 2010-07-20 09:55:16 UTC (rev 23582)
@@ -43,4 +43,9 @@
deploy.server.description=A server which only provides a deploy folder for publishing.
Bundle-Vendor.0 = JBoss by Red Hat
-Bundle-Name.0 = JBoss AS Core Plug-in
\ No newline at end of file
+Bundle-Name.0 = JBoss AS Core Plug-in
+
+AllJBossRuntimeTypes=org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.60,org.jboss.ide.eclipse.as.runtime.eap.43,org.jboss.ide.eclipse.as.runtime.eap.50
+AllJBossServerTypes=org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.60,org.jboss.ide.eclipse.as.eap.43,org.jboss.ide.eclipse.as.eap.50
+AllJBTServerTypes=org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.60,org.jboss.ide.eclipse.as.eap.43,org.jboss.ide.eclipse.as.eap.50,org.jboss.ide.eclipse.as.systemCopyServer
+ServerTypesJBoss6OrHigher=org.jboss.ide.eclipse.as.60
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1038,4 +1038,36 @@
supportsArgument="true">
</variable>
</extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.core.publishMethod">
+ <publishMethod
+ id="local"
+ name="Local"
+ class="org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod"
+ serverTypes="%AllJBTServerTypes">
+ </publishMethod>
+ </extension>
+
+
+ <!-- Below here is RSE stuff which can / should be moved if a new plugin is created -->
+ <extension
+ point="org.jboss.ide.eclipse.as.core.publishMethod">
+ <publishMethod
+ class="org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod"
+ id="rse"
+ name="Remote System Deployment"
+ serverTypes="%AllJBTServerTypes">
+ </publishMethod>
+ </extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.core.publishers">
+ <publisher
+ class="org.jboss.ide.eclipse.as.rse.core.SingleFileRSEPublisher"
+ priority="7">
+ </publisher>
+ <publisher
+ class="org.jboss.ide.eclipse.as.rse.core.RSEJSTPublisher"
+ priority="5">
+ </publisher>
+ </extension>
</plugin>
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishMethod.exsd
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishMethod.exsd 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishMethod.exsd 2010-07-20 09:55:16 UTC (rev 23582)
@@ -49,6 +49,20 @@
<element name="publishMethod">
<complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ String representation of this publish method
+ </documentation>
+ </annotation>
+ </attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
@@ -59,6 +73,13 @@
</appInfo>
</annotation>
</attribute>
+ <attribute name="serverTypes" type="string" use="required">
+ <annotation>
+ <documentation>
+ A list of comma-separated server types this publish method is available to.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2010-07-20 09:55:16 UTC (rev 23582)
@@ -112,5 +112,14 @@
typeIds="org.jboss.ide.eclipse.as.ssh.server.remoteServerType">
</fragment>
</extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.core.publishMethod">
+ <publishMethod
+ class="org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate$SSHPublishMethod"
+ id="ssh"
+ name="SSH Remote Deployment"
+ serverTypes="org.jboss.ide.eclipse.as.ssh.server.remoteServerType">
+ </publishMethod>
+ </extension>
</plugin>
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -16,8 +16,10 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
@@ -37,24 +39,22 @@
setServerState(IServer.STATE_STOPPED);
}
- protected IJBossServerPublishMethod createPublishMethod() {
+ @Override
+ public IJBossServerPublishMethod createPublishMethod() {
return new SSHPublishMethod(); // TODO FIX THIS in superclass
}
public class SSHPublishMethod extends LocalPublishMethod {
public static final String SSH_PUBLISH_METHOD = "ssh"; //$NON-NLS-1$
-
- @Override
- public String getPublishMethodId() {
- return SSH_PUBLISH_METHOD;
- }
-
private Session session;
public Session getSession() {
return session;
}
-
@Override
+ public IJBossServerPublishMethodType getPublishMethodType() {
+ return ExtensionManager.getDefault().getPublishMethod(SSH_PUBLISH_METHOD);
+ }
+ @Override
public void publishStart(DeployableServerBehavior behaviour,
IProgressMonitor monitor) throws CoreException {
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2010-07-20 09:55:16 UTC (rev 23582)
@@ -52,7 +52,8 @@
org.eclipse.ui.views.log,
org.jboss.tools.jmx.ui,
org.jboss.tools.jmx.core,
- org.eclipse.jst.j2ee.core
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.rse.ui;bundle-version="3.1.100"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.ui,
org.jboss.ide.eclipse.as.ui.dialogs,
Copied: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java (from rev 23242, trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java)
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -0,0 +1,705 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+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.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+public class DeploymentModuleOptionCompositeAssistant {
+ private ModuleDeploymentPage page;
+ private DeploymentPreferences preferences;
+ private TreeViewer viewer;
+ protected String COLUMN_NAME;
+ protected String COLUMN_LOC;
+ protected String COLUMN_TEMP_LOC;
+ protected String currentDeployType;
+
+ public DeploymentModuleOptionCompositeAssistant() {
+ COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
+ COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
+ COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
+ currentDeployType = LocalPublishMethod.LOCAL_PUBLISH_METHOD;
+ }
+
+ public String getCurrentDeployType() {
+ return currentDeployType;
+ }
+
+ public void setCurrentDeployType(String type) {
+ this.currentDeployType = type;
+ }
+
+ public void setDeploymentPage(ModuleDeploymentPage page) {
+ this.page = page;
+ }
+
+ public void setDeploymentPrefs(DeploymentPreferences prefs) {
+ this.preferences = prefs;
+ }
+
+ protected ServerAttributeHelper getHelper() {
+ return page.getHelper();
+ }
+
+ private Text deployText, tempDeployText;
+ private Button metadataRadio, serverRadio, customRadio, currentSelection;
+ private Button deployButton, tempDeployButton;
+ private ModifyListener deployListener, tempDeployListener;
+ private SelectionListener radioListener, zipListener;
+ private Button zipDeployWTPProjects;
+ private String lastCustomDeploy, lastCustomTemp;
+
+ protected Composite createDefaultComposite(Composite parent) {
+
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR);
+ section.setText(Messages.swf_DeployEditorHeading);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new FormLayout());
+
+ Label descriptionLabel = toolkit.createLabel(composite,
+ Messages.swf_DeploymentDescription);
+ Control top = descriptionLabel;
+ Composite inner = toolkit.createComposite(composite);
+ inner.setLayout(new GridLayout(1, false));
+
+ IRuntime rt = getServer().getServer().getRuntime();
+ boolean showRadios = true;
+ if( rt == null )
+ showRadios = false;
+ else {
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ if( jbsrt == null )
+ showRadios = false;
+ }
+
+ if( showRadios ) {
+ metadataRadio = toolkit.createButton(inner,
+ Messages.EditorUseWorkspaceMetadata, SWT.RADIO);
+ serverRadio = toolkit.createButton(inner,
+ Messages.EditorUseServersDeployFolder, SWT.RADIO);
+ customRadio = toolkit.createButton(inner,
+ Messages.EditorUseCustomDeployFolder, SWT.RADIO);
+
+ metadataRadio.setSelection(getDeployType().equals(
+ IDeployableServer.DEPLOY_METADATA));
+ serverRadio.setSelection(getDeployType().equals(
+ IDeployableServer.DEPLOY_SERVER));
+ customRadio.setSelection(getDeployType().equals(
+ IDeployableServer.DEPLOY_CUSTOM));
+ currentSelection = metadataRadio.getSelection() ? metadataRadio
+ : serverRadio.getSelection() ? serverRadio : customRadio;
+
+ radioListener = new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource() == currentSelection)
+ return; // do nothing
+ page.execute(new RadioClickedCommand((Button) e.getSource(),
+ currentSelection));
+ currentSelection = (Button) e.getSource();
+ }
+ };
+ metadataRadio.addSelectionListener(radioListener);
+ serverRadio.addSelectionListener(radioListener);
+ customRadio.addSelectionListener(radioListener);
+ }
+
+ FormData radios = new FormData();
+ radios.top = new FormAttachment(descriptionLabel, 5);
+ radios.left = new FormAttachment(0, 5);
+ radios.right = new FormAttachment(100, -5);
+ inner.setLayoutData(radios);
+ top = inner;
+
+ Label label = toolkit.createLabel(composite,
+ Messages.swf_DeployDirectory);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ deployText = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
+ deployListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetDeployDirCommand());
+ }
+ };
+ deployText.addModifyListener(deployListener);
+
+ deployButton = toolkit.createButton(composite, Messages.browse,
+ SWT.PUSH);
+ deployButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog d = new DirectoryDialog(new Shell());
+ d.setFilterPath(page.makeGlobal(deployText.getText()));
+ String x = d.open();
+ if (x != null) {
+ deployText.setText(page.makeRelative(x));
+ }
+ }
+ });
+
+ Label tempDeployLabel = toolkit.createLabel(composite,
+ Messages.swf_TempDeployDirectory);
+ tempDeployLabel.setForeground(toolkit.getColors().getColor(
+ IFormColors.TITLE));
+
+ tempDeployText = toolkit.createText(composite, getTempDeployDir(),
+ SWT.BORDER);
+ tempDeployListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetTempDeployDirCommand());
+ }
+ };
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ tempDeployButton = toolkit.createButton(composite, Messages.browse,
+ SWT.PUSH);
+ tempDeployButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog d = new DirectoryDialog(new Shell());
+ d.setFilterPath(page.makeGlobal(tempDeployText.getText()));
+ String x = d.open();
+ if (x != null)
+ tempDeployText.setText(page.makeRelative(x));
+ }
+ });
+
+ deployText
+ .setEnabled(customRadio == null || customRadio.getSelection());
+ tempDeployText.setEnabled(customRadio == null
+ || customRadio.getSelection());
+
+ FormData descriptionLabelData = new FormData();
+ descriptionLabelData.left = new FormAttachment(0, 5);
+ descriptionLabelData.top = new FormAttachment(0, 5);
+ descriptionLabel.setLayoutData(descriptionLabelData);
+
+ // first row
+ FormData labelData = new FormData();
+ labelData.left = new FormAttachment(0, 5);
+ labelData.right = new FormAttachment(deployText, -5);
+ labelData.top = new FormAttachment(top, 5);
+ label.setLayoutData(labelData);
+
+ FormData textData = new FormData();
+ textData.left = new FormAttachment(deployButton, -305);
+ textData.top = new FormAttachment(top, 5);
+ textData.right = new FormAttachment(deployButton, -5);
+ deployText.setLayoutData(textData);
+
+ FormData buttonData = new FormData();
+ buttonData.right = new FormAttachment(100, -5);
+ buttonData.left = new FormAttachment(100, -100);
+ buttonData.top = new FormAttachment(top, 2);
+ deployButton.setLayoutData(buttonData);
+
+ // second row
+ FormData tempLabelData = new FormData();
+ tempLabelData.left = new FormAttachment(0, 5);
+ tempLabelData.right = new FormAttachment(deployText, -5);
+ tempLabelData.top = new FormAttachment(deployText, 5);
+ tempDeployLabel.setLayoutData(tempLabelData);
+
+ FormData tempTextData = new FormData();
+ tempTextData.left = new FormAttachment(tempDeployButton, -305);
+ tempTextData.top = new FormAttachment(deployText, 5);
+ tempTextData.right = new FormAttachment(tempDeployButton, -5);
+ tempDeployText.setLayoutData(tempTextData);
+
+ FormData tempButtonData = new FormData();
+ tempButtonData.right = new FormAttachment(100, -5);
+ tempButtonData.left = new FormAttachment(100, -100);
+ tempButtonData.top = new FormAttachment(deployText, 5);
+ tempDeployButton.setLayoutData(tempButtonData);
+
+ zipDeployWTPProjects = toolkit.createButton(composite,
+ Messages.EditorZipDeployments, SWT.CHECK);
+ boolean zippedPublisherAvailable = isLocalZippedPublisherAvailable();
+ boolean value = getServer().zipsWTPDeployments();
+ zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
+ zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
+
+ FormData zipButtonData = new FormData();
+ zipButtonData.right = new FormAttachment(100, -5);
+ zipButtonData.left = new FormAttachment(0, 5);
+ zipButtonData.top = new FormAttachment(tempDeployText, 5);
+ zipDeployWTPProjects.setLayoutData(zipButtonData);
+
+ zipListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ page.execute(new SetZipCommand());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ };
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ page.getSaveStatus();
+ return section;
+ }
+
+ protected boolean isLocalZippedPublisherAvailable() {
+ IJBossServerPublisher[] publishers =
+ ExtensionManager.getDefault().getZippedPublishers();
+ for( int i = 0; i < publishers.length; i++ ) {
+ if( publishers[i].accepts(LocalPublishMethod.LOCAL_PUBLISH_METHOD, getServer().getServer(), null))
+ return true;
+ }
+ return false;
+ }
+
+ public class SetDeployDirCommand extends ServerCommand {
+ private String oldDir;
+ private String newDir;
+ private Text text;
+ private ModifyListener listener;
+ public SetDeployDirCommand() {
+ super(page.getServer(), Messages.EditorSetDeployLabel);
+ this.text = deployText;
+ this.newDir = deployText.getText();
+ this.listener = deployListener;
+ this.oldDir = getHelper().getAttribute(IDeployableServer.DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
+ }
+ public void execute() {
+ getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
+ lastCustomDeploy = newDir;
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
+ text.setText(oldDir);
+ text.addModifyListener(listener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class SetZipCommand extends ServerCommand {
+ boolean oldVal;
+ boolean newVal;
+ public SetZipCommand() {
+ super(page.getServer(), Messages.EditorZipDeployments);
+ oldVal = getHelper().getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
+ newVal = zipDeployWTPProjects.getSelection();
+ }
+ public void execute() {
+ getHelper().setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ zipDeployWTPProjects.removeSelectionListener(zipListener);
+ zipDeployWTPProjects.setSelection(oldVal);
+ getHelper().setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, oldVal);
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class SetTempDeployDirCommand extends ServerCommand {
+ private String oldDir;
+ private String newDir;
+ private Text text;
+ private ModifyListener listener;
+ public SetTempDeployDirCommand() {
+ super(page.getServer(), Messages.EditorSetTempDeployLabel);
+ text = tempDeployText;
+ newDir = tempDeployText.getText();
+ listener = tempDeployListener;
+ oldDir = getHelper().getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
+ }
+ public void execute() {
+ getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newDir);
+ lastCustomTemp = newDir;
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldDir);
+ text.setText(oldDir);
+ text.addModifyListener(listener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class RadioClickedCommand extends ServerCommand {
+ private Button newSelection, oldSelection;
+ private String oldDir, newDir;
+ private String oldTemp, newTemp;
+ private String id;
+ public RadioClickedCommand(Button clicked, Button previous) {
+ super(page.getServer(), Messages.EditorSetRadioClicked);
+ newSelection = clicked;
+ oldSelection = previous;
+ id = server.getId();
+ }
+ public void execute() {
+ boolean custom = newSelection == customRadio;
+ deployText.setEnabled(custom);
+ tempDeployText.setEnabled(custom);
+ deployButton.setEnabled(custom);
+ tempDeployButton.setEnabled(custom);
+ oldDir = deployText.getText();
+ oldTemp = tempDeployText.getText();
+
+ String type = null;
+ String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
+ oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
+ IDeployableServer.DEPLOY_METADATA;
+
+ if( newSelection == metadataRadio ) {
+ newDir = JBossServerCorePlugin.getServerStateLocation(id)
+ .append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
+ newTemp = JBossServerCorePlugin.getServerStateLocation(id)
+ .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
+ type = IDeployableServer.DEPLOY_METADATA;
+ new File(newDir).mkdirs();
+ new File(newTemp).mkdirs();
+ } else if( newSelection == serverRadio ) {
+ IRuntime rt = server.getRuntime();
+ if( rt != null ) {
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ if( jbsrt != null ) {
+ String loc = jbsrt.getConfigLocation();
+ String config = jbsrt.getJBossConfiguration();
+ newDir = new Path(loc)
+ .append(config)
+ .append(IJBossServerConstants.DEPLOY).toString();
+ newTemp = new Path(loc).append(config)
+ .append(IJBossServerConstants.TMP)
+ .append(IJBossServerConstants.JBOSSTOOLS_TMP).toString();
+ new File(newTemp).mkdirs();
+ type = IDeployableServer.DEPLOY_SERVER;
+ }
+ }
+ } else {
+ newDir = lastCustomDeploy;
+ newTemp = lastCustomTemp;
+ type = IDeployableServer.DEPLOY_CUSTOM;
+ }
+
+ if( !newSelection.getSelection() ) {
+ // REDO, so no one actually clicked the radio. UGH!
+ oldSelection.removeSelectionListener(radioListener);
+ oldSelection.setSelection(false);
+ oldSelection.addSelectionListener(radioListener);
+
+ newSelection.removeSelectionListener(radioListener);
+ newSelection.setSelection(true);
+ newSelection.addSelectionListener(radioListener);
+ }
+
+ type = type == null ? oldType : type;
+ newDir = newDir == null ? oldDir : newDir;
+ newTemp = newTemp == null ? oldTemp : newTemp;
+
+ deployText.removeModifyListener(deployListener);
+ getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
+ deployText.setText(newDir);
+ deployText.addModifyListener(deployListener);
+
+ tempDeployText.removeModifyListener(tempDeployListener);
+ getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newTemp);
+ tempDeployText.setText(newTemp);
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ deployText.removeModifyListener(deployListener);
+ getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
+ deployText.setText(oldDir);
+ deployText.addModifyListener(deployListener);
+
+ tempDeployText.removeModifyListener(tempDeployListener);
+ getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldTemp);
+ tempDeployText.setText(oldTemp);
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ oldSelection.removeSelectionListener(radioListener);
+ oldSelection.setSelection(true);
+ oldSelection.addSelectionListener(radioListener);
+
+ newSelection.removeSelectionListener(radioListener);
+ newSelection.setSelection(false);
+ newSelection.addSelectionListener(radioListener);
+
+ deployText.setEnabled(customRadio.getSelection());
+ tempDeployText.setEnabled(customRadio.getSelection());
+
+ String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
+ oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
+ IDeployableServer.DEPLOY_METADATA;
+ getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, oldType);
+ page.getSaveStatus();
+ }
+ }
+
+
+ private String getDeployType() {
+ return getServer().getDeployLocationType();
+ }
+
+ private String getDeployDir() {
+ return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
+ ModuleDeploymentPage.makeRelative(getServer().getDeployFolder(),
+ page.getServer().getRuntime());
+ }
+
+ private String getTempDeployDir() {
+ return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
+ ModuleDeploymentPage.makeRelative(getServer().getTempDeployFolder(),
+ page.getServer().getRuntime());
+ }
+
+ private IDeployableServer getServer() {
+ return (IDeployableServer) page.getServer().loadAdapter(
+ IDeployableServer.class, new NullProgressMonitor());
+ }
+/*
+ *
+ *
+ *
+ * This is where the second half goes
+ *
+ *
+ *
+ */
+ protected Composite createViewerPortion(Composite random) {
+ Composite root = new Composite(random, SWT.NONE);
+ root.setLayout(new FormLayout());
+
+ page.getFormToolkit(random).adapt(root);
+
+ viewer = new TreeViewer(root, SWT.BORDER);
+ viewer.getTree().setHeaderVisible(true);
+ viewer.getTree().setLinesVisible(true);
+ TreeColumn moduleColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ TreeColumn publishLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ TreeColumn publishTempLocColumn = new TreeColumn(viewer.getTree(),
+ SWT.NONE);
+ moduleColumn.setText(Messages.EditorModule);
+ publishLocColumn.setText(Messages.EditorSetDeployLabel);
+ publishTempLocColumn.setText(Messages.EditorSetTempDeployLabel);
+
+ moduleColumn.setWidth(200);
+ publishLocColumn.setWidth(200);
+ publishTempLocColumn.setWidth(200);
+
+ FormData treeData = new FormData();
+ treeData.top = new FormAttachment(0, 5);
+ treeData.bottom = new FormAttachment(100, -5);
+ treeData.left = new FormAttachment(0, 5);
+ treeData.right = new FormAttachment(100, -5);
+ viewer.getTree().setLayoutData(treeData);
+ viewer.setContentProvider(new ModulePageContentProvider());
+
+ viewer.setLabelProvider(new ModulePageLabelProvider());
+ viewer.setColumnProperties(new String[] { COLUMN_NAME,
+ COLUMN_LOC, COLUMN_TEMP_LOC });
+ viewer.setInput(""); // irrelevent
+ CellEditor[] editors = new CellEditor[] {
+ new TextCellEditor(viewer.getTree()),
+ new TextCellEditor(viewer.getTree()),
+ new TextCellEditor(viewer.getTree()) };
+ viewer.setCellModifier(new LocalDeploymentCellModifier());
+ viewer.setCellEditors(editors);
+
+ return root;
+ }
+
+ private class LocalDeploymentCellModifier implements ICellModifier {
+ public boolean canModify(Object element, String property) {
+ if( property == COLUMN_NAME)
+ return false;
+ return true;
+ }
+
+ public Object getValue(Object element, String property) {
+ DeploymentModulePrefs p = preferences.getOrCreatePreferences(currentDeployType)
+ .getOrCreateModulePrefs((IModule) element);
+ if (property == COLUMN_LOC) {
+ String ret = p.getProperty(COLUMN_LOC);
+ return ret == null ? "" : ret;
+ }
+ if (property == COLUMN_TEMP_LOC) {
+ String ret = p.getProperty(COLUMN_TEMP_LOC);
+ return ret == null ? "" : ret;
+ }
+
+ return "";
+ }
+
+ public void modify(Object element, String property, Object value) {
+
+ IModule module = (IModule) ((TreeItem) element).getData();
+ DeploymentModulePrefs p = preferences.getOrCreatePreferences(currentDeployType)
+ .getOrCreateModulePrefs(module);
+ if (property == COLUMN_LOC) {
+ page.firePropertyChangeCommand(p, COLUMN_LOC,
+ (String) value, Messages.EditorEditDeployLocCommand);
+ viewer.refresh();
+ } else if (property == COLUMN_TEMP_LOC) {
+ page.firePropertyChangeCommand(p, COLUMN_TEMP_LOC,
+ (String) value, Messages.EditorEditDeployLocCommand);
+ viewer.refresh();
+ }
+ }
+ }
+
+ private class ModulePageContentProvider implements ITreeContentProvider {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return page.getPossibleModules();
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ }
+
+ private class ModulePageLabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (element instanceof IModule && columnIndex == 0) {
+ ILabelProvider labelProvider = ServerUICore.getLabelProvider();
+ Image image = labelProvider.getImage((IModule) element);
+ labelProvider.dispose();
+ return image;
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IModule) {
+ IModule m = (IModule) element;
+ if (columnIndex == 0)
+ return m.getName();
+ if (columnIndex == 1) {
+ DeploymentModulePrefs modPref = preferences
+ .getOrCreatePreferences(currentDeployType)
+ .getOrCreateModulePrefs(m);
+ String result = modPref.getProperty(COLUMN_LOC);
+ if (result != null)
+ return result;
+ modPref.setProperty(COLUMN_LOC, "");
+ return "";
+ }
+ if (columnIndex == 2) {
+ DeploymentModulePrefs modPref = preferences
+ .getOrCreatePreferences(currentDeployType)
+ .getOrCreateModulePrefs(m);
+ String result = modPref.getProperty(COLUMN_TEMP_LOC);
+ if (result != null)
+ return result;
+ modPref.setProperty(COLUMN_TEMP_LOC, "");
+ return "";
+ }
+ }
+ return element.toString();
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ }
+
+}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.ui.editor;
import org.eclipse.swt.widgets.Composite;
@@ -4,6 +14,7 @@
import org.eclipse.swt.widgets.Control;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+@Deprecated
public interface IDeploymentEditorTab {
public void setDeploymentPage(ModuleDeploymentPage page);
public void setDeploymentPrefs(DeploymentPreferences prefs);
Deleted: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1,723 +0,0 @@
-package org.jboss.ide.eclipse.as.ui.editor;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.command.ServerCommand;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
-import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.ui.Messages;
-
-public class LocalDeploymentModuleTab implements IDeploymentEditorTab {
- private ModuleDeploymentPage page;
- private DeploymentPreferences preferences;
-
- public LocalDeploymentModuleTab() {
- }
-
- public String getTabName() {
- return Messages.EditorLocalDeployment;
- }
-
- public void setDeploymentPage(ModuleDeploymentPage page) {
- this.page = page;
- }
-
- public void setDeploymentPrefs(DeploymentPreferences prefs) {
- this.preferences = prefs;
- }
-
- private TreeViewer viewer;
- private static final String LOCAL_COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
- private static final String LOCAL_COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
- private static final String LOCAL_COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
-
- protected ServerAttributeHelper getHelper() {
- if( helper == null ) {
- helper = new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
- } else {
- String helperTS = helper.getWorkingCopy().getAttribute("timestamp", (String)null);
- String officialTS = page.getServer().getAttribute("timestamp", (String)null);
- if( !helperTS.equals(officialTS)) {
- helper = new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
- }
- }
- return helper;
- }
-
- public Control createControl(Composite parent) {
- getHelper();
-
- Composite random = new Composite(parent, SWT.NONE);
- GridData randomData = new GridData(GridData.FILL_BOTH);
- random.setLayoutData(randomData);
- random.setLayout(new FormLayout());
-
- Composite defaultComposite = createDefaultComposite(random);
- FormData fd = new FormData();
- fd.left = new FormAttachment(0, 5);
- fd.top = new FormAttachment(0, 5);
- fd.right = new FormAttachment(100, -5);
- defaultComposite.setLayoutData(fd);
-
- Composite viewComposite = createViewerPortion(random);
- fd = new FormData();
- fd.left = new FormAttachment(0, 5);
- fd.top = new FormAttachment(defaultComposite, 5);
- fd.right = new FormAttachment(100, -5);
- fd.bottom = new FormAttachment(100, -5);
- viewComposite.setLayoutData(fd);
-
- return random;
- }
-
- private Text deployText, tempDeployText;
- private Button metadataRadio, serverRadio, customRadio, currentSelection;
- private Button deployButton, tempDeployButton;
- private ModifyListener deployListener, tempDeployListener;
- private SelectionListener radioListener, zipListener;
- private ServerAttributeHelper helper;
- private Button zipDeployWTPProjects;
- private String lastCustomDeploy, lastCustomTemp;
-
- protected Composite createDefaultComposite(Composite parent) {
-
- FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-
- Section section = toolkit.createSection(parent,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
- | ExpandableComposite.TITLE_BAR);
- section.setText(Messages.swf_DeployEditorHeading);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
-
- composite.setLayout(new FormLayout());
-
- Label descriptionLabel = toolkit.createLabel(composite,
- Messages.swf_DeploymentDescription);
- Control top = descriptionLabel;
- Composite inner = toolkit.createComposite(composite);
- inner.setLayout(new GridLayout(1, false));
-
- IRuntime rt = getServer().getServer().getRuntime();
- boolean showRadios = true;
- if( rt == null )
- showRadios = false;
- else {
- IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- if( jbsrt == null )
- showRadios = false;
- }
-
- if( showRadios ) {
- metadataRadio = toolkit.createButton(inner,
- Messages.EditorUseWorkspaceMetadata, SWT.RADIO);
- serverRadio = toolkit.createButton(inner,
- Messages.EditorUseServersDeployFolder, SWT.RADIO);
- customRadio = toolkit.createButton(inner,
- Messages.EditorUseCustomDeployFolder, SWT.RADIO);
-
- metadataRadio.setSelection(getDeployType().equals(
- IDeployableServer.DEPLOY_METADATA));
- serverRadio.setSelection(getDeployType().equals(
- IDeployableServer.DEPLOY_SERVER));
- customRadio.setSelection(getDeployType().equals(
- IDeployableServer.DEPLOY_CUSTOM));
- currentSelection = metadataRadio.getSelection() ? metadataRadio
- : serverRadio.getSelection() ? serverRadio : customRadio;
-
- radioListener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (e.getSource() == currentSelection)
- return; // do nothing
- page.execute(new RadioClickedCommand((Button) e.getSource(),
- currentSelection));
- currentSelection = (Button) e.getSource();
- }
- };
- metadataRadio.addSelectionListener(radioListener);
- serverRadio.addSelectionListener(radioListener);
- customRadio.addSelectionListener(radioListener);
- }
-
- FormData radios = new FormData();
- radios.top = new FormAttachment(descriptionLabel, 5);
- radios.left = new FormAttachment(0, 5);
- radios.right = new FormAttachment(100, -5);
- inner.setLayoutData(radios);
- top = inner;
-
- Label label = toolkit.createLabel(composite,
- Messages.swf_DeployDirectory);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- deployText = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
- deployListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.execute(new SetDeployDirCommand());
- }
- };
- deployText.addModifyListener(deployListener);
-
- deployButton = toolkit.createButton(composite, Messages.browse,
- SWT.PUSH);
- deployButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog d = new DirectoryDialog(new Shell());
- d.setFilterPath(page.makeGlobal(deployText.getText()));
- String x = d.open();
- if (x != null) {
- deployText.setText(page.makeRelative(x));
- }
- }
- });
-
- Label tempDeployLabel = toolkit.createLabel(composite,
- Messages.swf_TempDeployDirectory);
- tempDeployLabel.setForeground(toolkit.getColors().getColor(
- IFormColors.TITLE));
-
- tempDeployText = toolkit.createText(composite, getTempDeployDir(),
- SWT.BORDER);
- tempDeployListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.execute(new SetTempDeployDirCommand());
- }
- };
- tempDeployText.addModifyListener(tempDeployListener);
-
- tempDeployButton = toolkit.createButton(composite, Messages.browse,
- SWT.PUSH);
- tempDeployButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog d = new DirectoryDialog(new Shell());
- d.setFilterPath(page.makeGlobal(tempDeployText.getText()));
- String x = d.open();
- if (x != null)
- tempDeployText.setText(page.makeRelative(x));
- }
- });
-
- deployText
- .setEnabled(customRadio == null || customRadio.getSelection());
- tempDeployText.setEnabled(customRadio == null
- || customRadio.getSelection());
-
- FormData descriptionLabelData = new FormData();
- descriptionLabelData.left = new FormAttachment(0, 5);
- descriptionLabelData.top = new FormAttachment(0, 5);
- descriptionLabel.setLayoutData(descriptionLabelData);
-
- // first row
- FormData labelData = new FormData();
- labelData.left = new FormAttachment(0, 5);
- labelData.right = new FormAttachment(deployText, -5);
- labelData.top = new FormAttachment(top, 5);
- label.setLayoutData(labelData);
-
- FormData textData = new FormData();
- textData.left = new FormAttachment(deployButton, -305);
- textData.top = new FormAttachment(top, 5);
- textData.right = new FormAttachment(deployButton, -5);
- deployText.setLayoutData(textData);
-
- FormData buttonData = new FormData();
- buttonData.right = new FormAttachment(100, -5);
- buttonData.left = new FormAttachment(100, -100);
- buttonData.top = new FormAttachment(top, 2);
- deployButton.setLayoutData(buttonData);
-
- // second row
- FormData tempLabelData = new FormData();
- tempLabelData.left = new FormAttachment(0, 5);
- tempLabelData.right = new FormAttachment(deployText, -5);
- tempLabelData.top = new FormAttachment(deployText, 5);
- tempDeployLabel.setLayoutData(tempLabelData);
-
- FormData tempTextData = new FormData();
- tempTextData.left = new FormAttachment(tempDeployButton, -305);
- tempTextData.top = new FormAttachment(deployText, 5);
- tempTextData.right = new FormAttachment(tempDeployButton, -5);
- tempDeployText.setLayoutData(tempTextData);
-
- FormData tempButtonData = new FormData();
- tempButtonData.right = new FormAttachment(100, -5);
- tempButtonData.left = new FormAttachment(100, -100);
- tempButtonData.top = new FormAttachment(deployText, 5);
- tempDeployButton.setLayoutData(tempButtonData);
-
- zipDeployWTPProjects = toolkit.createButton(composite,
- Messages.EditorZipDeployments, SWT.CHECK);
- boolean zippedPublisherAvailable = isLocalZippedPublisherAvailable();
- boolean value = getServer().zipsWTPDeployments();
- zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
- zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
-
- FormData zipButtonData = new FormData();
- zipButtonData.right = new FormAttachment(100, -5);
- zipButtonData.left = new FormAttachment(0, 5);
- zipButtonData.top = new FormAttachment(tempDeployText, 5);
- zipDeployWTPProjects.setLayoutData(zipButtonData);
-
- zipListener = new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- page.execute(new SetZipCommand());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- };
- zipDeployWTPProjects.addSelectionListener(zipListener);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- page.getSaveStatus();
- return section;
- }
-
- protected boolean isLocalZippedPublisherAvailable() {
- IJBossServerPublisher[] publishers =
- ExtensionManager.getDefault().getZippedPublishers();
- for( int i = 0; i < publishers.length; i++ ) {
- if( publishers[i].accepts(LocalPublishMethod.LOCAL_PUBLISH_METHOD, getServer().getServer(), null))
- return true;
- }
- return false;
- }
-
- public class SetDeployDirCommand extends ServerCommand {
- private String oldDir;
- private String newDir;
- private Text text;
- private ModifyListener listener;
- public SetDeployDirCommand() {
- super(page.getServer(), Messages.EditorSetDeployLabel);
- this.text = deployText;
- this.newDir = deployText.getText();
- this.listener = deployListener;
- this.oldDir = getHelper().getAttribute(IDeployableServer.DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
- }
- public void execute() {
- getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
- lastCustomDeploy = newDir;
- page.getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- page.getSaveStatus();
- }
- }
-
- public class SetZipCommand extends ServerCommand {
- boolean oldVal;
- boolean newVal;
- public SetZipCommand() {
- super(page.getServer(), Messages.EditorZipDeployments);
- oldVal = getHelper().getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
- newVal = zipDeployWTPProjects.getSelection();
- }
- public void execute() {
- getHelper().setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
- page.getSaveStatus();
- }
- public void undo() {
- zipDeployWTPProjects.removeSelectionListener(zipListener);
- zipDeployWTPProjects.setSelection(oldVal);
- getHelper().setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, oldVal);
- zipDeployWTPProjects.addSelectionListener(zipListener);
- page.getSaveStatus();
- }
- }
-
- public class SetTempDeployDirCommand extends ServerCommand {
- private String oldDir;
- private String newDir;
- private Text text;
- private ModifyListener listener;
- public SetTempDeployDirCommand() {
- super(page.getServer(), Messages.EditorSetTempDeployLabel);
- text = tempDeployText;
- newDir = tempDeployText.getText();
- listener = tempDeployListener;
- oldDir = getHelper().getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
- }
- public void execute() {
- getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newDir);
- lastCustomTemp = newDir;
- page.getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- page.getSaveStatus();
- }
- }
-
- public class RadioClickedCommand extends ServerCommand {
- private Button newSelection, oldSelection;
- private String oldDir, newDir;
- private String oldTemp, newTemp;
- private String id;
- public RadioClickedCommand(Button clicked, Button previous) {
- super(page.getServer(), Messages.EditorSetRadioClicked);
- newSelection = clicked;
- oldSelection = previous;
- id = server.getId();
- }
- public void execute() {
- boolean custom = newSelection == customRadio;
- deployText.setEnabled(custom);
- tempDeployText.setEnabled(custom);
- deployButton.setEnabled(custom);
- tempDeployButton.setEnabled(custom);
- oldDir = deployText.getText();
- oldTemp = tempDeployText.getText();
-
- String type = null;
- String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
- oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
- IDeployableServer.DEPLOY_METADATA;
-
- if( newSelection == metadataRadio ) {
- newDir = JBossServerCorePlugin.getServerStateLocation(id)
- .append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
- newTemp = JBossServerCorePlugin.getServerStateLocation(id)
- .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
- type = IDeployableServer.DEPLOY_METADATA;
- new File(newDir).mkdirs();
- new File(newTemp).mkdirs();
- } else if( newSelection == serverRadio ) {
- IRuntime rt = server.getRuntime();
- if( rt != null ) {
- IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- if( jbsrt != null ) {
- String loc = jbsrt.getConfigLocation();
- String config = jbsrt.getJBossConfiguration();
- newDir = new Path(loc)
- .append(config)
- .append(IJBossServerConstants.DEPLOY).toString();
- newTemp = new Path(loc).append(config)
- .append(IJBossServerConstants.TMP)
- .append(IJBossServerConstants.JBOSSTOOLS_TMP).toString();
- new File(newTemp).mkdirs();
- type = IDeployableServer.DEPLOY_SERVER;
- }
- }
- } else {
- newDir = lastCustomDeploy;
- newTemp = lastCustomTemp;
- type = IDeployableServer.DEPLOY_CUSTOM;
- }
-
- if( !newSelection.getSelection() ) {
- // REDO, so no one actually clicked the radio. UGH!
- oldSelection.removeSelectionListener(radioListener);
- oldSelection.setSelection(false);
- oldSelection.addSelectionListener(radioListener);
-
- newSelection.removeSelectionListener(radioListener);
- newSelection.setSelection(true);
- newSelection.addSelectionListener(radioListener);
- }
-
- type = type == null ? oldType : type;
- newDir = newDir == null ? oldDir : newDir;
- newTemp = newTemp == null ? oldTemp : newTemp;
-
- deployText.removeModifyListener(deployListener);
- getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
- deployText.setText(newDir);
- deployText.addModifyListener(deployListener);
-
- tempDeployText.removeModifyListener(tempDeployListener);
- getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newTemp);
- tempDeployText.setText(newTemp);
- tempDeployText.addModifyListener(tempDeployListener);
-
- getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
- page.getSaveStatus();
- }
- public void undo() {
- deployText.removeModifyListener(deployListener);
- getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
- deployText.setText(oldDir);
- deployText.addModifyListener(deployListener);
-
- tempDeployText.removeModifyListener(tempDeployListener);
- getHelper().setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldTemp);
- tempDeployText.setText(oldTemp);
- tempDeployText.addModifyListener(tempDeployListener);
-
- oldSelection.removeSelectionListener(radioListener);
- oldSelection.setSelection(true);
- oldSelection.addSelectionListener(radioListener);
-
- newSelection.removeSelectionListener(radioListener);
- newSelection.setSelection(false);
- newSelection.addSelectionListener(radioListener);
-
- deployText.setEnabled(customRadio.getSelection());
- tempDeployText.setEnabled(customRadio.getSelection());
-
- String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
- oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
- IDeployableServer.DEPLOY_METADATA;
- getHelper().setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, oldType);
- page.getSaveStatus();
- }
- }
-
-
- private String getDeployType() {
- return getServer().getDeployLocationType();
- }
-
- private String getDeployDir() {
- return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
- ModuleDeploymentPage.makeRelative(getServer().getDeployFolder(),
- page.getServer().getRuntime());
- }
-
- private String getTempDeployDir() {
- return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
- ModuleDeploymentPage.makeRelative(getServer().getTempDeployFolder(),
- page.getServer().getRuntime());
- }
-
- private IDeployableServer getServer() {
- return (IDeployableServer) page.getServer().loadAdapter(
- IDeployableServer.class, new NullProgressMonitor());
- }
-/*
- *
- *
- *
- * This is where the second half goes
- *
- *
- *
- */
- protected Composite createViewerPortion(Composite random) {
- Composite root = new Composite(random, SWT.NONE);
- root.setLayout(new FormLayout());
-
- page.getFormToolkit(random).adapt(root);
-
- viewer = new TreeViewer(root, SWT.BORDER);
- viewer.getTree().setHeaderVisible(true);
- viewer.getTree().setLinesVisible(true);
- TreeColumn moduleColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
- TreeColumn publishLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
- TreeColumn publishTempLocColumn = new TreeColumn(viewer.getTree(),
- SWT.NONE);
- moduleColumn.setText(Messages.EditorModule);
- publishLocColumn.setText(Messages.EditorSetDeployLabel);
- publishTempLocColumn.setText(Messages.EditorSetTempDeployLabel);
-
- moduleColumn.setWidth(200);
- publishLocColumn.setWidth(200);
- publishTempLocColumn.setWidth(200);
-
- FormData treeData = new FormData();
- treeData.top = new FormAttachment(0, 5);
- treeData.bottom = new FormAttachment(100, -5);
- treeData.left = new FormAttachment(0, 5);
- treeData.right = new FormAttachment(100, -5);
- viewer.getTree().setLayoutData(treeData);
- viewer.setContentProvider(new ModulePageContentProvider());
-
- viewer.setLabelProvider(new ModulePageLabelProvider());
- viewer.setColumnProperties(new String[] { LOCAL_COLUMN_NAME,
- LOCAL_COLUMN_LOC, LOCAL_COLUMN_TEMP_LOC });
- viewer.setInput(""); // irrelevent
- CellEditor[] editors = new CellEditor[] {
- new TextCellEditor(viewer.getTree()),
- new TextCellEditor(viewer.getTree()),
- new TextCellEditor(viewer.getTree()) };
- viewer.setCellModifier(new LocalDeploymentCellModifier());
- viewer.setCellEditors(editors);
-
- return root;
- }
-
- private class LocalDeploymentCellModifier implements ICellModifier {
- public boolean canModify(Object element, String property) {
- if( property == LOCAL_COLUMN_NAME)
- return false;
- return true;
- }
-
- public Object getValue(Object element, String property) {
- DeploymentModulePrefs p = preferences.getPreferences("local")
- .getModulePrefs((IModule) element);
- if (property == LOCAL_COLUMN_LOC) {
- String ret = p.getProperty(LOCAL_COLUMN_LOC);
- return ret == null ? "" : ret;
- }
- if (property == LOCAL_COLUMN_TEMP_LOC) {
- String ret = p.getProperty(LOCAL_COLUMN_TEMP_LOC);
- return ret == null ? "" : ret;
- }
-
- return "";
- }
-
- public void modify(Object element, String property, Object value) {
-
- IModule module = (IModule) ((TreeItem) element).getData();
- DeploymentModulePrefs p = preferences.getPreferences("local")
- .getModulePrefs(module);
- if (property == LOCAL_COLUMN_LOC) {
- page.firePropertyChangeCommand(p, LOCAL_COLUMN_LOC,
- (String) value, Messages.EditorEditDeployLocCommand);
- viewer.refresh();
- } else if (property == LOCAL_COLUMN_TEMP_LOC) {
- page.firePropertyChangeCommand(p, LOCAL_COLUMN_TEMP_LOC,
- (String) value, Messages.EditorEditDeployLocCommand);
- viewer.refresh();
- }
- }
- }
-
- private class ModulePageContentProvider implements ITreeContentProvider {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- return page.getPossibleModules();
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public Object[] getChildren(Object parentElement) {
- return null;
- }
- }
-
- private class ModulePageLabelProvider implements ITableLabelProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- if (element instanceof IModule && columnIndex == 0) {
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- Image image = labelProvider.getImage((IModule) element);
- labelProvider.dispose();
- return image;
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof IModule) {
- IModule m = (IModule) element;
- if (columnIndex == 0)
- return m.getName();
- if (columnIndex == 1) {
- DeploymentModulePrefs modPref = preferences
- .getOrCreatePreferences("local")
- .getOrCreateModulePrefs(m);
- String result = modPref.getProperty(LOCAL_COLUMN_LOC);
- if (result != null)
- return result;
- modPref.setProperty(LOCAL_COLUMN_LOC, "");
- return "";
- }
- if (columnIndex == 2) {
- DeploymentModulePrefs modPref = preferences
- .getOrCreatePreferences("local")
- .getOrCreateModulePrefs(m);
- String result = modPref.getProperty(LOCAL_COLUMN_TEMP_LOC);
- if (result != null)
- return result;
- modPref.setProperty(LOCAL_COLUMN_TEMP_LOC, "");
- return "";
- }
- }
- return element.toString();
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- }
-
-}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2010-07-20 09:55:16 UTC (rev 23582)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.ui.editor;
import java.io.ByteArrayOutputStream;
@@ -9,38 +19,65 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
+import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
import org.eclipse.wst.server.ui.editor.ServerEditorPart;
import org.eclipse.wst.server.ui.internal.command.ServerCommand;
import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
-import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+import org.jboss.ide.eclipse.as.ui.UIUtil;
public class ModuleDeploymentPage extends ServerEditorPart {
protected ServerResourceCommandManager commandManager;
protected ArrayList<IModule> possibleModules;
protected DeploymentPreferences preferences;
- protected ArrayList<IDeploymentEditorTab> tabs;
protected ServerAttributeHelper helper;
+ public ServerAttributeHelper getHelper() {
+ if( helper == null ) {
+ helper = new ServerAttributeHelper(getServer().getOriginal(), getServer());
+ } else {
+ String helperTS = helper.getWorkingCopy().getAttribute("timestamp", (String)null);
+ String officialTS = getServer().getAttribute("timestamp", (String)null);
+ if( !helperTS.equals(officialTS)) {
+ helper = new ServerAttributeHelper(getServer().getOriginal(), getServer());
+ }
+ }
+ return helper;
+ }
+
public IModule[] getPossibleModules() {
return (IModule[]) possibleModules.toArray(new IModule[possibleModules.size()]);
}
@@ -77,40 +114,151 @@
}
+ private ArrayList<DeployUIAdditions> deployAdditions;
+ private ScrolledPageBook preferencePageBook;
+ private Combo deployTypeCombo;
+ private Composite absolutePageRoot;
+ private Section publishTypeSection;
public void createPartControl(Composite parent) {
+ absolutePageRoot = parent;
preferences = DeploymentPreferenceLoader.loadPreferencesFromServer(server.getOriginal());
- tabs = new ArrayList<IDeploymentEditorTab>();
-
+ Composite innerContent = createPageStructure(parent);
+ Control top = createPublishMethodSection(innerContent);
+ addDeploymentLocationControls(innerContent, top);
+ }
+
+ private Composite createPageStructure(Composite parent) {
FormToolkit toolkit = getFormToolkit(parent);
-
- ScrolledForm form = toolkit.createScrolledForm(parent);
- toolkit.decorateFormHeading(form.getForm());
- form.setText("Deployment");
- form.getBody().setLayout(new GridLayout());
-
- final TabFolder tabFolder = new TabFolder(form.getBody(), SWT.NONE);
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
- toolkit.adapt(tabFolder);
- toolkit.adapt(form);
- toolkit.adapt(form.getBody());
- IDeploymentEditorTab[] newItems = createTabs(toolkit, tabFolder);
- for( int i = 0; i < newItems.length; i++ ) {
- tabs.add(newItems[i]);
- }
+ ScrolledForm allContent = toolkit.createScrolledForm(parent);
+ toolkit.decorateFormHeading(allContent.getForm());
+ allContent.setText("Deployment");
+ allContent.getBody().setLayout(new GridLayout());
+ Composite random = new Composite(allContent.getBody(), SWT.NONE);
+ GridData randomData = new GridData(GridData.FILL_BOTH);
+ random.setLayoutData(randomData);
+ random.setLayout(new FormLayout());
+ return random;
}
- protected IDeploymentEditorTab[] createTabs(FormToolkit toolkit, TabFolder tabFolder) {
- TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
- IDeploymentEditorTab tab = new LocalDeploymentModuleTab();
- tabItem.setText(tab.getTabName());
+ private void addDeploymentLocationControls(Composite parent, Control top) {
+ DeploymentModuleOptionCompositeAssistant tab = new DeploymentModuleOptionCompositeAssistant();
tab.setDeploymentPage(this);
tab.setDeploymentPrefs(preferences);
- tabItem.setControl(tab.createControl(tabFolder));
- toolkit.adapt((Composite)tabItem.getControl());
+ Composite defaultComposite = tab.createDefaultComposite(parent);
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(top, 5);
+ fd.right = new FormAttachment(100, -5);
+ defaultComposite.setLayoutData(fd);
+
+ Composite viewComposite = tab.createViewerPortion(parent);
+ fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(defaultComposite, 5);
+ fd.right = new FormAttachment(100, -5);
+ fd.bottom = new FormAttachment(100, -5);
+ viewComposite.setLayoutData(fd);
+ }
+
+
+ private class DeployUIAdditions {
+ private IJBossServerPublishMethodType publishType;
+ private IDeploymentTypeUI ui;
+ private boolean registered = false;
+ public DeployUIAdditions(IJBossServerPublishMethodType type,IDeploymentTypeUI ui) {
+ this.publishType = type;
+ this.ui = ui;
+ }
+ public boolean isRegistered() {
+ return registered;
+ }
+ public IJBossServerPublishMethodType getPublishType() {
+ return publishType;
+ }
+ public void createComposite(Composite parent) {
+ // UI can be null
+ if( ui != null ) {
+ ui.fillComposite(parent, ModuleDeploymentPage.this);
+ registered = true;
+ }
+ }
+ }
+
+ private void loadDeployTypeData() {
+ deployAdditions = new ArrayList<DeployUIAdditions>();
+ IJBossServerPublishMethodType[] publishMethodTypes = ExtensionManager.getDefault().findPossiblePublishMethods(getServer().getOriginal());
+ for( int i = 0; i < publishMethodTypes.length; i++) {
+ IDeploymentTypeUI ui = EditorExtensionManager.getDefault().getPublishPreferenceUI(publishMethodTypes[i].getId());
+ deployAdditions.add(new DeployUIAdditions(publishMethodTypes[i], ui));
+ }
+ }
+
+ private Control createPublishMethodSection(Composite parent) {
+ loadDeployTypeData();
- return new IDeploymentEditorTab[] { tab };
+ FormToolkit toolkit2 = new FormToolkit(parent.getDisplay());
+ publishTypeSection = toolkit2.createSection(parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR);
+ publishTypeSection.setText("Publish Method");
+ Composite c = toolkit2.createComposite(publishTypeSection);
+ publishTypeSection.setClient(c);
+ FormData fd = UIUtil.createFormData2(0, 5, null, 0, 0, 5, 100, -5);
+ publishTypeSection.setLayoutData(fd);
+ c.setLayout(new FormLayout());
+ deployTypeCombo = new Combo(c, SWT.DEFAULT);
+ fd = UIUtil.createFormData2(0, 5, null, 0, 0, 5, 50, -5);
+ deployTypeCombo.setLayoutData(fd);
+
+
+ preferencePageBook = toolkit2.createPageBook(c, SWT.FLAT|SWT.TOP);
+ preferencePageBook.setLayoutData(UIUtil.createFormData2(
+ deployTypeCombo, 5, 0, 150, 0, 5, 100, -5));
+// deployTypeCombo, 5, null, 0, 0, 5, 100, -5));
+
+ // fill widgets
+ String[] nameList = new String[deployAdditions.size()];
+ for( int i = 0; i < nameList.length; i++ ) {
+ nameList[i] = deployAdditions.get(i).getPublishType().getName();
+ }
+ deployTypeCombo.setItems(nameList);
+ DeployableServerBehavior ds = ServerConverter.getDeployableServerBehavior(getServer().getOriginal());
+ if( ds != null ) {
+ String current = ds.createPublishMethod().getPublishMethodType().getName();
+ int index = deployTypeCombo.indexOf(current);
+ if( index != -1 )
+ deployTypeCombo.select(index);
+ }
+ deployTypeCombo.addModifyListener(new ModifyListener(){
+ @Override
+ public void modifyText(ModifyEvent e) {
+ deployTypeChanged(true);
+ }});
+ return publishTypeSection;
}
+ private void deployTypeChanged(boolean fireEvent) {
+ int index = deployTypeCombo.getSelectionIndex();
+ if( index != -1 ) {
+ DeployUIAdditions ui = deployAdditions.get(index);
+ if( !ui.isRegistered()) {
+ Composite newRoot = preferencePageBook.createPage(ui);
+ ui.createComposite(newRoot);
+ }
+ preferencePageBook.showPage(ui);
+ //((Composite)publishTypeSection.getClient()).layout(true, true);
+ absolutePageRoot.layout(true, true);
+ if( fireEvent ) {
+ commandManager.execute(new ChangeRootDeployPreference(preferences,
+ DeploymentPreferenceLoader.CURRENT_METHOD_PROPERTY,
+ ui.getPublishType().getId(), "Change Publish Method"));
+ }
+ } else {
+ // null selection
+ }
+ }
+
+
public void execute(ServerCommand command) {
commandManager.execute(command);
}
@@ -120,8 +268,28 @@
}
+ private class ChangeRootDeployPreference extends ServerCommand {
+ private DeploymentPreferences p;
+ private String key;
+ private String oldVal;
+ private String newVal;
+ public ChangeRootDeployPreference(DeploymentPreferences p, String key, String val, String command) {
+ super(ModuleDeploymentPage.this.server, command);
+ this.p = p;
+ this.key = key;
+ this.newVal = val;
+ this.oldVal = p.getProperty(key);
+ }
+ public void execute() {
+ p.setProperty(key, newVal);
+ savePreferencesToWorkingCopy();
+ }
+ public void undo() {
+ p.setProperty(key, oldVal);
+ savePreferencesToWorkingCopy();
+ }
+ }
-
private class ChangePropertyCommand extends ServerCommand {
private DeploymentModulePrefs p;
private String key;
@@ -136,23 +304,21 @@
}
public void execute() {
p.setProperty(key, newVal);
- saveToWC();
+ savePreferencesToWorkingCopy();
}
public void undo() {
p.setProperty(key, oldVal);
- saveToWC();
+ savePreferencesToWorkingCopy();
}
-
- protected void saveToWC() {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- DeploymentPreferenceLoader.savePreferences(bos, preferences);
- String asXML = new String(bos.toByteArray());
- helper.setAttribute(DeploymentPreferenceLoader.DEPLOYMENT_PREFERENCES_KEY, asXML);
- }
}
+ public void savePreferencesToWorkingCopy() {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ DeploymentPreferenceLoader.savePreferences(bos, preferences);
+ String asXML = new String(bos.toByteArray());
+ getHelper().setAttribute(DeploymentPreferenceLoader.DEPLOYMENT_PREFERENCES_KEY, asXML);
+ }
-
public String makeGlobal(String path) {
return makeGlobal(path, server.getRuntime());
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2010-07-20 09:27:46 UTC (rev 23581)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2010-07-20 09:55:16 UTC (rev 23582)
@@ -4,6 +4,7 @@
<extension-point id="EventLogLabelProvider" name="org.jboss.ide.as.ui.eventLogLabelProvider" schema="schema/EventLogLabelProvider.exsd"/>
<extension-point id="EventLogMajorType" name="org.jboss.ide.eclipse.as.ui.eventLogMajorType" schema="schema/EventLogMajorType.exsd"/>
<extension-point id="ServerEditorPortSection" name="org.jboss.ide.as.ui.editor.portSection" schema="schema/ServerEditorPortSection.exsd"/>
+ <extension-point id="DeployMethodUI" name="org.jboss.ide.as.ui.deployMethodUI" schema="schema/DeployMethodUI.exsd"/>
<extension
point="org.eclipse.wst.server.ui.serverImages">
@@ -578,5 +579,12 @@
typeIds="%AllJBossServerTypes">
</runtimeLocator>
</extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.ui.DeployMethodUI">
+ <ui
+ class="org.jboss.tools.as.rse.ui.RSEDeploymentPreferenceUI"
+ deployMethodId="rse">
+ </ui>
+ </extension>
</plugin>
15 years, 9 months