Author: rob.stryker(a)jboss.com
Date: 2007-09-06 00:52:32 -0400 (Thu, 06 Sep 2007)
New Revision: 3466
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/TwiddleDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBossLaunchConfigurationTabGroup.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/upgrades/UpdatePage20.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
Refactor of launch configurations. Specifically:
Each type (start, stop, twiddle) now have their own launch configuration type, now
decoupled.
UI code was simplified immensely
TwiddleDialog and TwiddleLauncher refactored to use new launch type
"Stop" method of ServerBehavior classes modified to use new launches
Fixed classpath bug where users could not modify classpath properly
JBIDE-400
JBIDE-786
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/TwiddleDialog.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/TwiddleDialog.java 2007-09-05
18:12:31 UTC (rev 3465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/TwiddleDialog.java 2007-09-06
04:52:32 UTC (rev 3466)
@@ -1,8 +1,6 @@
package org.jboss.ide.eclipse.as.ui.dialogs;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
@@ -18,12 +16,11 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.server.JBossServerLaunchConfiguration;
-import org.jboss.ide.eclipse.as.core.server.TwiddleLauncher;
-import org.jboss.ide.eclipse.as.core.server.TwiddleLauncher.ProcessData;
+import org.jboss.ide.eclipse.as.core.launch.TwiddleLaunchConfiguration;
+import org.jboss.ide.eclipse.as.core.launch.TwiddleLauncher;
+import org.jboss.ide.eclipse.as.core.launch.TwiddleLauncher.ProcessData;
import org.jboss.ide.eclipse.as.ui.Messages;
public class TwiddleDialog extends TrayDialog {
@@ -142,12 +139,9 @@
results.setLayoutData(resultsData);
results.setFont(new Font(null, "Courier New", 8, SWT.NONE));
-
-
// set the default text
try {
- ILaunchConfiguration config =
JBossServerLaunchConfiguration.setupLaunchConfiguration(server,
JBossServerLaunchConfiguration.TWIDDLE);
- String args =
config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
"");
+ String args = TwiddleLaunchConfiguration.getDefaultArgs(server);
query.setText(args);
query.setFocus();
query.setSelection(args.length());
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBossLaunchConfigurationTabGroup.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBossLaunchConfigurationTabGroup.java 2007-09-05
18:12:31 UTC (rev 3465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBossLaunchConfigurationTabGroup.java 2007-09-06
04:52:32 UTC (rev 3466)
@@ -1,74 +1,27 @@
package org.jboss.ide.eclipse.as.ui.launch;
-import java.io.File;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
-import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
-import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
-import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
-import org.eclipse.jdt.internal.debug.ui.launcher.VMArgumentsBlock;
-import org.eclipse.jdt.internal.debug.ui.launcher.WorkingDirectoryBlock;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.jboss.ide.eclipse.as.core.server.JBossServerLaunchConfiguration;
public class JBossLaunchConfigurationTabGroup extends
AbstractLaunchConfigurationTabGroup {
- private IServer server;
-
- private ILaunchConfiguration launchConfiguration;
- private ILaunchConfigurationWorkingCopy launchWC;
-
-
-
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[10];
int i = 0;
- tabs[i] = new JBossJavaArgumentsTab(JBossJavaArgumentsTab.START);
+// tabs[i] = new JBossJavaArgumentsTab(JBossJavaArgumentsTab.START);
+// tabs[i++].setLaunchConfigurationDialog(dialog);
+// tabs[i] = new JBossJavaArgumentsTab(JBossJavaArgumentsTab.STOP);
+// tabs[i++].setLaunchConfigurationDialog(dialog);
+ tabs[i] = new JavaArgumentsTab();
tabs[i++].setLaunchConfigurationDialog(dialog);
- tabs[i] = new JBossJavaArgumentsTab(JBossJavaArgumentsTab.STOP);
- tabs[i++].setLaunchConfigurationDialog(dialog);
- tabs[i] = new JBossJavaArgumentsTab(JBossJavaArgumentsTab.TWIDDLE);
- tabs[i++].setLaunchConfigurationDialog(dialog);
tabs[i] = new JavaClasspathTab();
tabs[i++].setLaunchConfigurationDialog(dialog);
tabs[i] = new SourceLookupTab();
@@ -85,527 +38,4 @@
System.arraycopy(tabs, 0, tabs2, 0, i);
setTabs(tabs2);
}
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- super.setDefaults(configuration);
- }
-
- public void initializeFrom(ILaunchConfiguration configuration) {
- try {
- server = ServerUtil.getServer(configuration);
-
- ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
- JBossServerLaunchConfiguration.ensureDefaultsSet(wc, server);
- ILaunchConfigurationTab[] tabs = getTabs();
- for (int i = 0; i < tabs.length; i++) {
- try {
- tabs[i].initializeFrom(wc);
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
- } catch(Exception e) {
- }
- }
-
-
- protected class JBossJavaArgumentsTab extends JavaArgumentsTab {
- public static final int START = 0;
- public static final int STOP = 1;
- public static final int TWIDDLE = 2;
-
-
-
- private int type;
- private String suffix;
- protected String programArgsKey;
- protected String vmArgsKey;
- protected String workingDirKey;
-
- public JBossJavaArgumentsTab(int type) {
- super();
- this.type = type;
- if( this.type == START ) suffix =
JBossServerLaunchConfiguration.PRGM_ARGS_START_SUFFIX;
- if( this.type == STOP ) suffix =
JBossServerLaunchConfiguration.PRGM_ARGS_STOP_SUFFIX;
- if( this.type == TWIDDLE ) suffix =
JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX;
-
- programArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + suffix;
- vmArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + suffix;
- workingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + suffix;
- }
-
- public void setDefaults(ILaunchConfigurationWorkingCopy config) {
- config.setAttribute(programArgsKey, (String)null);
- fVMArgumentsBlock.setDefaults(config);
- fWorkingDirectoryBlock.setDefaults(config);
- }
-
- protected VMArgumentsBlock createVMArgsBlock() {
- return new JBossVMArgumentsBlock();
- }
-
- protected WorkingDirectoryBlock createWorkingDirBlock() {
- return new JBossWorkingDirectoryBlock();
- }
-
- public String getName() {
- switch (type) {
- case START: return "Start Args"; //Messages.LaunchGroupStartArgs;
- case STOP: return "Stop Args"; //Messages.LaunchGroupTwiddleArgs;
- case TWIDDLE: return "Twiddle Args"; //Messages.LaunchGroupStopArgs;
- default:
- return super.getName();
- }
- }
-
-
- /**
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
- */
- public void initializeFrom(ILaunchConfiguration configuration) {
- try {
- String prgmArgs = configuration.getAttribute(programArgsKey, (String)null);
- fPrgmArgumentsText.setText(prgmArgs);
- fVMArgumentsBlock.initializeFrom(configuration);
- fWorkingDirectoryBlock.initializeFrom(configuration);
- } catch (CoreException e) {
- setErrorMessage(LauncherMessages.JavaArgumentsTab_Exception_occurred_reading_configuration___15
+ e.getStatus().getMessage());
- JDIDebugUIPlugin.log(e);
- }
- }
-
- /**
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
- */
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(programArgsKey,
getAttributeValueFrom(fPrgmArgumentsText));
- fVMArgumentsBlock.performApply(configuration);
- fWorkingDirectoryBlock.performApply(configuration);
- }
-
- protected class JBossVMArgumentsBlock extends VMArgumentsBlock {
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(vmArgsKey, (String)null);
- }
-
- public void initializeFrom(ILaunchConfiguration configuration) {
- try {
- fVMArgumentsText.setText(configuration.getAttribute(vmArgsKey, ""));
//$NON-NLS-1$
- } catch (CoreException e) {
- setErrorMessage(LauncherMessages.JavaArgumentsTab_Exception_occurred_reading_configuration___15
+ e.getStatus().getMessage());
- JDIDebugUIPlugin.log(e);
- }
- }
-
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(vmArgsKey, getAttributeValueFrom(fVMArgumentsText));
- }
- }
-
-
- /* 100% lifted from jdt because they didnt make anything PROTECTED! >:O */
- public class JBossWorkingDirectoryBlock extends WorkingDirectoryBlock {
-
- // Local directory
- private Button fWorkspaceButton;
- private Button fFileSystemButton;
- private Button fVariablesButton;
-
- //bug 29565 fix
- private Button fUseDefaultDirButton = null;
- private Button fUseOtherDirButton = null;
- private Text fOtherWorkingText = null;
- private Text fWorkingDirText;
-
- /**
- * The last launch config this tab was initialized from
- */
- private ILaunchConfiguration fLaunchConfiguration;
-
- /**
- * A listener to update for text changes and widget selection
- */
- private class WidgetListener extends SelectionAdapter implements ModifyListener {
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }//end modifyText
- public void widgetSelected(SelectionEvent e) {
- Object source= e.getSource();
- if (source == fWorkspaceButton) {
- handleWorkspaceDirBrowseButtonSelected();
- }//end if
- else if (source == fFileSystemButton) {
- handleWorkingDirBrowseButtonSelected();
- }//end if
- else if (source == fVariablesButton) {
- handleWorkingDirVariablesButtonSelected();
- }//end if
- else if(source == fUseDefaultDirButton) {
- //only perform the action if this is the button that was selected
- if(fUseDefaultDirButton.getSelection()) {
- setDefaultWorkingDir();
- }//end if
- }//end if
- else if(source == fUseOtherDirButton) {
- //only perform the action if this is the button that was selected
- if(fUseOtherDirButton.getSelection()) {
- handleUseOtherWorkingDirButtonSelected();
- }//end if
- }//end if
- }//end widgetSelected
- }//end WidgetListener class
-
- private WidgetListener fListener = new WidgetListener();
-
- /* (non-Javadoc)
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Font font = parent.getFont();
-
- Group group = new Group(parent, SWT.NONE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group,
IJavaDebugHelpContextIds.WORKING_DIRECTORY_BLOCK);
- GridLayout workingDirLayout = new GridLayout();
- workingDirLayout.numColumns = 2;
- workingDirLayout.makeColumnsEqualWidth = false;
- group.setLayout(workingDirLayout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayoutData(gd);
- group.setFont(font);
- setControl(group);
-
- group.setText(LauncherMessages.WorkingDirectoryBlock_12);
-
- fUseDefaultDirButton = new Button(group, SWT.RADIO);
- fUseDefaultDirButton.setText(LauncherMessages.WorkingDirectoryBlock_18);
- fUseDefaultDirButton.setFont(font);
- fUseDefaultDirButton.addSelectionListener(fListener);
- fWorkingDirText = new Text(group, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fWorkingDirText.setLayoutData(gd);
- fWorkingDirText.setFont(font);
- fWorkingDirText.addModifyListener(fListener);
- fWorkingDirText.setEnabled(false);
-
- fUseOtherDirButton = new Button(group, SWT.RADIO);
- fUseOtherDirButton.setText(LauncherMessages.WorkingDirectoryBlock_19);
- fUseOtherDirButton.setFont(font);
- fUseOtherDirButton.addSelectionListener(fListener);
- fOtherWorkingText = new Text(group, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fOtherWorkingText.setLayoutData(gd);
- fOtherWorkingText.setFont(font);
- fOtherWorkingText.addModifyListener(fListener);
-
- Composite buttonComp = new Composite(group, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttonComp.setLayout(layout);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan = 2;
- buttonComp.setLayoutData(gd);
- buttonComp.setFont(font);
- fWorkspaceButton = createPushButton(buttonComp,
LauncherMessages.WorkingDirectoryBlock_0, null);
- fWorkspaceButton.addSelectionListener(fListener);
-
- fFileSystemButton = createPushButton(buttonComp,
LauncherMessages.WorkingDirectoryBlock_1, null);
- fFileSystemButton.addSelectionListener(fListener);
-
- fVariablesButton = createPushButton(buttonComp,
LauncherMessages.WorkingDirectoryBlock_17, null);
- fVariablesButton.addSelectionListener(fListener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
- */
- public void dispose() {}
-
- /**
- * Show a dialog that lets the user select a working directory
- */
- private void handleWorkingDirBrowseButtonSelected() {
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage(LauncherMessages.WorkingDirectoryBlock_7);
- String currentWorkingDir = getWorkingDirectoryText();
- if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
- File path = new File(currentWorkingDir);
- if (path.exists()) {
- dialog.setFilterPath(currentWorkingDir);
- }//end if
- }//end if
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- fOtherWorkingText.setText(selectedDirectory);
- }//end if
- }//end handleQWrokingDirBrowseBUttonSelected
-
- /**
- * Show a dialog that lets the user select a working directory from
- * the workspace
- */
- private void handleWorkspaceDirBrowseButtonSelected() {
- IContainer currentContainer= getContainer();
- if (currentContainer == null) {
- currentContainer = ResourcesPlugin.getWorkspace().getRoot();
- }//end if
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
currentContainer, false, LauncherMessages.WorkingDirectoryBlock_4);
- dialog.showClosedProjects(false);
- dialog.open();
- Object[] results = dialog.getResult();
- if ((results != null) && (results.length > 0) && (results[0]
instanceof IPath)) {
- IPath path = (IPath)results[0];
- String containerName = path.makeRelative().toString();
- setOtherWorkingDirectoryText("${workspace_loc:" + containerName +
"}"); //$NON-NLS-1$ //$NON-NLS-2$
- }//end if
- }//end handleWorkspaceDirBrowseButtonSelected
-
- /**
- * Returns the selected workspace container,or <code>null</code>
- */
- protected IContainer getContainer() {
- String path = getWorkingDirectoryText();
- if (path.length() > 0) {
- IResource res = null;
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$
- IStringVariableManager manager =
VariablesPlugin.getDefault().getStringVariableManager();
- try {
- path = manager.performStringSubstitution(path, false);
- IContainer[] containers = root.findContainersForLocation(new
Path(path));
- if (containers.length > 0) {
- res = containers[0];
- }//end if
- }//end try
- catch (CoreException e) {}
- }//end if
- else {
- res = root.findMember(path);
- }//end else
- if (res instanceof IContainer) {
- return (IContainer)res;
- }//end if
- }//end if
- return null;
- }//end getContainer
-
- /**
- * The default working dir radio button has been selected.
- */
- private void handleUseDefaultWorkingDirButtonSelected() {
- fWorkspaceButton.setEnabled(false);
- fOtherWorkingText.setEnabled(false);
- fVariablesButton.setEnabled(false);
- fFileSystemButton.setEnabled(false);
- fUseOtherDirButton.setSelection(false);
- }
-
- /**
- * The other working dir radio button has been selected
- *
- * @since 3.2
- */
- private void handleUseOtherWorkingDirButtonSelected() {
- fOtherWorkingText.setEnabled(true);
- fWorkspaceButton.setEnabled(true);
- fVariablesButton.setEnabled(true);
- fFileSystemButton.setEnabled(true);
- updateLaunchConfigurationDialog();
- }
-
- /**
- * The working dir variables button has been selected
- */
- private void handleWorkingDirVariablesButtonSelected() {
- StringVariableSelectionDialog dialog = new
StringVariableSelectionDialog(getShell());
- dialog.open();
- String variableText = dialog.getVariableExpression();
- if (variableText != null) {
- fOtherWorkingText.insert(variableText);
- }//end if
- }//end handleWorkingDirVariablesButtonSelected
-
- /**
- * Sets the default working directory
- */
- protected void setDefaultWorkingDir() {
- try {
- ILaunchConfiguration config = getLaunchConfiguration();
- if (config != null) {
- IJavaProject javaProject = JavaRuntime.getJavaProject(config);
- if (javaProject != null) {
- setDefaultWorkingDirectoryText("${workspace_loc:" +
javaProject.getPath().makeRelative().toOSString() + "}");
//$NON-NLS-1$//$NON-NLS-2$
- return;
- }//end if
- }//end if
- }//end try
- catch (CoreException ce) {}
- setDefaultWorkingDirectoryText(System.getProperty("user.dir"));
//$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public boolean isValid(ILaunchConfiguration config) {
- setErrorMessage(null);
- setMessage(null);
- // if variables are present, we cannot resolve the directory
- String workingDirPath = getWorkingDirectoryText();
- if (workingDirPath.indexOf("${") >= 0) { //$NON-NLS-1$
- IStringVariableManager manager =
VariablesPlugin.getDefault().getStringVariableManager();
- try {
- manager.validateStringVariables(workingDirPath);
- }//end try
- catch (CoreException e) {
- setErrorMessage(e.getMessage());
- return false;
- }//end catch
- }//end if
- else if (workingDirPath.length() > 0) {
- IContainer container = getContainer();
- if (container == null) {
- File dir = new File(workingDirPath);
- if (dir.isDirectory()) {
- return true;
- }//end if
- setErrorMessage(LauncherMessages.WorkingDirectoryBlock_10);
- return false;
- }//end if
- } else if (workingDirPath.length() == 0) {
- setErrorMessage(LauncherMessages.WorkingDirectoryBlock_20);
- }
- return true;
- }//end isValid
-
- /**
- * Defaults are empty.
- *
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void setDefaults(ILaunchConfigurationWorkingCopy config) {
- config.setAttribute(workingDirKey, (String)null);
- }
-
- /* (non-Javadoc)
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void initializeFrom(ILaunchConfiguration configuration) {
- setLaunchConfiguration(configuration);
- try {
- String wd = configuration.getAttribute(workingDirKey, (String)null);
- setDefaultWorkingDir();
- if (wd != null) {
- setOtherWorkingDirectoryText(wd);
- }//end else
- }//end try
- catch (CoreException e) {
- setErrorMessage(LauncherMessages.JavaArgumentsTab_Exception_occurred_reading_configuration___15
+ e.getStatus().getMessage());
- JDIDebugUIPlugin.log(e);
- }//end catch
- }
-
- /* (non-Javadoc)
- * @see
org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- if(fUseDefaultDirButton.getSelection()) {
- configuration.setAttribute(workingDirKey, (String)null);
- }//end if
- else {
- configuration.setAttribute(workingDirKey, getWorkingDirectoryText());
- }//end else
- }//end performApply
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
- */
- public String getName() {
- return LauncherMessages.WorkingDirectoryBlock_Working_Directory_8;
- }//end getName
-
- /**
- * gets the path from the text box that is selected
- * @return the working directory the user wishes to use
- * @since 3.2
- */
- protected String getWorkingDirectoryText() {
- if(fUseDefaultDirButton.getSelection()) {
- return fWorkingDirText.getText().trim();
- }//end if
- return fOtherWorkingText.getText().trim();
- }//end getWorkingDirectoryPath
-
- /**
- * sets the default working directory text
- * @param dir the dir to set the widget to
- * @since 3.2
- */
- protected void setDefaultWorkingDirectoryText(String dir) {
- if(dir != null) {
- fWorkingDirText.setText(dir);
- fUseDefaultDirButton.setSelection(true);
- handleUseDefaultWorkingDirButtonSelected();
- }//end if
- }//setDefaultWorkingDirectoryText
-
- /**
- * sets the other dir text
- * @param dir the new text
- * @since 3.2
- */
- protected void setOtherWorkingDirectoryText(String dir) {
- if(dir != null) {
- fOtherWorkingText.setText(dir);
- fUseDefaultDirButton.setSelection(false);
- fUseOtherDirButton.setSelection(true);
- handleUseOtherWorkingDirButtonSelected();
- }//end if
- }//end setOtherWorkingDirectoryText
-
- /**
- * Sets the java project currently specified by the
- * given launch config, if any.
- */
- protected void setLaunchConfiguration(ILaunchConfiguration config) {
- fLaunchConfiguration = config;
- }
-
- /**
- * Returns the current java project context
- */
- protected ILaunchConfiguration getLaunchConfiguration() {
- return fLaunchConfiguration;
- }
-
- /**
- * Allows this entire block to be enabled/disabled
- * @param enabled whether to enable it or not
- */
- protected void setEnabled(boolean enabled) {
- fUseDefaultDirButton.setEnabled(enabled);
- fUseOtherDirButton.setEnabled(enabled);
- if(fOtherWorkingText.isEnabled()) {
- fOtherWorkingText.setEnabled(enabled);
- fWorkspaceButton.setEnabled(enabled);
- fVariablesButton.setEnabled(enabled);
- fFileSystemButton.setEnabled(enabled);
- }//end if
- // in the case where the 'other' text is selected and we want to enable
- if(fUseOtherDirButton.getSelection() && enabled == true) {
- fOtherWorkingText.setEnabled(enabled);
- }//end if
- }//end setEnabled
-
- }//end class
-
- }
-
-
- public class JBossJavaClasspathTab extends JavaClasspathTab {
- public boolean isValid(ILaunchConfiguration launchConfig) {
- if( getModel() != null )
- return super.isValid(launchConfig);
- return false;
- }
- }
-
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/upgrades/UpdatePage20.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/upgrades/UpdatePage20.java 2007-09-05
18:12:31 UTC (rev 3465)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/upgrades/UpdatePage20.java 2007-09-06
04:52:32 UTC (rev 3466)
@@ -21,406 +21,403 @@
*/
package org.jboss.ide.eclipse.as.ui.upgrades;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-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.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.util.ASLaunchConfigurationConverter;
-import
org.jboss.ide.eclipse.as.core.util.ASLaunchConfigurationConverter.TempLaunchConfiguration;
-import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.firstrun.wizard.pages.AbstractFirstRunPage;
public class UpdatePage20 extends AbstractFirstRunPage {
- private ASLaunchConfigurationConverter converter;
- private TempLaunchConfiguration[] configs;
-
- private ArrayList rows;
- private boolean pageComplete;
- private String errorMessage;
-
- private Label descLabel;
-
- private ConfigDataComposite configDataComposite;
-
-
- public UpdatePage20() {
- super("", Messages.UpgradeWizardTitle, null);
- rows = new ArrayList();
+ protected UpdatePage20(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ // TODO Auto-generated constructor stub
}
+ @Override
public void createControl(Composite parent) {
- Composite main = new Composite(parent, SWT.NONE);
- main.setLayout(new FormLayout());
+ // TODO Auto-generated method stub
- Composite main2 = new Composite(main, SWT.NONE);
- FormData main2Data = new FormData();
- main2Data.left = new FormAttachment(0,5);
- main2Data.right = new FormAttachment(100,-5);
- main2Data.top = new FormAttachment(0,5);
- main2Data.bottom = new FormAttachment(100,-5);
- main2.setLayoutData(main2Data);
-
- main2.setLayout(new FormLayout());
-
- descLabel = new Label(main2, SWT.NONE);
- FormData descLabelData = new FormData();
- descLabelData.left = new FormAttachment(0,5);
- descLabelData.right = new FormAttachment(100,-5);
- descLabelData.top = new FormAttachment(0,5);
- descLabel.setLayoutData(descLabelData);
-
- descLabel.setText(Messages.UpgradeWizardDescription);
-
- if( configs.length != 0 ) {
- createFullControl(main2);
- } else {
- createEmptyControl(main2);
- }
- setControl(main);
}
-
- protected void createEmptyControl(Composite main2) {
- Label noConfigsLabel = new Label(main2, SWT.NONE);
- FormData noConfigsData = new FormData();
- noConfigsData.left = new FormAttachment(0,5);
- noConfigsData.right = new FormAttachment(100,-5);
- noConfigsData.top = new FormAttachment(descLabel,8);
- noConfigsLabel.setLayoutData(noConfigsData);
-
- noConfigsLabel.setText(Messages.UpgradeWizardNoConvertableConfigs);
-
- pageComplete = true;
- }
-
- protected void createFullControl(Composite main2) {
- ScrolledComposite sc = new ScrolledComposite(main2, SWT.BORDER | SWT.H_SCROLL |
SWT.V_SCROLL);
- FormData scData = new FormData();
- scData.left = new FormAttachment(0,5);
- scData.right = new FormAttachment(100,-5);
- scData.top = new FormAttachment(descLabel,5);
- scData.bottom = new FormAttachment(50,-2);
- sc.setLayoutData(scData);
-
- fillScrolledComposite(sc);
-
-
- configDataComposite = new ConfigDataComposite(main2, SWT.NONE);
- FormData cdcData = new FormData();
- cdcData.left = new FormAttachment(0,5);
- cdcData.right = new FormAttachment(100,-5);
- cdcData.top = new FormAttachment(sc,5);
- cdcData.bottom = new FormAttachment(100,-5);
- configDataComposite.setLayoutData(cdcData);
- checkPageComplete();
- }
-
- protected class ConfigDataComposite extends Composite {
- private TempLaunchConfiguration currentConfig;
-
- private Label launchConfigName, homeDir, jbConfig, startArgs, stopArgs, jre;
-
- public ConfigDataComposite(Composite parent, int style) {
- super(parent, style);
-
- setLayout(new FormLayout());
-
-
- Label detailLabel = new Label(this, SWT.NONE);
- FormData dld = new FormData();
- dld.left = new FormAttachment(0,5);
- dld.top = new FormAttachment(0,5);
- detailLabel.setLayoutData(dld);
- detailLabel.setText(Messages.UpgradeWizardDetails);
-
- Composite detailComposite = new Composite(this, SWT.NONE);
- detailComposite.setLayout(new GridLayout(2, false));
- FormData detailCompositeData = new FormData();
- detailCompositeData.left = new FormAttachment(0,20);
- detailCompositeData.top = new FormAttachment(detailLabel, 5);
- detailComposite.setLayoutData(detailCompositeData);
-
-
-
- new Label(detailComposite, SWT.NONE).setText(Messages.UpgradeWizardLaunchConfigName);
- launchConfigName = new Label(detailComposite, SWT.NONE);
-
- new Label(detailComposite, SWT.NONE).setText(Messages.UpgradeWizardLaunchHomeDir);
- homeDir = new Label(detailComposite, SWT.NONE);
-
- new Label(detailComposite,
SWT.NONE).setText(Messages.UpgradeWizardLaunchJBossConfig);
- jbConfig = new Label(detailComposite, SWT.NONE);
-
- new Label(detailComposite, SWT.NONE).setText(Messages.UpgradeWizardLaunchStartArgs);
- startArgs = new Label(detailComposite, SWT.NONE);
-
- new Label(detailComposite,
SWT.NONE).setText(Messages.UpgradeWizardLaunchShutdownArgs);
- stopArgs = new Label(detailComposite, SWT.NONE);
-
- new Label(detailComposite, SWT.NONE).setText(Messages.UpgradeWizardLaunchJRE);
- jre = new Label(detailComposite, SWT.NONE);
- }
-
- public void setInput(TempLaunchConfiguration config) {
- if( config != currentConfig) {
- currentConfig = config;
- try {
- launchConfigName.setText(config.getName());
- homeDir.setText(config.getAttribute("org.jboss.rocklet.HomeDir",
""));
- jbConfig.setText(config.getAttribute("org.jboss.rocklet.ServerConfiguration",
""));
- startArgs.setText(config.getAttribute("org.rocklet.launcher.userProgramArgs",
""));
- stopArgs.setText(config.getAttribute("org.rocklet.launcher.userShutdownProgramArgs",
""));
- IVMInstall vm = config.getJVMItem();
- String vmName = vm == null ? "" : vm.getName();
- jre.setText(vmName);
- layout();
- } catch( CoreException ce ) {
- ce.printStackTrace();
- }
- }
- }
- }
-
- protected void fillScrolledComposite(ScrolledComposite sc) {
-
- Composite main = new Composite(sc, SWT.NONE);
- main.setLayout(new GridLayout(4, false));
- sc.setContent(main);
+ @Override
+ public void initialize() {
+ // TODO Auto-generated method stub
-
-
- // add headings
- Label convertLabel = new Label(main, SWT.NONE);
- convertLabel.setText(Messages.UpgradeWizardLaunchConvert);
- Label configName = new Label(main, SWT.NONE);
- configName.setText(Messages.UpgradeWizardLaunchConfigName2);
- Label runtimeLabel = new Label(main, SWT.NONE);
- runtimeLabel.setText(Messages.UpgradeWizardLaunchRuntimeName);
- Label serverLabel = new Label(main, SWT.NONE);
- serverLabel.setText(Messages.UpgradeWizardLaunchServerName);
-
- for( int i = 0; i < configs.length; i++ ) {
- // should add the 4 widgets itself
- ConfigurationRow row = new ConfigurationRow(configs[i], main);
- rows.add(row);
- }
-
-
- // force a layout
- main.pack();
-
- int locY = main.getLocation().y;
- int locX = main.getLocation().x;
- int sY = main.getSize().y;
- int sX = main.getSize().x;
-
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
- sc.setMinHeight(locY + sY);
- sc.setMinWidth(locX + sX);
-
- sc.setSize(300,150);
}
-
- public void initialize() {
- converter = new ASLaunchConfigurationConverter();
- configs = converter.getConvertableConfigurations();
- }
-
+ @Override
public void performFinishWithProgress(IProgressMonitor monitor) {
- monitor.beginTask(Messages.UpgradeWizardLaunchMonitorMainTask, rows.size() * 100);
- monitor.setTaskName(Messages.UpgradeWizardLaunchMonitorMainTask);
- Iterator i = rows.iterator();
- while(i.hasNext()) {
- ConfigurationRow r = (ConfigurationRow)i.next();
- if( r.getSelected() ) {
- // now convert
- monitor.subTask(Messages.UpgradeWizardLaunchMonitorConverting +
r.getLaunchConfig().getName());
- try {
- converter.convertConfiguration(r.getLaunchConfig(),
- r.getRuntimeName(), r.getServerName());
- } catch( CoreException ce ) {
- ce.printStackTrace();
- }
- }
- }
- monitor.done();
- }
-
- public boolean isPageComplete() {
- return pageComplete;
- }
-
- protected void checkPageComplete() {
- pageComplete = true; // start it off true. If it remains true, great
- HashMap map = new HashMap();
-
-
-
- String server_prefix = "__SP__";
- String rt_prefix = "__RT__";
-
- IRuntime[] rts = ServerCore.getRuntimes();
- IServer[] servers = ServerCore.getServers();
-
- for( int i = 0; i < rts.length; i++ ) {
- map.put(rt_prefix + rts[i].getName(), "");
- }
- for( int i = 0; i < servers.length; i++ ) {
- map.put(server_prefix + servers[i].getName(), "");
- }
-
- ArrayList runtimeCollisions = new ArrayList();
- ArrayList serverCollisions = new ArrayList();
-
- Iterator i = rows.iterator();
- while(i.hasNext()) {
- ConfigurationRow r = (ConfigurationRow)i.next();
- if( r.getSelected()) {
- if( !map.containsKey(rt_prefix + r.getRuntimeName())
- && !map.containsKey(server_prefix + r.getServerName())) {
- map.put(rt_prefix + r.getRuntimeName(), "");
- map.put(server_prefix + r.getServerName(), "");
- } else {
- if( map.containsKey(rt_prefix + r.getRuntimeName()))
- runtimeCollisions.add(r.getRuntimeName());
- if( map.containsKey(server_prefix + r.getServerName()))
- serverCollisions.add(r.getServerName());
-
- pageComplete = false;
- }
- }
- }
-
- if( runtimeCollisions.size() == 0 && serverCollisions.size() == 0 ) {
- errorMessage = null;
- } else {
- errorMessage = "";
- String[] sc = (String[]) serverCollisions.toArray(new
String[serverCollisions.size()]);
- String[] rtc = (String[]) runtimeCollisions.toArray(new
String[runtimeCollisions.size()]);
- if( rtc.length > 0 )
- errorMessage += Messages.UpgradeWizardLaunchRuntimeNamesInUse + implode(rtc,
", ") + "\n";
- if( sc.length > 0 )
- errorMessage += Messages.UpgradeWizardLaunchServerNamesInUse + implode(sc, ",
");
- }
- setErrorMessage(errorMessage);
- }
-
- protected String implode(String[] array, String separator) {
- if( array.length == 0 ) return "";
- String ret = "";
- for( int i = 0; i < array.length; i++ ) {
- ret += array[i] + separator;
- }
- return ret.substring(0, ret.length() - separator.length());
- }
-
- protected class ConfigurationRow {
- private TempLaunchConfiguration config;
+ // TODO Auto-generated method stub
- private Button shouldConvert;
- private Label nameLabel;
- private Text runtimeText;
- private Text serverText;
-
- public ConfigurationRow(TempLaunchConfiguration config, Composite parent) {
- this.config = config;
-
- shouldConvert = new Button(parent, SWT.CHECK);
- shouldConvert.setSelection(true);
- GridData shouldConvertData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- shouldConvert.setLayoutData(shouldConvertData);
-
- nameLabel = new Label(parent, SWT.NONE);
- nameLabel.setText(config.getName());
-
- runtimeText = new Text(parent, SWT.BORDER);
- runtimeText.setText(config.getName() + " Runtime");
-
- GridData rtgd = new GridData(GridData.FILL_HORIZONTAL);
- runtimeText.setLayoutData(rtgd);
-
- serverText = new Text(parent, SWT.BORDER);
- serverText.setText(config.getName());
- GridData stgd = new GridData(GridData.FILL_HORIZONTAL);
- serverText.setLayoutData(stgd);
-
-
-
- // listeners
- SelectionListener listener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- checkPageComplete();
- getContainer().updateButtons();
- }
- };
- ModifyListener modListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- checkPageComplete();
- getContainer().updateButtons();
- }
- };
- shouldConvert.addSelectionListener(listener);
- runtimeText.addModifyListener(modListener);
- serverText.addModifyListener(modListener);
-
- final TempLaunchConfiguration config2 = config;
- Listener mmListener = new Listener() {
- public void handleEvent(Event event) {
- if( event.type == SWT.MouseMove) {
- configDataComposite.setInput(config2);
- }
- }
- };
- shouldConvert.addListener(SWT.MouseMove, mmListener);
- runtimeText.addListener(SWT.MouseMove, mmListener);
- serverText.addListener(SWT.MouseMove, mmListener);
- nameLabel.addListener(SWT.MouseMove, mmListener);
- }
-
- public boolean getSelected() {
- return shouldConvert.getSelection();
- }
- public String getName() {
- return nameLabel.getText();
- }
- public String getRuntimeName() {
- return runtimeText.getText();
- }
- public String getServerName() {
- return serverText.getText();
- }
- public TempLaunchConfiguration getLaunchConfig() {
- return config;
- }
}
+
+// private ASLaunchConfigurationConverter converter;
+// private TempLaunchConfiguration[] configs;
+//
+// private ArrayList rows;
+// private boolean pageComplete;
+// private String errorMessage;
+//
+// private Label descLabel;
+//
+// private ConfigDataComposite configDataComposite;
+//
+//
+// public UpdatePage20() {
+// super("", Messages.UpgradeWizardTitle, null);
+// rows = new ArrayList();
+// }
+//
+// public void createControl(Composite parent) {
+// Composite main = new Composite(parent, SWT.NONE);
+// main.setLayout(new FormLayout());
+//
+// Composite main2 = new Composite(main, SWT.NONE);
+// FormData main2Data = new FormData();
+// main2Data.left = new FormAttachment(0,5);
+// main2Data.right = new FormAttachment(100,-5);
+// main2Data.top = new FormAttachment(0,5);
+// main2Data.bottom = new FormAttachment(100,-5);
+// main2.setLayoutData(main2Data);
+//
+// main2.setLayout(new FormLayout());
+//
+// descLabel = new Label(main2, SWT.NONE);
+// FormData descLabelData = new FormData();
+// descLabelData.left = new FormAttachment(0,5);
+// descLabelData.right = new FormAttachment(100,-5);
+// descLabelData.top = new FormAttachment(0,5);
+// descLabel.setLayoutData(descLabelData);
+//
+// descLabel.setText(Messages.UpgradeWizardDescription);
+//
+// if( configs.length != 0 ) {
+// createFullControl(main2);
+// } else {
+// createEmptyControl(main2);
+// }
+// setControl(main);
+// }
+//
+// protected void createEmptyControl(Composite main2) {
+// Label noConfigsLabel = new Label(main2, SWT.NONE);
+// FormData noConfigsData = new FormData();
+// noConfigsData.left = new FormAttachment(0,5);
+// noConfigsData.right = new FormAttachment(100,-5);
+// noConfigsData.top = new FormAttachment(descLabel,8);
+// noConfigsLabel.setLayoutData(noConfigsData);
+//
+// noConfigsLabel.setText(Messages.UpgradeWizardNoConvertableConfigs);
+//
+// pageComplete = true;
+// }
+//
+// protected void createFullControl(Composite main2) {
+// ScrolledComposite sc = new ScrolledComposite(main2, SWT.BORDER | SWT.H_SCROLL |
SWT.V_SCROLL);
+// FormData scData = new FormData();
+// scData.left = new FormAttachment(0,5);
+// scData.right = new FormAttachment(100,-5);
+// scData.top = new FormAttachment(descLabel,5);
+// scData.bottom = new FormAttachment(50,-2);
+// sc.setLayoutData(scData);
+//
+// fillScrolledComposite(sc);
+//
+//
+// configDataComposite = new ConfigDataComposite(main2, SWT.NONE);
+// FormData cdcData = new FormData();
+// cdcData.left = new FormAttachment(0,5);
+// cdcData.right = new FormAttachment(100,-5);
+// cdcData.top = new FormAttachment(sc,5);
+// cdcData.bottom = new FormAttachment(100,-5);
+// configDataComposite.setLayoutData(cdcData);
+// checkPageComplete();
+// }
+//
+// protected class ConfigDataComposite extends Composite {
+// private TempLaunchConfiguration currentConfig;
+//
+// private Label launchConfigName, homeDir, jbConfig, startArgs, stopArgs, jre;
+//
+// public ConfigDataComposite(Composite parent, int style) {
+// super(parent, style);
+//
+// setLayout(new FormLayout());
+//
+//
+// Label detailLabel = new Label(this, SWT.NONE);
+// FormData dld = new FormData();
+// dld.left = new FormAttachment(0,5);
+// dld.top = new FormAttachment(0,5);
+// detailLabel.setLayoutData(dld);
+// detailLabel.setText(Messages.UpgradeWizardDetails);
+//
+// Composite detailComposite = new Composite(this, SWT.NONE);
+// detailComposite.setLayout(new GridLayout(2, false));
+// FormData detailCompositeData = new FormData();
+// detailCompositeData.left = new FormAttachment(0,20);
+// detailCompositeData.top = new FormAttachment(detailLabel, 5);
+// detailComposite.setLayoutData(detailCompositeData);
+//
+//
+//
+// new Label(detailComposite,
SWT.NONE).setText(Messages.UpgradeWizardLaunchConfigName);
+// launchConfigName = new Label(detailComposite, SWT.NONE);
+//
+// new Label(detailComposite, SWT.NONE).setText(Messages.UpgradeWizardLaunchHomeDir);
+// homeDir = new Label(detailComposite, SWT.NONE);
+//
+// new Label(detailComposite,
SWT.NONE).setText(Messages.UpgradeWizardLaunchJBossConfig);
+// jbConfig = new Label(detailComposite, SWT.NONE);
+//
+// new Label(detailComposite,
SWT.NONE).setText(Messages.UpgradeWizardLaunchStartArgs);
+// startArgs = new Label(detailComposite, SWT.NONE);
+//
+// new Label(detailComposite,
SWT.NONE).setText(Messages.UpgradeWizardLaunchShutdownArgs);
+// stopArgs = new Label(detailComposite, SWT.NONE);
+//
+// new Label(detailComposite, SWT.NONE).setText(Messages.UpgradeWizardLaunchJRE);
+// jre = new Label(detailComposite, SWT.NONE);
+// }
+//
+// public void setInput(TempLaunchConfiguration config) {
+// if( config != currentConfig) {
+// currentConfig = config;
+// try {
+// launchConfigName.setText(config.getName());
+// homeDir.setText(config.getAttribute("org.jboss.rocklet.HomeDir",
""));
+// jbConfig.setText(config.getAttribute("org.jboss.rocklet.ServerConfiguration",
""));
+// startArgs.setText(config.getAttribute("org.rocklet.launcher.userProgramArgs",
""));
+// stopArgs.setText(config.getAttribute("org.rocklet.launcher.userShutdownProgramArgs",
""));
+//
+// IVMInstall vm = config.getJVMItem();
+// String vmName = vm == null ? "" : vm.getName();
+// jre.setText(vmName);
+// layout();
+// } catch( CoreException ce ) {
+// ce.printStackTrace();
+// }
+// }
+// }
+// }
+//
+// protected void fillScrolledComposite(ScrolledComposite sc) {
+//
+// Composite main = new Composite(sc, SWT.NONE);
+// main.setLayout(new GridLayout(4, false));
+// sc.setContent(main);
+//
+//
+//
+// // add headings
+// Label convertLabel = new Label(main, SWT.NONE);
+// convertLabel.setText(Messages.UpgradeWizardLaunchConvert);
+// Label configName = new Label(main, SWT.NONE);
+// configName.setText(Messages.UpgradeWizardLaunchConfigName2);
+// Label runtimeLabel = new Label(main, SWT.NONE);
+// runtimeLabel.setText(Messages.UpgradeWizardLaunchRuntimeName);
+// Label serverLabel = new Label(main, SWT.NONE);
+// serverLabel.setText(Messages.UpgradeWizardLaunchServerName);
+//
+// for( int i = 0; i < configs.length; i++ ) {
+// // should add the 4 widgets itself
+// ConfigurationRow row = new ConfigurationRow(configs[i], main);
+// rows.add(row);
+// }
+//
+//
+// // force a layout
+// main.pack();
+//
+// int locY = main.getLocation().y;
+// int locX = main.getLocation().x;
+// int sY = main.getSize().y;
+// int sX = main.getSize().x;
+//
+//
+// sc.setExpandHorizontal(true);
+// sc.setExpandVertical(true);
+// sc.setMinHeight(locY + sY);
+// sc.setMinWidth(locX + sX);
+//
+// sc.setSize(300,150);
+// }
+//
+//
+// public void initialize() {
+// converter = new ASLaunchConfigurationConverter();
+// configs = converter.getConvertableConfigurations();
+// }
+//
+// public void performFinishWithProgress(IProgressMonitor monitor) {
+// monitor.beginTask(Messages.UpgradeWizardLaunchMonitorMainTask, rows.size() * 100);
+// monitor.setTaskName(Messages.UpgradeWizardLaunchMonitorMainTask);
+// Iterator i = rows.iterator();
+// while(i.hasNext()) {
+// ConfigurationRow r = (ConfigurationRow)i.next();
+// if( r.getSelected() ) {
+// // now convert
+// monitor.subTask(Messages.UpgradeWizardLaunchMonitorConverting +
r.getLaunchConfig().getName());
+// try {
+// converter.convertConfiguration(r.getLaunchConfig(),
+// r.getRuntimeName(), r.getServerName());
+// } catch( CoreException ce ) {
+// ce.printStackTrace();
+// }
+// }
+// }
+// monitor.done();
+// }
+//
+// public boolean isPageComplete() {
+// return pageComplete;
+// }
+//
+// protected void checkPageComplete() {
+// pageComplete = true; // start it off true. If it remains true, great
+// HashMap map = new HashMap();
+//
+//
+//
+// String server_prefix = "__SP__";
+// String rt_prefix = "__RT__";
+//
+// IRuntime[] rts = ServerCore.getRuntimes();
+// IServer[] servers = ServerCore.getServers();
+//
+// for( int i = 0; i < rts.length; i++ ) {
+// map.put(rt_prefix + rts[i].getName(), "");
+// }
+// for( int i = 0; i < servers.length; i++ ) {
+// map.put(server_prefix + servers[i].getName(), "");
+// }
+//
+// ArrayList runtimeCollisions = new ArrayList();
+// ArrayList serverCollisions = new ArrayList();
+//
+// Iterator i = rows.iterator();
+// while(i.hasNext()) {
+// ConfigurationRow r = (ConfigurationRow)i.next();
+// if( r.getSelected()) {
+// if( !map.containsKey(rt_prefix + r.getRuntimeName())
+// && !map.containsKey(server_prefix + r.getServerName())) {
+// map.put(rt_prefix + r.getRuntimeName(), "");
+// map.put(server_prefix + r.getServerName(), "");
+// } else {
+// if( map.containsKey(rt_prefix + r.getRuntimeName()))
+// runtimeCollisions.add(r.getRuntimeName());
+// if( map.containsKey(server_prefix + r.getServerName()))
+// serverCollisions.add(r.getServerName());
+//
+// pageComplete = false;
+// }
+// }
+// }
+//
+// if( runtimeCollisions.size() == 0 && serverCollisions.size() == 0 ) {
+// errorMessage = null;
+// } else {
+// errorMessage = "";
+// String[] sc = (String[]) serverCollisions.toArray(new
String[serverCollisions.size()]);
+// String[] rtc = (String[]) runtimeCollisions.toArray(new
String[runtimeCollisions.size()]);
+// if( rtc.length > 0 )
+// errorMessage += Messages.UpgradeWizardLaunchRuntimeNamesInUse + implode(rtc,
", ") + "\n";
+// if( sc.length > 0 )
+// errorMessage += Messages.UpgradeWizardLaunchServerNamesInUse + implode(sc,
", ");
+// }
+// setErrorMessage(errorMessage);
+// }
+//
+// protected String implode(String[] array, String separator) {
+// if( array.length == 0 ) return "";
+// String ret = "";
+// for( int i = 0; i < array.length; i++ ) {
+// ret += array[i] + separator;
+// }
+// return ret.substring(0, ret.length() - separator.length());
+// }
+//
+// protected class ConfigurationRow {
+// private TempLaunchConfiguration config;
+//
+// private Button shouldConvert;
+// private Label nameLabel;
+// private Text runtimeText;
+// private Text serverText;
+//
+// public ConfigurationRow(TempLaunchConfiguration config, Composite parent) {
+// this.config = config;
+//
+// shouldConvert = new Button(parent, SWT.CHECK);
+// shouldConvert.setSelection(true);
+// GridData shouldConvertData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+// shouldConvert.setLayoutData(shouldConvertData);
+//
+// nameLabel = new Label(parent, SWT.NONE);
+// nameLabel.setText(config.getName());
+//
+// runtimeText = new Text(parent, SWT.BORDER);
+// runtimeText.setText(config.getName() + " Runtime");
+//
+// GridData rtgd = new GridData(GridData.FILL_HORIZONTAL);
+// runtimeText.setLayoutData(rtgd);
+//
+// serverText = new Text(parent, SWT.BORDER);
+// serverText.setText(config.getName());
+// GridData stgd = new GridData(GridData.FILL_HORIZONTAL);
+// serverText.setLayoutData(stgd);
+//
+//
+//
+// // listeners
+// SelectionListener listener = new SelectionListener() {
+// public void widgetDefaultSelected(SelectionEvent e) {
+// }
+//
+// public void widgetSelected(SelectionEvent e) {
+// checkPageComplete();
+// getContainer().updateButtons();
+// }
+// };
+// ModifyListener modListener = new ModifyListener() {
+// public void modifyText(ModifyEvent e) {
+// checkPageComplete();
+// getContainer().updateButtons();
+// }
+// };
+// shouldConvert.addSelectionListener(listener);
+// runtimeText.addModifyListener(modListener);
+// serverText.addModifyListener(modListener);
+//
+// final TempLaunchConfiguration config2 = config;
+// Listener mmListener = new Listener() {
+// public void handleEvent(Event event) {
+// if( event.type == SWT.MouseMove) {
+// configDataComposite.setInput(config2);
+// }
+// }
+// };
+// shouldConvert.addListener(SWT.MouseMove, mmListener);
+// runtimeText.addListener(SWT.MouseMove, mmListener);
+// serverText.addListener(SWT.MouseMove, mmListener);
+// nameLabel.addListener(SWT.MouseMove, mmListener);
+// }
+//
+// public boolean getSelected() {
+// return shouldConvert.getSelection();
+// }
+// public String getName() {
+// return nameLabel.getText();
+// }
+// public String getRuntimeName() {
+// return runtimeText.getText();
+// }
+// public String getServerName() {
+// return serverText.getText();
+// }
+// public TempLaunchConfiguration getLaunchConfig() {
+// return config;
+// }
+// }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2007-09-05 18:12:31 UTC (rev
3465)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2007-09-06 04:52:32 UTC (rev
3466)
@@ -70,7 +70,7 @@
class="org.jboss.ide.eclipse.as.ui.launch.JBossLaunchConfigurationTabGroup"
description="%jbossLaunchconfigurationTabGroupDescription"
id="org.jboss.ide.eclipse.as.core.jbossLaunchTabGroup"
-
type="org.jboss.ide.eclipse.as.core.server.launchConfiguration"/>
+
type="org.jboss.ide.eclipse.as.core.server.startupConfiguration"/>
</extension>