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 98531 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]
improved version
terminals.ui-propertyTesters.diff (text/plain), 40.91 KB, created by
Anna Dushistova
on 2008-05-03 11:43:41 EDT
(
hide
)
Description:
improved version
Filename:
MIME Type:
Creator:
Anna Dushistova
Created:
2008-05-03 11:43:41 EDT
Size:
40.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.terminals.ui >Index: src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java >=================================================================== >RCS file: src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java >diff -N src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java >--- src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java 17 Apr 2008 10:47:26 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,55 +0,0 @@ >-/******************************************************************************** >- * Copyright (c) 2006, 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) - [168870] refactor org.eclipse.rse.core package of the UI plugin >- * Yu-Fen Kuo (MontaVista) - Adapted from LaunchShellActionDelegate >- ********************************************************************************/ >- >-package org.eclipse.rse.internal.terminals.ui.actions; >- >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.rse.ui.SystemBasePlugin; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.ui.IActionDelegate; >-import org.eclipse.ui.actions.ActionDelegate; >- >-public class LaunchTerminalActionDelegate extends ActionDelegate implements >- IActionDelegate { >- >- private LaunchTerminalAction launchTerminalAction; >- private ISelection selection; >- >- public void run(IAction action) { >- if (launchTerminalAction == null) { >- launchTerminalAction = new LaunchTerminalAction(SystemBasePlugin >- .getActiveWorkbenchShell(), null); >- } >- launchTerminalAction.updateSelection((IStructuredSelection) selection); >- launchTerminalAction.run(); >- } >- >- public void runWithEvent(IAction action, Event event) { >- super.runWithEvent(action, event); >- } >- >- public void selectionChanged(IAction action, ISelection selection) { >- super.selectionChanged(action, selection); >- this.selection = selection; >- } >- >- public LaunchTerminalActionDelegate() { >- } >- >-} >Index: src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java >=================================================================== >RCS file: src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java >diff -N src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java >--- src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java 25 Apr 2008 21:39:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,273 +0,0 @@ >-/******************************************************************************** >- * 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) - Fix 154874 - handle files with space or $ in the name >- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API >- * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui >- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() >- * 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 >- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared >- * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandAction >- * Martin Oberhuber (Wind River) - [149285] [ssh] multiple prompts and errors in case of incorrect username >- ********************************************************************************/ >- >-package org.eclipse.rse.internal.terminals.ui.actions; >- >-import java.util.Iterator; >- >-import org.eclipse.core.runtime.IAdaptable; >-import org.eclipse.core.runtime.NullProgressMonitor; >-import org.eclipse.core.runtime.OperationCanceledException; >-import org.eclipse.jface.resource.ImageDescriptor; >-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.Activator; >-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.services.clientserver.messages.SystemMessageException; >-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; >-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; >-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.actions.SystemBaseAction; >-import org.eclipse.rse.ui.view.ISystemViewElementAdapter; >-import org.eclipse.swt.custom.CTabItem; >-import org.eclipse.swt.widgets.Shell; >- >-/** >- * action to launch a terminal from either the terminal subsystem or selected >- * directory >- * >- */ >-public class LaunchTerminalAction extends SystemBaseAction { >- >- private ITerminalServiceSubSystem subSystem; >- private IRemoteFile selected; >- private ISystemFilterReference selectedFilterRef; >- >- public LaunchTerminalAction(String text, ImageDescriptor image, Shell shell) { >- super(text, image, shell); >- } >- >- /** >- * Constructor for LaunchTerminalAction >- * >- * @param parent >- * @param subSystem >- * the terminal subsystem to use if launching a terminal >- */ >- public LaunchTerminalAction(Shell parent, >- ITerminalServiceSubSystem subSystem) { >- this(Activator.getResourceString("LaunchTerminalAction.title"), //$NON-NLS-1$ >- Activator.getResourceString("LaunchTerminalAction.tooltip"), //$NON-NLS-1$ >- parent, subSystem); >- } >- >- /** >- * Constructor for LaunchTerminalAction >- * >- * @param title >- * title of the action >- * @param tooltip >- * tooltip of the action >- * @param parent >- * @param subSystem >- * the terminal subsystem to use if launching a terminal >- */ >- public LaunchTerminalAction(String title, String tooltip, Shell parent, >- ITerminalServiceSubSystem subSystem) { >- this(title, tooltip, Activator.getDefault().getImageDescriptor( >- Activator.ICON_ID_LAUNCH_TERMINAL), parent, >- >- subSystem); >- } >- >- /** >- * Constructor for LaunchTerminalAction >- * >- * @param title >- * title of the action >- * @param tooltip >- * tooltip of the action >- * @param descriptor >- * image descriptor to be displayed for this action >- * @param parent >- * @param subSystem >- * the terminal subsystem to use if launching a terminal >- */ >- public LaunchTerminalAction(String title, String tooltip, >- ImageDescriptor descriptor, Shell parent, >- ITerminalServiceSubSystem subSystem) { >- super(title, tooltip, descriptor, parent); >- this.subSystem = subSystem; >- >- } >- >- /** >- * @return the terminal subsystem >- */ >- public ITerminalServiceSubSystem getSubSystem() { >- return subSystem; >- } >- >- /** >- * settor for the terminal subsystem >- * >- * @param subSystem >- * terminal subsystem >- */ >- public void setSubSystem(ITerminalServiceSubSystem subSystem) { >- this.subSystem = subSystem; >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) >- */ >- public boolean updateSelection(IStructuredSelection selection) { >- boolean enable = false; >- >- Iterator e = selection.iterator(); >- Object selectedObject = e.next(); >- >- if (selectedObject != null) { >- if (selectedObject instanceof ISystemFilterReference) { >- selectedFilterRef = (ISystemFilterReference) selectedObject; >- selected = null; >- enable = true; >- } >- if (selectedObject instanceof IRemoteFile) { >- selected = (IRemoteFile) selectedObject; >- selectedFilterRef = null; >- IHost host = selected.getParentRemoteFileSubSystem().getHost(); >- subSystem = TerminalServiceHelper.getTerminalSubSystem(host); >- // If the selected object is a virtual folder then we need to >- // select the parent >- // of the archive >- if (ArchiveHandlerManager.isVirtual(selected.getAbsolutePath())) { >- IRemoteFileSubSystem rfss = selected >- .getParentRemoteFileSubSystem(); >- String file = selected.getAbsolutePath(); >- // Get the archive's path >- file = file.substring(0, file >- .indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR)); >- // Get the parent of the archive's path >- file = file.substring(0, file.lastIndexOf(selected >- .getSeparator())); >- try { >- selected = rfss.getRemoteFileObject(file, null); >- } catch (SystemMessageException exc) { >- } >- } >- if (!selected.isFile()) { >- enable = checkObjectType(selected); >- } >- } else if (selectedObject instanceof ITerminalServiceSubSystem) { >- subSystem = (ITerminalServiceSubSystem) selectedObject; >- enable = true; >- } >- } >- >- return enable; >- } >- >- private ITerminalServiceSubSystem getTerminalSubSystem() { >- IHost currentHost = null; >- >- if (selectedFilterRef != null) { >- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) selectedFilterRef) >- .getAdapter(ISystemViewElementAdapter.class); >- if (adapter != null) { >- ISubSystem ss = adapter.getSubSystem(selectedFilterRef); >- if (ss != null) { >- currentHost = ss.getHost(); >- } >- } >- } else if (selected != null) { >- currentHost = selected.getSystemConnection(); >- } >- if (currentHost != null) { >- return TerminalServiceHelper.getTerminalSubSystem(currentHost); >- >- } >- >- return getSubSystem(); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.rse.ui.actions.SystemBaseAction#run() >- */ >- public void run() { >- if (selectedFilterRef != null) { >- 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 && target instanceof IRemoteFile) { >- selected = (IRemoteFile) target; >- } >- } >- } >- } >- >- 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; >- } 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); >- >- } >- } >- } >- >- private String getInitialDirectoryCmd() { >- if (selected == null) >- return null; >- String path = TerminalServiceHelper.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$ >- } >- >-} >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 3 May 2008 15:38:42 -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 >@@ -16,5 +17,8 @@ > providerName = Eclipse.org > > >- >+Launch_Terminal_Label =Launch Terminal > Launch_Terminal_Tooltip=Launch a terminal from the selected directory >+ >+terminalsView.name = Terminals >+terminalsCategory.name = Terminal Commands >\ No newline at end of file >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 3 May 2008 15:38:43 -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,32 +40,72 @@ > <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" > id="org.eclipse.rse.terminals.ui.view.TerminalView"> > </view> > </extension> >- <extension >- point="org.eclipse.ui.popupMenus"> >- <objectContribution >- objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile" >- id="org.eclipse.rse.terminals.ui.launch"> >- <visibility> >- <and> >- <objectState name="isdirectory" value="true"/> >- <objectState name="isTerminalSubSystemExists" value="true"/> >- </and> >- </visibility> >- <action >- label="Launch Terminal" >- icon="icons/terminal_view.gif" >- tooltip="%Launch_Terminal_Tooltip" >- class="org.eclipse.rse.internal.terminals.ui.actions.LaunchTerminalActionDelegate" >- enablesFor="1" >- id="org.eclipse.rse.terminalss.ui.actions.LaunchTerminalActionDelegate"> >- </action> >- </objectContribution> >- </extension> >+ <extension point="org.eclipse.core.expressions.propertyTesters"> >+ <propertyTester >+ id="org.eclipse.rse.terminals.ui.TerminalsPropertyTester" >+ type="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile" >+ namespace="org.eclipse.rse.core" >+ properties="isTerminalSubSystemExists" >+ class="org.eclipse.rse.internal.terminals.ui.actions.TerminalsPropertyTester"> >+ </propertyTester> >+ </extension> >+ <extension >+ point="org.eclipse.ui.menus"> >+ <menuContribution >+ locationURI="popup:org.eclipse.rse.ui.view.systemView?after=additions"> >+ <command >+ commandId="org.eclipse.rse.terminals.ui.actions.LaunchTerminalCommand" >+ icon="icons/terminal_view.gif" >+ label="%Launch_Terminal_Label" >+ tooltip="%Launch_Terminal_Tooltip"> >+ <visibleWhen> >+ <iterate> >+ <or> >+ <and> >+ <instanceof >+ value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"> >+ </instanceof> >+ <test >+ property="org.eclipse.rse.subsystems.files.isdirectory" >+ value="true"> >+ </test> >+ <test >+ property="org.eclipse.rse.core.isTerminalSubSystemExists" >+ value="true"> >+ </test> >+ </and> >+ <instanceof >+ value="org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem"> >+ </instanceof> >+ </or> >+ </iterate> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ </extension> >+ <extension point="org.eclipse.ui.commands"> >+ <category >+ id="org.eclipse.rse.terminals.ui.commands.category" >+ name="%terminalsCategory.name"> >+ </category> >+ <command >+ categoryId="org.eclipse.rse.terminals.ui.commands.category" >+ id="org.eclipse.rse.terminals.ui.actions.LaunchTerminalCommand" >+ name="%Launch_Terminal_Label"> >+ </command> >+ </extension> >+ <extension >+ point="org.eclipse.ui.handlers"> >+ <handler >+ class="org.eclipse.rse.terminals.ui.handlers.LaunchTerminalCommandHandler" >+ commandId="org.eclipse.rse.terminals.ui.actions.LaunchTerminalCommand"> >+ </handler> >+ </extension> > </plugin> >Index: src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java,v >retrieving revision 1.1 >diff -u -r1.1 TerminalServiceSubSystemConfigurationAdapter.java >--- src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java 16 Apr 2008 20:56:36 -0000 1.1 >+++ src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java 3 May 2008 15:38:43 -0000 >@@ -12,69 +12,21 @@ > * > * Contributors: > * Yu-Fen Kuo (MontaVista) - Adapted from ShellServiceSubSystemConfigurationAdapter >+ * Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core > ********************************************************************************/ > > package org.eclipse.rse.internal.terminals.ui.configuration.adapter; > >-import java.util.ArrayList; >-import java.util.List; >- >-import org.eclipse.jface.action.IAction; > import org.eclipse.jface.resource.ImageDescriptor; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.rse.core.subsystems.ISubSystem; > import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; > import org.eclipse.rse.internal.terminals.ui.Activator; >-import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper; >-import org.eclipse.rse.internal.terminals.ui.actions.LaunchTerminalAction; >-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; >-import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; >-import org.eclipse.rse.ui.SystemMenuManager; > import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter; >-import org.eclipse.swt.widgets.Shell; > > public class TerminalServiceSubSystemConfigurationAdapter extends > SubSystemConfigurationAdapter { >- protected LaunchTerminalAction terminalAction; > protected ImageDescriptor activeImageDescriptor; > protected ImageDescriptor inactiveImageDescriptor; > >- public IAction[] getSubSystemActions(SystemMenuManager menu, >- IStructuredSelection selection, Shell shell, String menuGroup, >- ISubSystemConfiguration factory, ISubSystem selectedSubSystem) { >- List allActions = new ArrayList(); >- IAction[] baseActions = super.getSubSystemActions(menu, selection, >- shell, menuGroup, factory, selectedSubSystem); >- for (int i = 0; i < baseActions.length; i++) { >- allActions.add(baseActions[i]); >- } >- >- // launching terminals and finding files >- if (selectedSubSystem instanceof IRemoteFileSubSystem) { >- IRemoteFileSubSystem fs = (IRemoteFileSubSystem) selectedSubSystem; >- ITerminalServiceSubSystem cmdSubSystem = TerminalServiceHelper >- .getTerminalSubSystem(fs.getHost()); >- if (cmdSubSystem != null) { >- allActions.add(getTerminalAction(cmdSubSystem, shell)); >- } >- } else if (selectedSubSystem instanceof ITerminalServiceSubSystem) { >- allActions.add(getTerminalAction( >- (ITerminalServiceSubSystem) selectedSubSystem, shell)); >- } >- >- return (IAction[]) allActions.toArray(new IAction[allActions.size()]); >- } >- >- public IAction getTerminalAction( >- ITerminalServiceSubSystem selectedSubSystem, Shell shell) { >- if (terminalAction == null) { >- terminalAction = new LaunchTerminalAction(shell, selectedSubSystem); >- } else { >- terminalAction.setSubSystem(selectedSubSystem); >- } >- return terminalAction; >- } >- > public ImageDescriptor getImage(ISubSystemConfiguration config) { > if (inactiveImageDescriptor == null) { > inactiveImageDescriptor = Activator.getDefault() >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 3 May 2008 15:38:43 -0000 >@@ -8,11 +8,11 @@ > org.eclipse.core.runtime, > org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)", > org.eclipse.ui.views, >- org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)", > org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", > org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", > org.eclipse.rse.subsystems.terminals.core;bundle-version="[0.1.0,0.2.0)", >- org.eclipse.tm.terminal;bundle-version="[2.0.0,2.1.0)" >+ org.eclipse.tm.terminal;bundle-version="[2.0.0,2.1.0)", >+ org.eclipse.core.expressions;bundle-version="[3.0.0,4.0.0)" > Bundle-ActivationPolicy: lazy > Eclipse-LazyStart: true > Bundle-Vendor: %providerName >@@ -21,3 +21,4 @@ > 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.views;x-internal:=true >+Bundle-Localization: plugin >Index: src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java,v >retrieving revision 1.2 >diff -u -r1.2 TerminalServiceHelper.java >--- src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java 24 Apr 2008 01:06:41 -0000 1.2 >+++ src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java 3 May 2008 15:38:43 -0000 >@@ -7,6 +7,7 @@ > * Contributors: > * Yu-Fen Kuo (MontaVista) - initial API and implementation > * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits >+ * Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core > ********************************************************************************/ > > package org.eclipse.rse.internal.terminals.ui; >@@ -21,7 +22,6 @@ > import org.eclipse.rse.internal.services.terminals.ITerminalShell; > import org.eclipse.rse.internal.terminals.ui.views.RSETerminalConnector; > import org.eclipse.rse.internal.terminals.ui.views.TerminalViewTab; >-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; > import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; > import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; > import org.eclipse.swt.custom.CTabItem; >@@ -37,19 +37,6 @@ > super(); > } > >- /** >- * Helper method to return the path to change-directory to, given a selected >- * remote file object >- */ >- public static String getWorkingDirectory(IRemoteFile selectedFile) { >- String path = null; >- if (selectedFile.isDirectory()) >- path = selectedFile.getAbsolutePath(); >- else >- path = selectedFile.getParentPath(); >- return path; >- } >- > public static ITerminalServiceSubSystem getTerminalSubSystem( > IHost connection) { > ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); >Index: src/org/eclipse/rse/internal/terminals/ui/actions/TerminalsPropertyTester.java >=================================================================== >RCS file: src/org/eclipse/rse/internal/terminals/ui/actions/TerminalsPropertyTester.java >diff -N src/org/eclipse/rse/internal/terminals/ui/actions/TerminalsPropertyTester.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/internal/terminals/ui/actions/TerminalsPropertyTester.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************** >+ * Copyright (c) 2008 MontaVista Software, Inc. >+ * 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 >+ * >+ * Contributors: >+ * Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core >+ ********************************************************************************/ >+package org.eclipse.rse.internal.terminals.ui.actions; >+ >+import org.eclipse.core.expressions.PropertyTester; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.rse.core.RSECorePlugin; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.rse.core.model.ISystemRegistry; >+import org.eclipse.rse.core.subsystems.ISubSystem; >+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; >+import org.eclipse.rse.ui.view.ISystemViewElementAdapter; >+ >+public class TerminalsPropertyTester extends PropertyTester { >+ >+ public boolean test(Object receiver, String property, Object[] args, >+ Object expectedValue) { >+ if (property.toLowerCase().equals("isterminalsubsystemexists")) { //$NON-NLS-1$ >+ >+ boolean test = ((Boolean) expectedValue).booleanValue() == true; //$NON-NLS-1$ >+ >+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) receiver) >+ .getAdapter(ISystemViewElementAdapter.class); >+ if (adapter != null) { >+ ISubSystem subsystem = adapter.getSubSystem(receiver); >+ if (subsystem != null) { >+ IHost host = subsystem.getHost(); >+ ISystemRegistry registry = RSECorePlugin >+ .getTheSystemRegistry(); >+ >+ ISubSystem[] subsystems = registry.getSubSystems(host); >+ >+ for (int i = 0; i < subsystems.length; i++) { >+ ISubSystem temp = subsystems[i]; >+ if (temp instanceof ITerminalServiceSubSystem) { //$NON-NLS-1$ >+ return test; >+ } >+ } >+ } >+ return !test; >+ } else { >+ return !test; >+ } >+ } >+ return false; >+ } >+ >+} >Index: src/org/eclipse/rse/terminals/ui/handlers/LaunchTerminalCommandHandler.java >=================================================================== >RCS file: src/org/eclipse/rse/terminals/ui/handlers/LaunchTerminalCommandHandler.java >diff -N src/org/eclipse/rse/terminals/ui/handlers/LaunchTerminalCommandHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/terminals/ui/handlers/LaunchTerminalCommandHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,172 @@ >+/******************************************************************************** >+ * Copyright (c) 2006, 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) - [168870] refactor org.eclipse.rse.core package of the UI plugin >+ * Yu-Fen Kuo (MontaVista) - Adapted from LaunchShellActionDelegate >+ * Anna Dushistova (MontaVista) - Adapted from LaunchTerminalAction, LaunchTerminalActionDelegate to remove dependecy from files.core >+ ********************************************************************************/ >+package org.eclipse.rse.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 = null; >+ private Object selected = null; >+ private ISystemFilterReference selectedFilterRef = null; >+ >+ public LaunchTerminalCommandHandler() { >+ } >+ >+ 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 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; >+ } >+ } >+ >+ } >+ >+ 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 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 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; >+ } >+ >+ 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; >+ } >+ >+} >#P org.eclipse.rse.files.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.25 >diff -u -r1.25 MANIFEST.MF >--- META-INF/MANIFEST.MF 9 Apr 2008 19:40:54 -0000 1.25 >+++ META-INF/MANIFEST.MF 3 May 2008 15:38:45 -0000 >@@ -18,7 +18,8 @@ > org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)", > org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)", > org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", >- org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)" >+ org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", >+ org.eclipse.core.expressions;bundle-version="[3.0.0,4.0.0)" > Bundle-ActivationPolicy: lazy > Eclipse-LazyStart: true > Export-Package: org.eclipse.rse.files.ui, >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/plugin.xml,v >retrieving revision 1.23 >diff -u -r1.23 plugin.xml >--- plugin.xml 12 Mar 2008 13:54:52 -0000 1.23 >+++ plugin.xml 3 May 2008 15:38:45 -0000 >@@ -18,6 +18,7 @@ > David McKnight (IBM) - [187711] Link with Editor action for System View > David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files > Johnson Ma (Wind River) - [195402] Add tar.gz archive support >+Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core > --> > <?eclipse version="3.0"?> > <plugin> >@@ -476,5 +477,14 @@ > </action> > </viewContribution> > </extension> >+ <extension point="org.eclipse.core.expressions.propertyTesters"> >+ <propertyTester >+ class="org.eclipse.rse.files.ui.RemoteFilePropertyTester" >+ id="org.eclipse.rse.terminals.ui.RemoteFilePropertyTester" >+ namespace="org.eclipse.rse.subsystems.files" >+ properties="isdirectory" >+ type="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"> >+ </propertyTester> >+ </extension> > </plugin> > >\ No newline at end of file >Index: src/org/eclipse/rse/files/ui/RemoteFilePropertyTester.java >=================================================================== >RCS file: src/org/eclipse/rse/files/ui/RemoteFilePropertyTester.java >diff -N src/org/eclipse/rse/files/ui/RemoteFilePropertyTester.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/files/ui/RemoteFilePropertyTester.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************** >+ * Copyright (c) 2008 MontaVista Software, Inc. >+ * 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 >+ * >+ * Contributors: >+ * Anna Dushistova (MontaVista) - initial API and implementation >+ ********************************************************************************/ >+package org.eclipse.rse.files.ui; >+ >+import org.eclipse.core.expressions.PropertyTester; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.rse.internal.ui.view.SystemViewResources; >+import org.eclipse.rse.ui.view.ISystemViewElementAdapter; >+ >+public class RemoteFilePropertyTester extends PropertyTester { >+ >+ public boolean test(Object receiver, String property, Object[] args, >+ Object expectedValue) { >+ boolean test = ((Boolean) expectedValue).booleanValue() == true; >+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) receiver) >+ .getAdapter(ISystemViewElementAdapter.class); >+ if (adapter != null) >+ if (property.toLowerCase().endsWith("isdirectory")) { >+ return (adapter >+ .getType(receiver) >+ .equals( >+ SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE) || adapter >+ .getType(receiver) >+ .equals( >+ SystemViewResources.RESID_PROPERTY_FILE_TYPE_ROOT_VALUE)) >+ && test; >+ } >+ return !test; >+ } >+ >+}
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
:
review-
Actions:
View
|
Diff
Attachments on
bug 227535
:
98462
|
98531
|
98730
|
98943