Author: rob.stryker(a)jboss.com
Date: 2010-07-27 10:13:22 -0400 (Tue, 27 Jul 2010)
New Revision: 23747
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
Removed:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/IRSEConstants.java
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.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/tools/as/rse/ui/RSEDeploymentPreferenceUI.java
Log:
JBIDE-6580 - publish now uses new values from the rse settings; still fails if user keeps
setting on workspace metadata; UI on second page is not linked to first page...
Deleted:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/IRSEConstants.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/IRSEConstants.java 2010-07-27
13:45:14 UTC (rev 23746)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/IRSEConstants.java 2010-07-27
14:13:22 UTC (rev 23747)
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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;
-
-public interface IRSEConstants {
- public static final String RSE_SERVER_CONFIG =
"org.jboss.ide.eclipse.as.rse.core.RSEServerConfig"; //$NON-NLS-1$
- public static final String RSE_SERVER_HOME_DIR =
"org.jboss.ide.eclipse.as.rse.core.RSEServerHomeDir"; //$NON-NLS-1$
- public static final String RSE_SERVER_HOST =
"org.jboss.ide.eclipse.as.rse.core.ServerHost"; //$NON-NLS-1$
- public static final String RSE_SERVER_DEFAULT_HOST = "Local"; //$NON-NLS-1$
-}
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-27
13:45:14 UTC (rev 23746)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-07-27
14:13:22 UTC (rev 23747)
@@ -28,8 +28,10 @@
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.server.internal.JBossServer;
import
org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class RSEPublishMethod extends AbstractPublishMethod {
@@ -77,10 +79,16 @@
protected void loadRemoteDeploymentDetails() throws CoreException{
// TODO obviously fix this
- this.remoteRootFolder = new Path("/home/rob/redhat/deploy"); //$NON-NLS-1$
+// String homeDir = RSEUtils.getRSEHomeDir(behaviour.getServer());
+// String conf = RSEUtils.getRSEConfigName(behaviour.getServer());
+ String connectionName = RSEUtils.getRSEConnectionName(behaviour.getServer());
+// this.remoteRootFolder = new Path("/home/rob/redhat/deploy"); //$NON-NLS-1$
+// this.remoteTemporaryFolder = new Path("/home/rob/redhat/tmp");
//$NON-NLS-1$
+ JBossServer jbs = ServerConverter.getJBossServer(behaviour.getServer());
+ this.remoteRootFolder = new Path(RSEUtils.getDeployRootFolder(jbs));
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);
+
+ IHost host = findHost(connectionName);
if( host != null ) {
fileSubSystem = findFileTransferSubSystem(host);
} else {
Copied:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
(from rev 23742,
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/IRSEConstants.java)
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
(rev 0)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java 2010-07-27
14:13:22 UTC (rev 23747)
@@ -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.rse.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.IConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+
+
+/*
+ * Some of this code will need to be abstracted out from JBossServer
+ * and turned into a proper API, but in as simple a way as possible
+ */
+public class RSEUtils {
+ public static final String RSE_SERVER_CONFIG =
"org.jboss.ide.eclipse.as.rse.core.RSEServerConfig"; //$NON-NLS-1$
+ public static final String RSE_SERVER_HOME_DIR =
"org.jboss.ide.eclipse.as.rse.core.RSEServerHomeDir"; //$NON-NLS-1$
+ public static final String RSE_SERVER_HOST =
"org.jboss.ide.eclipse.as.rse.core.ServerHost"; //$NON-NLS-1$
+ public static final String RSE_SERVER_DEFAULT_HOST = "Local"; //$NON-NLS-1$
+
+ public static String getRSEConnectionName(IServer server) {
+ return server.getAttribute(RSEUtils.RSE_SERVER_HOST, RSE_SERVER_DEFAULT_HOST);
+ }
+
+ public static String getRSEHomeDir(IServer server) {
+ return server.getAttribute(RSEUtils.RSE_SERVER_HOME_DIR,
server.getRuntime().getLocation().toString());
+ }
+
+ public static String getRSEConfigName(IServer server) {
+ IJBossServerRuntime runtime = ServerConverter.getJBossRuntime(server);
+ return server.getAttribute(RSEUtils.RSE_SERVER_CONFIG,
runtime.getJBossConfiguration());
+ }
+
+ public static String getDeployRootFolder(JBossServer server) {
+ return getDeployRootFolder(server.getServer(), server.getDeployLocationType());
+ }
+
+ /* Copied from JBossServer.getDeployFolder(etc) */
+ public static String getDeployRootFolder(IServer server, String type) {
+ if( type.equals(JBossServer.DEPLOY_CUSTOM)) {
+ String val = server.getAttribute(JBossServer.DEPLOY_DIRECTORY, (String)null);
+ if( val != null ) {
+ IPath val2 = new Path(val);
+ return makeGlobal(server, val2).toString();
+ }
+ // if no value is set, default to metadata
+ type = JBossServer.DEPLOY_SERVER;
+ }
+ // TODO error here, or sensible default?
+ if( type.equals(JBossServer.DEPLOY_METADATA)) {
+ return JBossServerCorePlugin.getServerStateLocation(server).
+ append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
+ } else if( type.equals(JBossServer.DEPLOY_SERVER)) {
+ String loc = IConstants.SERVER;
+ String config = getRSEConfigName(server);
+ IPath p = new Path(loc).append(config)
+ .append(IJBossServerConstants.DEPLOY);
+ return makeGlobal(server, p).toString();
+ }
+ return null;
+ }
+
+ public static IPath makeRelative(IServer server, IPath p) {
+ if( p.isAbsolute()) {
+ if(new Path(getRSEHomeDir(server)).isPrefixOf(p)) {
+ int size = new Path(getRSEHomeDir(server)).toOSString().length();
+ return new Path(p.toOSString().substring(size)).makeRelative();
+ }
+ }
+ return p;
+ }
+
+ public static IPath makeGlobal(IServer server, IPath p) {
+ if( !p.isAbsolute()) {
+ return new Path(getRSEHomeDir(server)).append(p).makeAbsolute();
+ }
+ return p;
+ }
+
+
+}
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-27
13:45:14 UTC (rev 23746)
+++
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-27
14:13:22 UTC (rev 23747)
@@ -86,6 +86,7 @@
if (selection.size() == 1) {
ModuleServer moduleServer = (ModuleServer) selection.getFirstElement();
IServer server = moduleServer.getServer();
+ // TODO This needs to be changed; it's horrible to debug
if (ExploreUtils.canExplore(server)) {
if (getDeployPath() != null) {
menu.insertBefore(ServerActionProvider.CONTROL_MODULE_SECTION_END_SEPARATOR,
exploreAction);
Modified:
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 2010-07-27
13:45:14 UTC (rev 23746)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-07-27
14:13:22 UTC (rev 23747)
@@ -24,7 +24,7 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.rse.core.IRSEConstants;
+import org.jboss.ide.eclipse.as.rse.core.RSEUtils;
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.ServerModeSection;
@@ -53,7 +53,7 @@
Composite child = new Composite(this, SWT.None);
child.setLayoutData(UIUtil.createFormData2(0, 0, null, 0, 0, 5, 100, 0));
child.setLayout(new GridLayout());
- String current = modeSection.getServer().getAttribute(IRSEConstants.RSE_SERVER_HOST,
IRSEConstants.RSE_SERVER_DEFAULT_HOST);
+ String current = modeSection.getServer().getAttribute(RSEUtils.RSE_SERVER_HOST,
RSEUtils.RSE_SERVER_DEFAULT_HOST);
combo = new SystemHostCombo(child, SWT.NULL, findHost(current), false,
/* ISubSystemConfigurationCategories.SUBSYSTEM_CATEGORY_FILES*/
"files");
@@ -67,7 +67,7 @@
rseServerHome = new Text(this, SWT.SINGLE | SWT.BORDER);
serverHomeLabel.setLayoutData(UIUtil.createFormData2(child, 7, null, 0, 0, 10, null,
0));
rseServerHome.setLayoutData(UIUtil.createFormData2(child, 5, null, 0, serverHomeLabel,
5, 100, -5));
- rseServerHome.setText(modeSection.getServer().getAttribute(IRSEConstants.RSE_SERVER_HOME_DIR,
+ rseServerHome.setText(modeSection.getServer().getAttribute(RSEUtils.RSE_SERVER_HOME_DIR,
getRuntime().getRuntime().getLocation().toString()));
rseServerHome.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e) {
@@ -79,7 +79,7 @@
rseServerConfig= new Text(this, SWT.SINGLE | SWT.BORDER);
serverConfigLabel.setLayoutData(UIUtil.createFormData2(rseServerHome, 7, null, 0, 0,
10, null, 0));
rseServerConfig.setLayoutData(UIUtil.createFormData2(rseServerHome, 5, null, 0,
serverConfigLabel, 5, 100, -5));
- rseServerConfig.setText(modeSection.getServer().getAttribute(IRSEConstants.RSE_SERVER_CONFIG,
+ rseServerConfig.setText(modeSection.getServer().getAttribute(RSEUtils.RSE_SERVER_CONFIG,
getRuntime().getJBossConfiguration()));
rseServerConfig.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e) {
@@ -93,19 +93,19 @@
protected void rseHostChanged() {
modeSection.getCommandManager().execute(new ChangeServerPropertyCommand(
- modeSection.getServer(), IRSEConstants.RSE_SERVER_HOST,
combo.getHost().getAliasName(),
+ modeSection.getServer(), RSEUtils.RSE_SERVER_HOST, combo.getHost().getAliasName(),
"Change RSE Host"));
}
protected void serverHomeChanged() {
modeSection.getCommandManager().execute(new ChangeServerPropertyCommand(
- modeSection.getServer(), IRSEConstants.RSE_SERVER_HOME_DIR, rseServerHome.getText(),
+ modeSection.getServer(), RSEUtils.RSE_SERVER_HOME_DIR, rseServerHome.getText(),
"Change RSE Server's Home Directory"));
}
protected void serverConfigChanged() {
modeSection.getCommandManager().execute(new ChangeServerPropertyCommand(
- modeSection.getServer(), IRSEConstants.RSE_SERVER_CONFIG, rseServerConfig.getText(),
+ modeSection.getServer(), RSEUtils.RSE_SERVER_CONFIG, rseServerConfig.getText(),
"Change RSE Server's Configuration"));
}