Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 169629 Details for
Bug 309899
[terminal][local] New local terminal launch configurations should have reasonable default values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch addressing the issues mentioned in comments #10 and 13
terminal.patch (text/plain), 13.33 KB, created by
Mirko Raner
on 2010-05-24 02:22:45 EDT
(
hide
)
Description:
Patch addressing the issues mentioned in comments #10 and 13
Filename:
MIME Type:
Creator:
Mirko Raner
Created:
2010-05-24 02:22:45 EDT
Size:
13.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tm.terminal.local >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- plugin.xml 28 Feb 2010 20:59:49 -0000 1.1 >+++ plugin.xml 24 May 2010 06:05:40 -0000 >@@ -1,7 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.3"?> > <!-- >-# Copyright (c) 2008 Mirko Raner and others >+# Copyright (c) 2008, 2010 Mirko Raner and others > # All rights reserved. This program and the accompanying materials > # are made available under the terms of the Eclipse Public License v1.0 > # which accompanies this distribution, and is available at >@@ -37,6 +37,7 @@ > id="org.eclipse.tm.terminal.local.launch" > delegate="org.eclipse.tm.internal.terminal.local.launch.LocalTerminalLaunchDelegate" > category="org.eclipse.ui.externaltools" >+ public="false" > modes="run" > /> > </extension> >Index: src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java,v >retrieving revision 1.3 >diff -u -r1.3 LocalTerminalConnector.java >--- src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java 22 May 2010 00:50:13 -0000 1.3 >+++ src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java 24 May 2010 06:05:40 -0000 >@@ -269,6 +269,9 @@ > } > catch (CoreException exception) { > >+ control.setState(TerminalState.CLOSED); >+ Shell shell = LocalTerminalSettingsPage.getShell(); >+ ErrorDialog.openError(shell, null, null, exception.getStatus()); > Logger.logException(exception); > } > } >Index: src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java,v >retrieving revision 1.3 >diff -u -r1.3 LocalTerminalMessages.java >--- src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java 22 May 2010 00:50:13 -0000 1.3 >+++ src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java 24 May 2010 06:05:40 -0000 >@@ -41,6 +41,9 @@ > /** The label for the "Edit..." button. */ > public static String labelEdit; > >+ /** The label for the "Delete" button. */ >+ public static String labelDelete; >+ > /** The label for the "Enable terminal echo" check box. */ > public static String enableLocalEcho; > >@@ -80,6 +83,12 @@ > /** The error message for an invalid working directory location. */ > public static String invalidWorkingDirectory; > >+ /** The question message for confirming deletion of a launch configuration. */ >+ public static String questionDeleteLaunchConfiguration; >+ >+ /** The question title for confirming deletion of a launch configuration. */ >+ public static String questionTitleDeleteLaunchConfiguration; >+ > /** The error message for attempting to directly launch a Terminal launch configuration. */ > public static String errorDirectLaunch; > >Index: src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties,v >retrieving revision 1.3 >diff -u -r1.3 LocalTerminalMessages.properties >--- src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties 22 May 2010 00:50:13 -0000 1.3 >+++ src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties 24 May 2010 06:05:40 -0000 >@@ -18,6 +18,7 @@ > lineSeparatorCR=CR > labelNew=New... > labelEdit=Edit... >+labelDelete=Delete > terminalTabName=Terminal > terminalSettings=Terminal settings\: > newTerminalLaunchName=New Terminal Launch >@@ -28,6 +29,8 @@ > invalidLocation=Executable does not exist for the external tool named ''{0}'' > invalidWorkingDirectory=The path {0} is not a directory and cannot be used as working directory \ > for ''{1}'' >+questionDeleteLaunchConfiguration=Do you wish to delete the selected launch configuration? >+questionTitleDeleteLaunchConfiguration=Confirm Launch Configuration Deletion > errorDirectLaunch=Terminal launch configurations can only be launched from the Terminal view. \ > Please open the Terminal view and click the view's Settings button to select and launch a local \ > Terminal. >Index: src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettingsPage.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettingsPage.java,v >retrieving revision 1.3 >diff -u -r1.3 LocalTerminalSettingsPage.java >--- src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettingsPage.java 22 May 2010 00:50:13 -0000 1.3 >+++ src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettingsPage.java 24 May 2010 06:05:40 -0000 >@@ -12,14 +12,13 @@ > package org.eclipse.tm.internal.terminal.local; > > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationType; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.debug.core.ILaunchManager; >-import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.ILaunchGroup; >+import org.eclipse.jface.dialogs.ErrorDialog; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.SelectionChangedEvent; >@@ -41,6 +40,9 @@ > import org.eclipse.tm.internal.terminal.local.ui.DependentHeightComposite; > import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; > import org.eclipse.tm.internal.terminal.provisional.api.Logger; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; > > /** > * The class {@link LocalTerminalSettingsPage} is an implementation {@link ISettingsPage} for >@@ -56,6 +58,7 @@ > private TableViewer viewer; > private Button buttonEdit; > private Button buttonNew; >+ private Button buttonDelete; > > /** > * Creates a new {@link LocalTerminalSettingsPage} that reflects the settings of the specified >@@ -117,10 +120,12 @@ > viewer.setContentProvider(new LocalTerminalLaunchListProvider()); > viewer.setInput(new Object()); > viewer.addSelectionChangedListener(this); >- table.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 0, 2)); >+ table.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 0, 3)); > buttonNew = pushButton(tableAndButtons, LocalTerminalMessages.labelNew, false); >- buttonEdit = pushButton(tableAndButtons, LocalTerminalMessages.labelEdit, true); >+ buttonEdit = pushButton(tableAndButtons, LocalTerminalMessages.labelEdit, false); > buttonEdit.setEnabled(settings.getLaunchConfigurationName() != null); >+ buttonDelete = pushButton(tableAndButtons, LocalTerminalMessages.labelDelete, true); >+ buttonDelete.setEnabled(settings.getLaunchConfigurationName() != null); > // > // NOTE: echo and line separator settings were moved to the launch configuration! > >@@ -196,14 +201,15 @@ > } > > /** >- * Enables or disables the Edit... button depending on whether a launch configuration is >- * currently selected in the viewer. >+ * Enables or disables the Edit... and Delete buttons depending on whether a launch >+ * configuration is currently selected in the viewer. > * > * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent) > */ > public void selectionChanged(SelectionChangedEvent event) { > > buttonEdit.setEnabled(!event.getSelection().isEmpty()); >+ buttonDelete.setEnabled(!event.getSelection().isEmpty()); > } > > /** >@@ -236,15 +242,11 @@ > } > if (widget.equals(buttonNew)) { > >- ILaunchConfigurationWorkingCopy newlyCreatedConfiguration; >- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); >- String baseName = LocalTerminalMessages.newTerminalLaunchName; >- String uniqueName = launchManager.generateLaunchConfigurationName(baseName); >- ILaunchConfigurationType type = LocalTerminalUtilities.TERMINAL_LAUNCH_TYPE; > try { > >- newlyCreatedConfiguration = type.newInstance(null, uniqueName); >- configuration = newlyCreatedConfiguration.doSave(); >+ ILaunchConfigurationWorkingCopy newLaunch; >+ newLaunch = LocalTerminalLaunchUtilities.createNewLaunchConfigurationWorkingCopy(); >+ configuration = newLaunch.doSave(); > } > catch (CoreException couldNotCreateNewLaunchConfiguration) { > >@@ -254,7 +256,6 @@ > if (widget.equals(buttonEdit) || configuration != null) { > > ILaunchGroup group; >- Shell shell = DebugUIPlugin.getShell(); > IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); > if (configuration == null) { > >@@ -262,14 +263,11 @@ > } > group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.RUN_MODE); > String groupID = group.getIdentifier(); >- DebugUITools.openLaunchConfigurationDialog(shell, configuration, groupID, null); >+ DebugUITools.openLaunchConfigurationDialog(getShell(), configuration, groupID, null); > // > // TODO: handle return value (maybe start terminal right away if "Run" was selected) > // - a return value of Window.CANCEL indicates that "Close" was selected > // - a return value of Window.OK indicates that "Run" was selected >- // TODO: prevent "Run" button from launching in the regular console >- // (maybe tweak process factory settings before opening the configuration in the >- // dialog?) > > viewer.refresh(); > viewer.setSelection(new StructuredSelection(configuration), true); >@@ -279,6 +277,37 @@ > // creates a different ILaunchConfiguration object, rather than just renaming the > // existing one) > } >+ if (widget.equals(buttonDelete)) { >+ >+ String title = LocalTerminalMessages.questionTitleDeleteLaunchConfiguration; >+ String question = LocalTerminalMessages.questionDeleteLaunchConfiguration; >+ if (MessageDialog.openQuestion(getShell(), title, question)) { >+ >+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); >+ configuration = (ILaunchConfiguration)selection.getFirstElement(); >+ try { >+ >+ configuration.delete(); >+ } >+ catch (CoreException exception) { >+ >+ ErrorDialog.openError(getShell(), null, null, exception.getStatus()); >+ } >+ viewer.refresh(); >+ } >+ } >+ } >+ >+ static Shell getShell() { >+ >+ IWorkbench workbench = PlatformUI.getWorkbench(); >+ IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow(); >+ if (activeWindow != null) { >+ >+ return activeWindow.getShell(); >+ } >+ IWorkbenchWindow[] allWindows = workbench.getWorkbenchWindows(); >+ return allWindows.length > 0? allWindows[0].getShell():null; > } > > //------------------------------------ PRIVATE SECTION ---------------------------------------// >Index: src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java,v >retrieving revision 1.3 >diff -u -r1.3 LocalTerminalLaunchUtilities.java >--- src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java 22 May 2010 00:50:14 -0000 1.3 >+++ src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java 24 May 2010 06:05:40 -0000 >@@ -226,10 +226,13 @@ > ILaunchConfigurationWorkingCopy workingCopy; > ILaunchManager manager = LocalTerminalUtilities.LAUNCH_MANAGER; > String userHome = System.getProperty("user.home", "/"); //$NON-NLS-1$//$NON-NLS-2$ >- String name = manager.generateLaunchConfigurationName("Terminal"); //$NON-NLS-1$ >+ String defaultShell = getDefaultShell().getAbsolutePath(); >+ String name = defaultShell.substring(defaultShell.lastIndexOf(File.separator) + 1); >+ name = manager.generateLaunchConfigurationName("Terminal (" + name + ')'); //$NON-NLS-1$ > workingCopy = LocalTerminalUtilities.TERMINAL_LAUNCH_TYPE.newInstance(null, name); >- workingCopy.setAttribute(ATTR_LOCATION, getDefaultShell().getAbsolutePath()); >+ workingCopy.setAttribute(ATTR_LOCATION, defaultShell); > workingCopy.setAttribute(ATTR_WORKING_DIRECTORY, userHome); >+ workingCopy.setAttribute(ATTR_LOCAL_ECHO, runningOnWindows()); > return workingCopy; > } > >@@ -246,7 +249,7 @@ > String shell = System.getenv("SHELL"); //$NON-NLS-1$ > if (shell == null) { > >- if (Platform.OS_WIN32.equals(Platform.getOS())) { >+ if (runningOnWindows()) { > > shell = "C:\\Windows\\System32\\cmd.exe"; //$NON-NLS-1$ > } >@@ -260,6 +263,11 @@ > > //------------------------------------- PRIVATE SECTION --------------------------------------// > >+ private static boolean runningOnWindows() { >+ >+ return Platform.OS_WIN32.equals(Platform.getOS()); >+ } >+ > private static IStringVariableManager getStringVariableManager() { > > return VariablesPlugin.getDefault().getStringVariableManager();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mober.at+eclipse
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 309899
:
168664
| 169629