Author: rob.stryker(a)jboss.com
Date: 2009-08-18 19:44:27 -0400 (Tue, 18 Aug 2009)
New Revision: 17145
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
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/ModuleDeploymentPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
JBIDE-4374 - cleanup / consolidation
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-08-18
18:45:51 UTC (rev 17144)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-08-18
23:44:27 UTC (rev 17145)
@@ -174,6 +174,8 @@
public static String EditorUseCustomDeployFolder;
public static String EditorSetDeployLabel;
public static String EditorSetTempDeployLabel;
+ public static String EditorEditDeployLocCommand;
+ public static String EditorModule;
public static String EditorZipDeployments;
public static String EditorSetRadioClicked;
public static String EditorDeployDNE;
@@ -197,6 +199,9 @@
public static String EditorCPD_DefaultDescription;
public static String EditorCPD_RestoreDefault;
public static String EditorNoRuntimeSelected;
+ public static String EditorLocalDeployment;
+
+
public static String ExploreUtils_Action_Text;
public static String ExploreUtils_Description;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-08-18
18:45:51 UTC (rev 17144)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-08-18
23:44:27 UTC (rev 17145)
@@ -41,8 +41,8 @@
swf_Password=Password
swf_BaseName=JBoss _VERSION_ Server
swf_NameInUse=Server name already in use
-swf_DeployEditorHeading=Deployment
-swf_DeploymentDescription=The temporary deployment location is where files will \nbe
copied to before being renamed into the deploy directory. \nThis folder should be on the
same file system \nas the deploy folder.
+swf_DeployEditorHeading=Default Settings
+swf_DeploymentDescription=This section sets where any non-customized module will be
deployed to.\nThe temporary deploy folder should be on the same file-system as the deploy
folder.\nThis will ensure safe and complete file copies.\nCustomizations can be made in
the table below on a per-module basis.\nBlank columns will use the default values.
swf_DeployDirectory=Deploy Directory
swf_TempDeployDirectory=Temporary Deploy Directory
swf_CloneConfiguration=Copy this configuration into workspace metadata
@@ -147,8 +147,10 @@
EditorUseWorkspaceMetadata=Use workspace metadata (does not modify JBoss deploy folder)
EditorUseServersDeployFolder=Use the JBoss deploy folder
EditorUseCustomDeployFolder=Use a custom deploy folder
-EditorSetDeployLabel=Set Deploy Directory
-EditorSetTempDeployLabel=Set Temporary Deploy Directory
+EditorSetDeployLabel=Deploy Directory
+EditorSetTempDeployLabel=Temporary Deploy Directory
+EditorEditDeployLocCommand=Edit Deployment Location
+EditorModule=Module
EditorZipDeployments=Deploy projects as compressed archives
EditorSetRadioClicked=Set Deploy Location
EditorDeployDNE=The deploy directory "{0}" does not exist.
@@ -172,6 +174,8 @@
EditorCPD_DefaultDescription=This wizard allows you to edit which xpath is used to locate
a port used by the tooling.\nThis will not change any server files, only what ports are
used to interact with it.
EditorCPD_RestoreDefault=Restore Default
EditorNoRuntimeSelected=No Runtime Selected. Please select a runtime and refresh your
deployment options.
+EditorLocalDeployment=Local Deployment
+
ExploreUtils_Action_Text=Explore
ExploreUtils_Description=Explore deploy directory
Configure=Configure...
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-08-18
18:45:51 UTC (rev 17144)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-08-18
23:44:27 UTC (rev 17145)
@@ -21,51 +21,7 @@
*/
package org.jboss.ide.eclipse.as.ui.editor;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-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.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.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.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-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.IRuntime;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
-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.server.IDeployableServer;
-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.server.internal.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.util.ServerUtil;
-import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
-import org.jboss.ide.eclipse.as.ui.Messages;
/**
*
@@ -73,443 +29,4 @@
*
*/
public class DeploySection extends ServerEditorSection {
-
- 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;
- public DeploySection() {
- }
-
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
- helper = new ServerAttributeHelper(server.getOriginal(), server);
- }
-
- public void createSection(Composite parent) {
- super.createSection(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));
- 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;
-
-
- 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) {
- 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(makeGlobal(deployText.getText()));
- String x = d.open();
- if( x != null ) {
- deployText.setText(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) {
- 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(makeGlobal(tempDeployText.getText()));
- String x = d.open();
- if( x != null )
- tempDeployText.setText(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 publisherAvailable = ExtensionManager.getDefault().getZippedPublisher() !=
null;
- boolean value = getServer().zipsWTPDeployments();
- zipDeployWTPProjects.setEnabled(publisherAvailable);
- zipDeployWTPProjects.setSelection(publisherAvailable && 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) {
- execute(new SetZipCommand());
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- };
- zipDeployWTPProjects.addSelectionListener(zipListener);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- getSaveStatus();
- }
-
- private String getDeployType() {
- return getServer().getDeployLocationType();
- }
-
- private String getDeployDir() {
- return server.getRuntime() == null ? "" :
makeRelative(getServer().getDeployFolder()); //$NON-NLS-1$
- }
- private String getTempDeployDir() {
- return server.getRuntime() == null ? "" :
makeRelative(getServer().getTempDeployFolder()); //$NON-NLS-1$
- }
-
- private IDeployableServer getServer() {
- return (IDeployableServer)server.loadAdapter(IDeployableServer.class, new
NullProgressMonitor());
- }
-
- public IStatus[] getSaveStatus() {
- String error = ""; //$NON-NLS-1$
- List<Status> status = new ArrayList<Status>();
- if( getServer() instanceof JBossServer && getRuntime() == null ) {
- String msg = Messages.EditorNoRuntimeSelected;
- status.add(new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, msg));
- error = error + msg + "\n"; //$NON-NLS-1$
- }
- if(!new File(makeGlobal(deployText.getText())).exists()) {
- String msg = NLS.bind(Messages.EditorDeployDNE, deployText.getText());
- status.add(new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, msg));
- error = error + msg + "\n"; //$NON-NLS-1$
- }
-
- if(!new File(makeGlobal(tempDeployText.getText())).exists()) {
- String msg = NLS.bind(Messages.EditorTempDeployDNE, tempDeployText.getText());
- status.add(new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, msg));
- error = error + msg + "\n"; //$NON-NLS-1$
- }
- setErrorMessage(error.equals("") ? null : error); //$NON-NLS-1$
- return status.size() == 0 ? null : status.toArray(new IStatus[status.size()]);
- }
-
-
-
- public class SetDeployDirCommand extends ServerCommand {
- private String oldDir;
- private String newDir;
- private Text text;
- private ModifyListener listener;
- public SetDeployDirCommand() {
- super(DeploySection.this.server, Messages.EditorSetDeployLabel);
- this.text = deployText;
- this.newDir = deployText.getText();
- this.listener = deployListener;
- this.oldDir = helper.getAttribute(IDeployableServer.DEPLOY_DIRECTORY, "");
//$NON-NLS-1$
- }
- public void execute() {
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
- lastCustomDeploy = newDir;
- getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- getSaveStatus();
- }
- }
-
- public class SetZipCommand extends ServerCommand {
- boolean oldVal;
- boolean newVal;
- public SetZipCommand() {
- super(DeploySection.this.server, Messages.EditorZipDeployments);
- oldVal = helper.getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
- newVal = zipDeployWTPProjects.getSelection();
- }
- public void execute() {
- helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
- getSaveStatus();
- }
- public void undo() {
- zipDeployWTPProjects.removeSelectionListener(zipListener);
- zipDeployWTPProjects.setSelection(oldVal);
- helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, oldVal);
- zipDeployWTPProjects.addSelectionListener(zipListener);
- getSaveStatus();
- }
- }
-
- public class SetTempDeployDirCommand extends ServerCommand {
- private String oldDir;
- private String newDir;
- private Text text;
- private ModifyListener listener;
- public SetTempDeployDirCommand() {
- super(DeploySection.this.server, Messages.EditorSetTempDeployLabel);
- text = tempDeployText;
- newDir = tempDeployText.getText();
- listener = tempDeployListener;
- oldDir = helper.getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, "");
//$NON-NLS-1$
- }
- public void execute() {
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newDir);
- lastCustomTemp = newDir;
- getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- 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(DeploySection.this.server, Messages.EditorSetRadioClicked);
- newSelection = clicked;
- oldSelection = previous;
- id = DeploySection.this.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 = DeploySection.this.server.getRuntime();
- if( rt != null ) {
- IJBossServerRuntime jbsrt =
(IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
- if( jbsrt != null ) {
- String config = jbsrt.getJBossConfiguration();
- newDir = new Path(IJBossServerConstants.SERVER)
- .append(config)
- .append(IJBossServerConstants.DEPLOY).makeRelative().toString();
- newTemp = new Path(IJBossServerConstants.SERVER).append(config)
- .append(IJBossServerConstants.TMP)
- .append(IJBossServerConstants.JBOSSTOOLS_TMP).makeRelative().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);
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
- deployText.setText(newDir);
- deployText.addModifyListener(deployListener);
-
- tempDeployText.removeModifyListener(tempDeployListener);
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newTemp);
- tempDeployText.setText(newTemp);
- tempDeployText.addModifyListener(tempDeployListener);
-
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
- getSaveStatus();
- }
- public void undo() {
- deployText.removeModifyListener(deployListener);
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
- deployText.setText(oldDir);
- deployText.addModifyListener(deployListener);
-
- tempDeployText.removeModifyListener(tempDeployListener);
- helper.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;
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, oldType);
- getSaveStatus();
- }
- }
-
- public void dispose() {
- // ignore
- }
-
- private String makeGlobal(String path) {
- return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
- }
-
- private String makeRelative(String path) {
- if (getRuntime() == null) {
- return path;
- }
- return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
- }
-
- private IJBossServerRuntime getRuntime() {
- IRuntime r = server.getRuntime();
- IJBossServerRuntime ajbsrt = null;
- if (r != null) {
- ajbsrt = (IJBossServerRuntime) r
- .loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- }
- return ajbsrt;
- }
}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java 2009-08-18
23:44:27 UTC (rev 17145)
@@ -0,0 +1,12 @@
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import
org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+
+public interface IDeploymentEditorTab {
+ public void setDeploymentPage(ModuleDeploymentPage page);
+ public void setDeploymentPrefs(DeploymentPreferences prefs);
+ public Control createControl(Composite parent);
+ public String getTabName();
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java 2009-08-18
23:44:27 UTC (rev 17145)
@@ -0,0 +1,694 @@
+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.server.IDeployableServer;
+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.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+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.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;
+
+ public Control createControl(Composite parent) {
+ helper = new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
+
+ 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 publisherAvailable = ExtensionManager.getDefault()
+ .getZippedPublisher() != null;
+ boolean value = getServer().zipsWTPDeployments();
+ zipDeployWTPProjects.setEnabled(publisherAvailable);
+ zipDeployWTPProjects.setSelection(publisherAvailable && 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;
+ }
+
+ 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 = helper.getAttribute(IDeployableServer.DEPLOY_DIRECTORY, "");
//$NON-NLS-1$
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
+ lastCustomDeploy = newDir;
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.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 = helper.getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
+ newVal = zipDeployWTPProjects.getSelection();
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ zipDeployWTPProjects.removeSelectionListener(zipListener);
+ zipDeployWTPProjects.setSelection(oldVal);
+ helper.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 = helper.getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, "");
//$NON-NLS-1$
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newDir);
+ lastCustomTemp = newDir;
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.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 config = jbsrt.getJBossConfiguration();
+ newDir = new Path(IJBossServerConstants.SERVER)
+ .append(config)
+ .append(IJBossServerConstants.DEPLOY).makeRelative().toString();
+ newTemp = new Path(IJBossServerConstants.SERVER).append(config)
+ .append(IJBossServerConstants.TMP)
+ .append(IJBossServerConstants.JBOSSTOOLS_TMP).makeRelative().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);
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
+ deployText.setText(newDir);
+ deployText.addModifyListener(deployListener);
+
+ tempDeployText.removeModifyListener(tempDeployListener);
+ helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newTemp);
+ tempDeployText.setText(newTemp);
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ deployText.removeModifyListener(deployListener);
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
+ deployText.setText(oldDir);
+ deployText.addModifyListener(deployListener);
+
+ tempDeployText.removeModifyListener(tempDeployListener);
+ helper.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;
+ helper.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$
+ page.makeRelative(getServer().getDeployFolder());
+ }
+
+ private String getTempDeployDir() {
+ return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
+ page.makeRelative(getServer().getTempDeployFolder());
+ }
+
+ 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) {
+ 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:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-08-18
18:45:51 UTC (rev 17144)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-08-18
23:44:27 UTC (rev 17145)
@@ -7,31 +7,20 @@
import org.eclipse.core.runtime.IStatus;
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.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.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-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.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
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;
@@ -39,15 +28,28 @@
import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
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.ServerUtil;
import
org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
import
org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
public class ModuleDeploymentPage extends ServerEditorPart {
private ServerResourceCommandManager commandManager;
- private ArrayList<IModule> possibleChildren;
+ private ArrayList<IModule> possibleModules;
+ private DeploymentPreferences preferences;
+ private ArrayList<IDeploymentEditorTab> tabs;
+ public IModule[] getPossibleModules() {
+ return (IModule[]) possibleModules.toArray(new IModule[possibleModules.size()]);
+ }
+
+ public FormToolkit getFormToolkit(Composite parent) {
+ return getFormToolkit(parent.getDisplay());
+ }
+
+ public IServerWorkingCopy getServer() {
+ return server;
+ }
+
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
ArrayList<IModule> possibleChildren = new ArrayList<IModule>();
@@ -61,7 +63,7 @@
possibleChildren.add(module);
}
}
- this.possibleChildren = possibleChildren;
+ this.possibleModules = possibleChildren;
if (input instanceof IServerEditorPartInput) {
IServerEditorPartInput sepi = (IServerEditorPartInput) input;
server = sepi.getServer();
@@ -72,128 +74,42 @@
}
public void createPartControl(Composite parent) {
- createLocalControl(parent);
- }
-
- private TreeViewer viewer;
- private DeploymentPreferences preferences;
- 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 void createLocalControl(Composite parent) {
- preferences = DeploymentPreferenceLoader.loadPreferences(server.getOriginal());
- FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+ preferences = DeploymentPreferenceLoader.loadPreferences(server.getOriginal());
+ tabs = new ArrayList<IDeploymentEditorTab>();
+ FormToolkit toolkit = getFormToolkit(parent);
+
ScrolledForm form = toolkit.createScrolledForm(parent);
toolkit.decorateFormHeading(form.getForm());
form.setText("Module Deployment");
- //form.setImage(null);
- GridLayout layout = new GridLayout();
- layout.marginTop = 6;
- layout.marginLeft = 6;
- form.getBody().setLayout(layout);
-
- Composite random = toolkit.createComposite(form.getBody(), SWT.NONE);
- random.setLayout(new FillLayout());
- GridData randomData = new GridData(GridData.FILL_BOTH);
- random.setLayoutData(randomData);
- Composite root = toolkit.createComposite(random, SWT.NONE);
- root.setLayout(new FormLayout());
-
- 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("Module");
- publishLocColumn.setText("Publish Location");
- publishTempLocColumn.setText("Publish Temporary Location");
-
- moduleColumn.setWidth(200);
- publishLocColumn.setWidth(200);
- publishTempLocColumn.setWidth(200);
-
-
- FormData treeData = new FormData();
- treeData.top = new FormAttachment(0, 100);
- treeData.bottom = new FormAttachment(100, -100);
- 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("");
- CellEditor[] editors = new CellEditor[] {
- new TextCellEditor(viewer.getTree()),
- new TextCellEditor(viewer.getTree()),
- new TextCellEditor(viewer.getTree())
- };
- viewer.setCellModifier(new LocalDeploymentCellModifier());
- viewer.setCellEditors(editors);
- }
+ form.getBody().setLayout(new GridLayout());
- private class LocalDeploymentCellModifier implements ICellModifier {
- public boolean canModify(Object element, String property) {
- 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) {
- firePropertyChangeCommand(p, LOCAL_COLUMN_LOC, (String)value);
- } else
- if( property == LOCAL_COLUMN_TEMP_LOC) {
- firePropertyChangeCommand(p, LOCAL_COLUMN_TEMP_LOC, (String)value);
- }
- }
+ 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());
+ // for loop {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
+ IDeploymentEditorTab tab = new LocalDeploymentModuleTab();
+ tabItem.setText(tab.getTabName());
+ tab.setDeploymentPage(this);
+ tab.setDeploymentPrefs(preferences);
+ tabItem.setControl(tab.createControl(tabFolder));
+ toolkit.adapt((Composite)tabItem.getControl());
+ tabs.add(tab);
+ // }
}
- protected void firePropertyChangeCommand(DeploymentModulePrefs p, String key, String
val) {
- commandManager.execute(new ChangePropertyCommand(p,key,val));
+ public void execute(ServerCommand command) {
+ commandManager.execute(command);
}
- private String makeGlobal(String path) {
- return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
+ public void firePropertyChangeCommand(DeploymentModulePrefs p, String key, String val,
String cmdName) {
+ commandManager.execute(new ChangePropertyCommand(p,key,val,cmdName));
}
- private String makeRelative(String path) {
- if (getRuntime() == null) {
- return path;
- }
- return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
- }
- private IJBossServerRuntime getRuntime() {
- IRuntime r = server.getRuntime();
- IJBossServerRuntime ajbsrt = null;
- if (r != null) {
- ajbsrt = (IJBossServerRuntime) r
- .loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- }
- return ajbsrt;
- }
private class ChangePropertyCommand extends ServerCommand {
@@ -201,8 +117,8 @@
private String key;
private String oldVal;
private String newVal;
- public ChangePropertyCommand(DeploymentModulePrefs p, String key, String val) {
- super(ModuleDeploymentPage.this.server, "command text");
+ public ChangePropertyCommand(DeploymentModulePrefs p, String key, String val, String
commandName) {
+ super(ModuleDeploymentPage.this.server, commandName);
this.p = p;
this.key = key;
this.newVal = val;
@@ -210,81 +126,36 @@
}
public void execute() {
p.setProperty(key, newVal);
- viewer.refresh();
}
public void undo() {
p.setProperty(key, oldVal);
- 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 (IModule[]) possibleChildren.toArray(new IModule[possibleChildren.size()]);
- }
- public boolean hasChildren(Object element) {
- return false;
- }
- public Object getParent(Object element) {
- return null;
- }
- public Object[] getChildren(Object parentElement) {
- return null;
- }
+
+
+ public String makeGlobal(String path) {
+ return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
}
- private class ModulePageLabelProvider implements ITableLabelProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
+ public String makeRelative(String path) {
+ if (getRuntime() == null) {
+ return path;
}
- 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, defaultLocation());
- return defaultLocation();
- }
- 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, defaultTempLocation());
- return defaultTempLocation();
- }
- }
- return element.toString();
+ return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
+ }
+
+ private IJBossServerRuntime getRuntime() {
+ IRuntime r = server.getRuntime();
+ IJBossServerRuntime ajbsrt = null;
+ if (r != null) {
+ ajbsrt = (IJBossServerRuntime) r
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
}
- public void addListener(ILabelProviderListener listener) {
- }
- public void dispose() {
- }
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
- public void removeListener(ILabelProviderListener listener) {
- }
+ return ajbsrt;
}
- protected String defaultLocation() {
- //return "server/${jboss_config}/deploy";
- return "";
- }
- protected String defaultTempLocation() {
- //return "server/${jboss_config}/tmp/jbosstoolsTemp";
- return "";
- }
-
public void setFocus() {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-08-18 18:45:51 UTC (rev
17144)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-08-18 23:44:27 UTC (rev
17145)
@@ -152,12 +152,15 @@
<extension
point="org.eclipse.wst.server.ui.editorPageSections">
+ <!--
<section
class="org.jboss.ide.eclipse.as.ui.editor.DeploySection"
id="org.jboss.ide.eclipse.as.ui.editor.deployServer.deployDir"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
typeIds="org.jboss.ide.eclipse.as.systemCopyServer,
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.eap.43,org.jboss.ide.eclipse.as.eap.50"/>
+ -->
+
<section
class="org.jboss.ide.eclipse.as.ui.editor.PollerSection"
id="org.jboss.ide.eclipse.as.ui.editor.pollerSection"