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 161383 Details for
Bug 15510
Enable Print in project explorer if an active editor can print and is selected
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]
Preliminary work on a patch
clipboard.txt (text/plain), 4.41 KB, created by
Francis Upton IV
on 2010-03-08 18:25:26 EST
(
hide
)
Description:
Preliminary work on a patch
Filename:
MIME Type:
Creator:
Francis Upton IV
Created:
2010-03-08 18:25:26 EST
Size:
4.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.navigator.resources >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator.resources/plugin.xml,v >retrieving revision 1.42 >diff -u -r1.42 plugin.xml >--- plugin.xml 22 Jan 2009 23:08:33 -0000 1.42 >+++ plugin.xml 8 Mar 2010 23:23:08 -0000 >@@ -373,5 +373,17 @@ > <perspectiveExtension targetID = "org.eclipse.ui.resourcePerspective"> > <showInPart id = "org.eclipse.ui.navigator.ProjectExplorer"/> > </perspectiveExtension> >- </extension> >+ </extension> >+ <extension >+ point="org.eclipse.ui.handlers"> >+ <handler >+ commandId="org.eclipse.ui.file.print"> >+ </handler> >+ </extension> >+ <extension >+ point="org.eclipse.ui.handlers"> >+ <handler >+ commandId="org.eclipse.ui.navigator.resources.handler1"> >+ </handler> >+ </extension> > </plugin> >Index: src/org/eclipse/ui/navigator/resources/ProjectExplorer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ProjectExplorer.java,v >retrieving revision 1.9 >diff -u -r1.9 ProjectExplorer.java >--- src/org/eclipse/ui/navigator/resources/ProjectExplorer.java 25 May 2009 20:52:23 -0000 1.9 >+++ src/org/eclipse/ui/navigator/resources/ProjectExplorer.java 8 Mar 2010 23:23:08 -0000 >@@ -11,18 +11,29 @@ > > package org.eclipse.ui.navigator.resources; > >+import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IPath; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.ui.IAggregateWorkingSet; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IViewSite; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.IWorkingSet; >+import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.actions.ActionFactory; >+import org.eclipse.ui.commands.ActionHandler; >+import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.internal.navigator.framelist.Frame; > import org.eclipse.ui.internal.navigator.framelist.FrameList; > import org.eclipse.ui.internal.navigator.framelist.TreeFrame; >@@ -71,13 +82,51 @@ > */ > private String workingSetLabel; > >+ private ActionHandler printActionHandler; >+ >+ private ISelectionChangedListener selectionListener; >+ > public void createPartControl(Composite aParent) { > super.createPartControl(aParent); > >- if (!false) >- getCommonViewer().setMapper(new ResourceToItemsMapper(getCommonViewer())); >+ getCommonViewer().setMapper(new ResourceToItemsMapper(getCommonViewer())); >+ getCommonViewer().addSelectionChangedListener(selectionListener); > } >+ >+ public void init(IViewSite aSite, IMemento aMemento) >+ throws PartInitException { >+ super.init(aSite, aMemento); >+ >+ final IAction printAction = ActionFactory.PRINT.create(PlatformUI.getWorkbench().getActiveWorkbenchWindow()); >+ printActionHandler = new ActionHandler(printAction); >+ >+ selectionListener = new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ IHandlerService service = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); >+ IStructuredSelection sel = (IStructuredSelection) event.getSelection(); >+ Object obj = sel.getFirstElement(); >+ // TODO - remember the activation using an IHandlerActivation >+ // TODO - better check for what exactly to print? check instanceof and >+ // check adapts to >+ if (obj instanceof IFile) { >+ service.activateHandler(printAction.getActionDefinitionId(), printActionHandler); >+ } else { >+ // TODO deactivate the remembered activation if any, reset it >+ } >+ } >+ }; >+ >+ } >+ >+ > >+ public void dispose() { >+ super.dispose(); >+ >+ getCommonViewer().removeSelectionChangedListener(selectionListener); >+ } >+ >+ > /** > * The superclass does not deal with the content description, handle it > * here. >@@ -214,4 +263,6 @@ > return workingSetLabel; > } > >+ >+ > }
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 15510
:
161383
|
161790