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 51093 Details for
Bug 77014
[Commands] request: Provide close view command and binding
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 implementing close part action
patch.txt (text/plain), 5.17 KB, created by
John Arthorne
on 2006-09-28 11:41:37 EDT
(
hide
)
Description:
Patch implementing close part action
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2006-09-28 11:41:37 EDT
Size:
5.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/actions/ActionFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java,v >retrieving revision 1.45 >diff -u -r1.45 ActionFactory.java >--- Eclipse UI/org/eclipse/ui/actions/ActionFactory.java 26 Sep 2006 19:45:05 -0000 1.45 >+++ Eclipse UI/org/eclipse/ui/actions/ActionFactory.java 28 Sep 2006 15:41:16 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.ui.internal.CloseAllSavedAction; > import org.eclipse.ui.internal.CloseEditorAction; > import org.eclipse.ui.internal.CloseOthersAction; >+import org.eclipse.ui.internal.ClosePartAction; > import org.eclipse.ui.internal.ClosePerspectiveAction; > import org.eclipse.ui.internal.CycleEditorAction; > import org.eclipse.ui.internal.CyclePartAction; >@@ -201,6 +202,24 @@ > }; > > /** >+ * Workbench action (id "closePart"): Close the active editor. This action >+ * maintains its enablement state. >+ */ >+ public static final ActionFactory CLOSE_PART = new ActionFactory("closePart") {//$NON-NLS-1$ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow) >+ */ >+ public IWorkbenchAction create(IWorkbenchWindow window) { >+ if (window == null) { >+ throw new IllegalArgumentException(); >+ } >+ IWorkbenchAction action = new ClosePartAction(window); >+ action.setId(getId()); >+ return action; >+ } >+ }; >+ >+ /** > * Workbench action (id "closeAll"): Close all open editors. This action > * maintains its enablement state. > */ >Index: Eclipse UI/org/eclipse/ui/internal/ClosePartAction.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/ClosePartAction.java >diff -N Eclipse UI/org/eclipse/ui/internal/ClosePartAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/ClosePartAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal; >+ >+import org.eclipse.ui.*; >+ >+/** >+ * Closes the active editor. >+ */ >+public class ClosePartAction extends PageEventAction { >+ /** >+ * Create an instance of this class. >+ * >+ * @param window the window >+ */ >+ public ClosePartAction(IWorkbenchWindow window) { >+ super(WorkbenchMessages.CloseEditorAction_text, window); >+ setToolTipText(WorkbenchMessages.CloseEditorAction_toolTip); >+ setId("closePart"); //$NON-NLS-1$ >+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CLOSE_PART_ACTION); >+ setActionDefinitionId("org.eclipse.ui.part.close"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * Method declared on IAction. >+ */ >+ public void run() { >+ IWorkbenchPage page = getActivePage(); >+ if (!(page instanceof WorkbenchPage)) >+ return; >+ IWorkbenchPartReference partRef = page.getActivePartReference(); >+ if (partRef == null) >+ return; >+ if (partRef instanceof IViewReference) { >+ page.hideView((IViewReference) partRef); >+ } else if (partRef instanceof IEditorReference) { >+ page.closeEditors(new IEditorReference[] {(IEditorReference) partRef}, true); >+ } >+ } >+} >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java,v >retrieving revision 1.92 >diff -u -r1.92 WorkbenchActionBuilder.java >--- src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java 26 Sep 2006 19:44:50 -0000 1.92 >+++ src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java 28 Sep 2006 15:41:17 -0000 >@@ -65,6 +65,8 @@ > > // generic actions > private IWorkbenchAction closeAction; >+ >+ private IWorkbenchAction closePartAction; > > private IWorkbenchAction closeAllAction; > >@@ -1070,6 +1072,7 @@ > > // null out actions to make leak debugging easier > closeAction = null; >+ closePartAction = null; > closeAllAction = null; > closeAllSavedAction = null; > closeOthersAction = null; >@@ -1271,6 +1274,9 @@ > closeAction = ActionFactory.CLOSE.create(window); > register(closeAction); > >+ closePartAction = ActionFactory.CLOSE_PART.create(window); >+ register(closePartAction); >+ > closeAllAction = ActionFactory.CLOSE_ALL.create(window); > register(closeAllAction); >
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 77014
:
51093
|
53478