Author: rob.stryker(a)jboss.com
Date: 2009-01-23 05:06:53 -0500 (Fri, 23 Jan 2009)
New Revision: 13226
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java
Log:
JBIDE-3565 - deploy only server now functioning
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2009-01-23
08:22:19 UTC (rev 13225)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2009-01-23
10:06:53 UTC (rev 13226)
@@ -182,7 +182,7 @@
}
public static IPath makeRelative(IJBossServerRuntime rt, IPath p) {
- if( p.isAbsolute()) {
+ if( p.isAbsolute() && rt != null) {
if(rt.getRuntime().getLocation().isPrefixOf(p)) {
int size = rt.getRuntime().getLocation().toOSString().length();
return new Path(p.toOSString().substring(size)).makeRelative();
@@ -192,7 +192,7 @@
}
public static IPath makeGlobal(IJBossServerRuntime rt, IPath p) {
- if( !p.isAbsolute()) {
+ if( !p.isAbsolute() && rt != null) {
return rt.getRuntime().getLocation().append(p).makeAbsolute();
}
return p;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-01-23
08:22:19 UTC (rev 13225)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-01-23
10:06:53 UTC (rev 13226)
@@ -42,6 +42,7 @@
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;
@@ -53,7 +54,6 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
import org.eclipse.wst.server.ui.internal.command.ServerCommand;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
@@ -61,7 +61,6 @@
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.DeployableServer;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -102,34 +101,44 @@
composite.setLayout(new FormLayout());
Label descriptionLabel = toolkit.createLabel(composite,
Messages.swf_DeploymentDescription);
+ Control top = descriptionLabel;
+ if( getRuntime() != null ) {
+ Composite inner = toolkit.createComposite(composite);
+ inner.setLayout(new GridLayout(1, false));
+ 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
+ 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;
+ }
- Composite inner = toolkit.createComposite(composite);
- inner.setLayout(new GridLayout(1, false));
- 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
- execute(new RadioClickedCommand((Button)e.getSource(), currentSelection));
- currentSelection = (Button)e.getSource();
- } };
- metadataRadio.addSelectionListener(radioListener);
- serverRadio.addSelectionListener(radioListener);
- customRadio.addSelectionListener(radioListener);
-
Label label = toolkit.createLabel(composite, Messages.swf_DeployDirectory);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
deployText = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
@@ -178,38 +187,31 @@
}
});
- deployText.setEnabled(customRadio.getSelection());
- tempDeployText.setEnabled(customRadio.getSelection());
+ 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);
- 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);
-
-
// first row
FormData labelData = new FormData();
labelData.left = new FormAttachment(0,5);
labelData.right = new FormAttachment(deployText,-5);
- labelData.top = new FormAttachment(inner,5);
+ labelData.top = new FormAttachment(top,5);
label.setLayoutData(labelData);
FormData textData = new FormData();
textData.left = new FormAttachment(deployButton, -305);
- textData.top = new FormAttachment(inner,5);
+ 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(inner,2);
+ buttonData.top = new FormAttachment(top,2);
deployButton.setLayoutData(buttonData);
// second row
@@ -439,7 +441,7 @@
private String makeRelative(String path) {
if (getRuntime() == null) {
- return "";
+ return path;
}
return DeployableServer.makeRelative(getRuntime(), new Path(path)).toString();
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java 2009-01-23
08:22:19 UTC (rev 13225)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java 2009-01-23
10:06:53 UTC (rev 13226)
@@ -63,10 +63,10 @@
private IWizardHandle handle;
- private Label deployLabel, nameLabel;
- private Text deployText, nameText;
- private Button browse;
- private String name, deployLoc;
+ private Label deployLabel, tempDeployLabel, nameLabel;
+ private Text deployText, tempDeployText, nameText;
+ private Button browse, tempBrowse;
+ private String name, deployLoc, tempDeployLoc;
public StrippedServerWizardFragment() {
}
@@ -75,7 +75,7 @@
this.handle = handle;
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(new FormLayout());
-
+
nameLabel = new Label(main, SWT.NONE);
nameText = new Text(main, SWT.BORDER);
nameLabel.setText(Messages.serverName);
@@ -86,17 +86,12 @@
deployLabel.setText(Messages.swf_DeployDirectory);
browse.setText(Messages.browse);
- FormData lData = new FormData();
- lData.top = new FormAttachment(nameText,5);
- lData.left = new FormAttachment(0,5);
- deployLabel.setLayoutData(lData);
+ tempDeployLabel = new Label(main, SWT.NONE);
+ tempDeployText = new Text(main, SWT.BORDER);
+ tempBrowse = new Button(main, SWT.PUSH);
+ tempDeployLabel.setText(Messages.swf_TempDeployDirectory);
+ tempBrowse.setText(Messages.browse);
- FormData tData = new FormData();
- tData.top = new FormAttachment(nameText,5);
- tData.left = new FormAttachment(deployLabel,5);
- tData.right = new FormAttachment(browse, -5);
- deployText.setLayoutData(tData);
-
FormData namelData = new FormData();
namelData.top = new FormAttachment(0,5);
namelData.left = new FormAttachment(0,5);
@@ -108,11 +103,40 @@
nametData.right = new FormAttachment(100,-5);
nameText.setLayoutData(nametData);
+ FormData lData = new FormData();
+ lData.top = new FormAttachment(nameText,5);
+ lData.left = new FormAttachment(0,5);
+ deployLabel.setLayoutData(lData);
+
+ FormData tData = new FormData();
+ tData.top = new FormAttachment(nameText,5);
+ tData.left = new FormAttachment(deployLabel,5);
+ tData.right = new FormAttachment(browse, -5);
+ deployText.setLayoutData(tData);
+
FormData bData = new FormData();
bData.right = new FormAttachment(100,-5);
bData.top = new FormAttachment(nameText,5);
browse.setLayoutData(bData);
+
+ FormData templData = new FormData();
+ templData.top = new FormAttachment(deployText,5);
+ templData.left = new FormAttachment(0,5);
+ tempDeployLabel.setLayoutData(templData);
+
+ FormData temptData = new FormData();
+ temptData.top = new FormAttachment(deployText,5);
+ temptData.left = new FormAttachment(tempDeployLabel,5);
+ temptData.right = new FormAttachment(tempBrowse, -5);
+ tempDeployText.setLayoutData(temptData);
+
+ FormData tempbData = new FormData();
+ tempbData.right = new FormAttachment(100,-5);
+ tempbData.top = new FormAttachment(deployText,5);
+ tempBrowse.setLayoutData(tempbData);
+
+
ModifyListener ml = new ModifyListener() {
public void modifyText(ModifyEvent e) {
textChanged();
@@ -131,7 +155,21 @@
}
});
+ tempBrowse.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog d = new DirectoryDialog(new Shell());
+ d.setFilterPath(tempDeployText.getText());
+ String x = d.open();
+ if( x != null )
+ tempDeployText.setText(x);
+ }
+ });
+
+
deployText.addModifyListener(ml);
+ tempDeployText.addModifyListener(ml);
nameText.addModifyListener(ml);
nameText.setText(getDefaultNameText());
handle.setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.WIZBAN_DEPLOY_ONLY_LOGO));
@@ -142,6 +180,7 @@
IStatus status = checkErrors();
if( status.isOK() ) {
deployLoc = deployText.getText();
+ tempDeployLoc = tempDeployText.getText();
name = nameText.getText();
handle.setMessage("", IStatus.OK);
handle.update();
@@ -156,8 +195,12 @@
}
File f = new File(deployText.getText());
if( !f.exists() || !f.isDirectory() ) {
- return new Status(IStatus.WARNING, JBossServerUIPlugin.PLUGIN_ID, IStatus.OK,
"Folder does not exist", null);
+ return new Status(IStatus.WARNING, JBossServerUIPlugin.PLUGIN_ID, IStatus.OK,
"Deploy Folder does not exist", null);
}
+ f = new File(tempDeployText.getText());
+ if( !f.exists() || !f.isDirectory() ) {
+ return new Status(IStatus.WARNING, JBossServerUIPlugin.PLUGIN_ID, IStatus.OK,
"Temporary Deploy Folder does not exist", null);
+ }
return new Status(IStatus.OK, JBossServerUIPlugin.PLUGIN_ID, IStatus.OK, "",
null);
}
@@ -191,6 +234,7 @@
swcInternal = (ServerWorkingCopy)swc;
swcInternal.setName(name);
swcInternal.setAttribute(DeployableServer.DEPLOY_DIRECTORY, deployLoc);
+ swcInternal.setAttribute(DeployableServer.TEMP_DEPLOY_DIRECTORY, tempDeployLoc);
getTaskModel().putObject(TaskModel.TASK_SERVER, swcInternal);
}
}