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 98730 Details for
Bug 227535
[rseterminal][api] terminals.ui should not depend on files.core
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Partial patch (just the new handler and externalized view name)
bug227535_terminalCommandHandler.diff.txt (text/plain), 10.07 KB, created by
Martin Oberhuber
on 2008-05-05 19:01:08 EDT
(
hide
)
Description:
Partial patch (just the new handler and externalized view name)
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2008-05-05 19:01:08 EDT
Size:
10.07 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.terminals.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/plugin.properties,v >retrieving revision 1.2 >diff -u -r1.2 plugin.properties >--- plugin.properties 17 Apr 2008 11:00:38 -0000 1.2 >+++ plugin.properties 5 May 2008 22:57:32 -0000 >@@ -6,7 +6,8 @@ > # http://www.eclipse.org/legal/epl-v10.html > # > # Contributors: >-# Yu-Fen Kuo (MontaVista) - initial API and implementation >+# Yu-Fen Kuo (MontaVista) - initial API and implementation >+# Anna Dushistova (MontaVista) - [227535][rseterminal][api] terminals.ui should not depend on files.core > ############################################################################### > > # NLS_MESSAGEFORMAT_NONE >@@ -15,6 +16,6 @@ > pluginName = RSE Terminals UI (Incubation) > providerName = Eclipse.org > >- >+terminalsView.name = Terminals > > Launch_Terminal_Tooltip=Launch a terminal from the selected directory >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- plugin.xml 16 Apr 2008 20:56:36 -0000 1.1 >+++ plugin.xml 5 May 2008 22:57:32 -0000 >@@ -14,6 +14,7 @@ > Contributors: > Martin Oberhuber (Wind River) - [180519] declaratively register adapter factories > Yu-Fen Kuo (MontaVista) - [170910] Integrate Terminal with RSE >+Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core > --> > <?eclipse version="3.2"?> > <plugin> >@@ -39,7 +40,7 @@ > <extension > point="org.eclipse.ui.views"> > <view >- name="Terminals" >+ name="%terminalsView.name" > icon="icons/terminal_view.gif" > category="org.eclipse.rse.ui.view" > class="org.eclipse.rse.internal.terminals.ui.views.TerminalViewer" >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.3 >diff -u -r1.3 MANIFEST.MF >--- META-INF/MANIFEST.MF 25 Apr 2008 20:14:53 -0000 1.3 >+++ META-INF/MANIFEST.MF 5 May 2008 22:57:32 -0000 >@@ -20,4 +20,6 @@ > Export-Package: org.eclipse.rse.internal.terminals.ui;x-internal:=true, > org.eclipse.rse.internal.terminals.ui.actions;x-internal:=true, > org.eclipse.rse.internal.terminals.ui.configuration.adapter;x-internal:=true, >+ org.eclipse.rse.internal.terminals.ui.handlers;x-internal:=true, > org.eclipse.rse.internal.terminals.ui.views;x-internal:=true >+Bundle-Localization: plugin >Index: src/org/eclipse/rse/internal/terminals/ui/handlers/LaunchTerminalCommandHandler.java >=================================================================== >RCS file: src/org/eclipse/rse/internal/terminals/ui/handlers/LaunchTerminalCommandHandler.java >diff -N src/org/eclipse/rse/internal/terminals/ui/handlers/LaunchTerminalCommandHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/internal/terminals/ui/handlers/LaunchTerminalCommandHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,175 @@ >+/******************************************************************************** >+ * Copyright (c) 2002, 2008 IBM Corporation 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 http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Initial Contributors: >+ * The following IBM employees contributed to the Remote System Explorer >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >+ * >+ * Contributors: >+ * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect() >+ * Kevin Doyle (IBM) - [187083] Launch Shell action available on folders inside virtual files >+ * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible >+ * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandAction >+ * Anna Dushistova (MontaVista) - [227535] Adapted from LaunchTerminalAction to remove dependecy from files.core >+ ********************************************************************************/ >+package org.eclipse.rse.internal.terminals.ui.handlers; >+ >+import java.util.Iterator; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.rse.core.filters.ISystemFilterReference; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.rse.core.subsystems.ISubSystem; >+import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper; >+import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer; >+import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI; >+import org.eclipse.rse.services.clientserver.PathUtility; >+import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; >+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; >+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; >+import org.eclipse.rse.ui.SystemBasePlugin; >+import org.eclipse.rse.ui.view.ISystemPropertyConstants; >+import org.eclipse.rse.ui.view.ISystemViewElementAdapter; >+import org.eclipse.swt.custom.CTabItem; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public class LaunchTerminalCommandHandler extends AbstractHandler { >+ >+ private ITerminalServiceSubSystem subSystem; >+ private Object selected; >+ private ISystemFilterReference selectedFilterRef; >+ >+ public LaunchTerminalCommandHandler() { >+ } >+ >+ private IHost getCurrentHost(IAdaptable adaptable) { >+ IHost currentHost = null; >+ >+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) adaptable >+ .getAdapter(ISystemViewElementAdapter.class); >+ if (adapter != null) { >+ ISubSystem ss = adapter.getSubSystem(adaptable); >+ if (ss != null) { >+ currentHost = ss.getHost(); >+ } >+ } >+ return currentHost; >+ } >+ >+ private ITerminalServiceSubSystem getTerminalSubSystem() { >+ IHost currentHost = null; >+ >+ if (selectedFilterRef != null) { >+ currentHost = getCurrentHost((IAdaptable) selectedFilterRef); >+ } else if (selected != null) { >+ currentHost = getCurrentHost((IAdaptable) selected); >+ } >+ if (currentHost != null) { >+ return TerminalServiceHelper.getTerminalSubSystem(currentHost); >+ >+ } >+ return subSystem; >+ } >+ >+ private Object getTargetFromFilter() { >+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) selectedFilterRef) >+ .getAdapter(ISystemViewElementAdapter.class); >+ if (adapter != null) { >+ ISubSystem ss = adapter.getSubSystem(selectedFilterRef); >+ if (ss != null) { >+ Object target = ss.getTargetForFilter(selectedFilterRef); >+ if (target != null) { >+ return target; >+ } >+ } >+ } >+ return null; >+ } >+ >+ private void init(IStructuredSelection selection) { >+ Iterator e = selection.iterator(); >+ Object selectedObject = e.next(); >+ if (selectedObject != null) { >+ if (selectedObject instanceof ISystemFilterReference) { >+ selectedFilterRef = (ISystemFilterReference) selectedObject; >+ selected = getTargetFromFilter(); >+ } else if (selectedObject instanceof ITerminalServiceSubSystem) { >+ subSystem = (ITerminalServiceSubSystem) selectedObject; >+ } else { >+ selected = selectedObject; >+ } >+ } >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ init((IStructuredSelection) HandlerUtil.getCurrentSelection(event)); >+ ITerminalServiceSubSystem terminalSubSystem = getTerminalSubSystem(); >+ if (terminalSubSystem != null) { >+ TerminalsUI terminalsUI = TerminalsUI.getInstance(); >+ TerminalViewer viewer = terminalsUI.activateTerminalsView(); >+ if (!terminalSubSystem.isConnected()) { >+ try { >+ terminalSubSystem.connect(new NullProgressMonitor(), false); >+ } catch (OperationCanceledException e) { >+ // user canceled, return silently >+ return null; >+ } catch (Exception e) { >+ SystemBasePlugin.logError(e.getLocalizedMessage(), e); >+ } >+ } >+ if (terminalSubSystem.isConnected()) { >+ CTabItem tab = viewer.getTabFolder().createTabItem( >+ terminalSubSystem.getHost(), getInitialDirectoryCmd()); >+ TerminalElement element = TerminalServiceHelper >+ .createTerminalElement(tab, terminalSubSystem); >+ terminalSubSystem.addChild(element); >+ >+ } >+ } >+ return null; >+ } >+ >+ private String getInitialDirectoryCmd() { >+ if (selected == null) >+ return null; >+ String path = getWorkingDirectory(selected); >+ >+ String cdCmd = "cd " + PathUtility.enQuoteUnix(path); //$NON-NLS-1$ >+ if (getTerminalSubSystem().getHost().getSystemType().isWindows()) { >+ cdCmd = "cd /d \"" + path + '\"'; //$NON-NLS-1$ >+ } >+ return cdCmd + "\r"; //$NON-NLS-1$ >+ } >+ >+ private String getWorkingDirectory(Object element) { >+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element) >+ .getAdapter(ISystemViewElementAdapter.class); >+ if (adapter != null) { >+ String path = (String) adapter >+ .getPropertyValue(ISystemPropertyConstants.P_FILE_CANONICAL_PATH); >+ // folder -- real or virtual >+ if (ArchiveHandlerManager.isVirtual(path)) { >+ path = path >+ .substring( >+ 0, >+ path >+ .indexOf(ArchiveHandlerManager.VIRTUAL_CANONICAL_SEPARATOR)); >+ } >+ return path; >+ } >+ return null; >+ } >+ >+ >+}
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
Actions:
View
|
Diff
Attachments on
bug 227535
:
98462
|
98531
| 98730 |
98943