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 161790 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
[patch]
The ProjectExplorer portion
clipboard.txt (text/plain), 6.51 KB, created by
Francis Upton IV
on 2010-03-11 13:35:39 EST
(
hide
)
Description:
The ProjectExplorer portion
Filename:
MIME Type:
Creator:
Francis Upton IV
Created:
2010-03-11 13:35:39 EST
Size:
6.51 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.navigator.resources >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator.resources/META-INF/MANIFEST.MF,v >retrieving revision 1.29 >diff -u -r1.29 MANIFEST.MF >--- META-INF/MANIFEST.MF 1 Sep 2009 04:32:24 -0000 1.29 >+++ META-INF/MANIFEST.MF 11 Mar 2010 18:33:45 -0000 >@@ -19,6 +19,7 @@ > org.eclipse.ui.navigator;bundle-version="[3.4.0,4.0.0)", > org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", > org.eclipse.ui.views.properties.tabbed;bundle-version="[3.5.0,4.0.0)", >- org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)" >+ org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)", >+ org.eclipse.jface.text;bundle-version="[3.6.0,4.0.0)" > Bundle-RequiredExecutionEnvironment: J2SE-1.4 > Bundle-ActivationPolicy: lazy >Index: src/org/eclipse/ui/internal/navigator/resources/actions/PrintAction.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/navigator/resources/actions/PrintAction.java >diff -N src/org/eclipse/ui/internal/navigator/resources/actions/PrintAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/navigator/resources/actions/PrintAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,88 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Oakland Software Incorporated 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 >+ * >+ * Contributors: >+ * Francis Upton IV, Oakland Software - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.navigator.resources.actions; >+ >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.jface.text.ITextViewerExtension8; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.swt.custom.StyledTextPrintOptions; >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IWorkbenchCommandConstants; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.actions.SelectionListenerAction; >+import org.eclipse.ui.navigator.ICommonActionExtensionSite; >+import org.eclipse.ui.part.FileEditorInput; >+import org.eclipse.ui.texteditor.AbstractTextEditor; >+import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds; >+ >+/** >+ * >+ */ >+/* package */class PrintAction extends SelectionListenerAction { >+ >+ private ITextViewerExtension8 textViewer; >+ private AbstractTextEditor textEditor; >+ >+ /** >+ * @param aSite >+ */ >+ public PrintAction(ICommonActionExtensionSite aSite) { >+ // Text does not matter since this is just for the handler >+ super(""); //$NON-NLS-1$ >+ setActionDefinitionId(IWorkbenchCommandConstants.FILE_PRINT); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IAbstractTextEditorHelpContextIds.PRINT_ACTION); >+ } >+ >+ public void run() { >+ // FINISHME - is this right? >+ StyledTextPrintOptions options= new StyledTextPrintOptions(); >+ options.printTextFontStyle= true; >+ options.printTextForeground= true; >+ options.printTextBackground= true; >+ options.jobName= textEditor.getTitle(); >+ textViewer.print(options); >+ } >+ >+ protected boolean updateSelection(IStructuredSelection sel) { >+ if (!super.updateSelection(sel)) { >+ return false; >+ } >+ >+ Object obj = sel.getFirstElement(); >+ >+ IFile file = null; >+ if (obj instanceof IFile) { >+ file = (IFile) obj; >+ } else if (obj instanceof IAdaptable) { >+ file = (IFile) ((IAdaptable) obj).getAdapter(IFile.class); >+ } >+ >+ if (file != null) { >+ IEditorInput fileInput = new FileEditorInput(file); >+ IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditor( >+ fileInput); >+ if (editor == null) >+ return false; >+ if (editor instanceof AbstractTextEditor) { >+ textEditor = (AbstractTextEditor) editor; >+ // FINISHME - need to know how to get the text viewer >+ Object sv = null; >+ if ((sv instanceof ITextViewerExtension8)) >+ return false; >+ textViewer = (ITextViewerExtension8) sv; >+ return true; >+ } >+ } >+ return false; >+ } >+} >Index: src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java,v >retrieving revision 1.8 >diff -u -r1.8 ResourceMgmtActionProvider.java >--- src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java 1 Apr 2009 16:14:46 -0000 1.8 >+++ src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java 11 Mar 2010 18:33:46 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2009 IBM Corporation and others. >+ * Copyright (c) 2006, 2010 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 >@@ -69,6 +69,8 @@ > private CloseUnrelatedProjectsAction closeUnrelatedProjectsAction; > > private RefreshAction refreshAction; >+ >+ private PrintAction printAction; > > private Shell shell; > >@@ -91,6 +93,7 @@ > actionBars.setGlobalActionHandler(IDEActionFactory.OPEN_PROJECT.getId(), openProjectAction); > actionBars.setGlobalActionHandler(IDEActionFactory.CLOSE_PROJECT.getId(), closeProjectAction); > actionBars.setGlobalActionHandler(IDEActionFactory.CLOSE_UNRELATED_PROJECTS.getId(), closeUnrelatedProjectsAction); >+ actionBars.setGlobalActionHandler(ActionFactory.PRINT.getId(), printAction); > updateActionBars(); > } > >@@ -246,6 +249,8 @@ > > buildAction = new BuildAction(sp, IncrementalProjectBuilder.INCREMENTAL_BUILD); > buildAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_BUILD_PROJECT); >+ >+ printAction = new PrintAction(getActionSite()); > } > > /** >@@ -263,6 +268,7 @@ > openProjectAction.selectionChanged(selection); > closeUnrelatedProjectsAction.selectionChanged(selection); > closeProjectAction.selectionChanged(selection); >+ printAction.selectionChanged(selection); > } > > }
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