Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 77014 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/actions/ActionFactory.java (+19 lines)
Lines 22-27 Link Here
22
import org.eclipse.ui.internal.CloseAllSavedAction;
22
import org.eclipse.ui.internal.CloseAllSavedAction;
23
import org.eclipse.ui.internal.CloseEditorAction;
23
import org.eclipse.ui.internal.CloseEditorAction;
24
import org.eclipse.ui.internal.CloseOthersAction;
24
import org.eclipse.ui.internal.CloseOthersAction;
25
import org.eclipse.ui.internal.ClosePartAction;
25
import org.eclipse.ui.internal.ClosePerspectiveAction;
26
import org.eclipse.ui.internal.ClosePerspectiveAction;
26
import org.eclipse.ui.internal.CycleEditorAction;
27
import org.eclipse.ui.internal.CycleEditorAction;
27
import org.eclipse.ui.internal.CyclePartAction;
28
import org.eclipse.ui.internal.CyclePartAction;
Lines 201-206 Link Here
201
    };
202
    };
202
203
203
    /**
204
    /**
205
     * Workbench action (id "closePart"): Close the active editor. This action
206
     * maintains its enablement state.
207
     */
208
    public static final ActionFactory CLOSE_PART = new ActionFactory("closePart") {//$NON-NLS-1$
209
        /* (non-Javadoc)
210
         * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
211
         */
212
        public IWorkbenchAction create(IWorkbenchWindow window) {
213
            if (window == null) {
214
                throw new IllegalArgumentException();
215
            }
216
            IWorkbenchAction action = new ClosePartAction(window);
217
            action.setId(getId());
218
            return action;
219
        }
220
    };
221
222
    /**
204
     * Workbench action (id "closeAll"): Close all open editors. This action
223
     * Workbench action (id "closeAll"): Close all open editors. This action
205
     * maintains its enablement state.
224
     * maintains its enablement state.
206
     */
225
     */
(-)Eclipse (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ui.internal;
12
13
import org.eclipse.ui.*;
14
15
/**
16
 * Closes the active editor.
17
 */
18
public class ClosePartAction extends PageEventAction {
19
	/**
20
	 * Create an instance of this class.
21
	 * 
22
	 * @param window the window
23
	 */
24
	public ClosePartAction(IWorkbenchWindow window) {
25
		super(WorkbenchMessages.CloseEditorAction_text, window);
26
		setToolTipText(WorkbenchMessages.CloseEditorAction_toolTip);
27
		setId("closePart"); //$NON-NLS-1$
28
		window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CLOSE_PART_ACTION);
29
		setActionDefinitionId("org.eclipse.ui.part.close"); //$NON-NLS-1$
30
	}
31
32
	/* (non-Javadoc)
33
	 * Method declared on IAction.
34
	 */
35
	public void run() {
36
		IWorkbenchPage page = getActivePage();
37
		if (!(page instanceof WorkbenchPage))
38
			return;
39
		IWorkbenchPartReference partRef = page.getActivePartReference();
40
		if (partRef == null)
41
			return;
42
		if (partRef instanceof IViewReference) {
43
			page.hideView((IViewReference) partRef);
44
		} else if (partRef instanceof IEditorReference) {
45
			page.closeEditors(new IEditorReference[] {(IEditorReference) partRef}, true);
46
		}
47
	}
48
}
(-)src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java (+6 lines)
Lines 65-70 Link Here
65
65
66
    // generic actions
66
    // generic actions
67
    private IWorkbenchAction closeAction;
67
    private IWorkbenchAction closeAction;
68
    
69
    private IWorkbenchAction closePartAction;
68
70
69
    private IWorkbenchAction closeAllAction;
71
    private IWorkbenchAction closeAllAction;
70
    
72
    
Lines 1070-1075 Link Here
1070
        
1072
        
1071
        // null out actions to make leak debugging easier
1073
        // null out actions to make leak debugging easier
1072
        closeAction = null;
1074
        closeAction = null;
1075
        closePartAction = null;
1073
        closeAllAction = null;
1076
        closeAllAction = null;
1074
        closeAllSavedAction = null;
1077
        closeAllSavedAction = null;
1075
        closeOthersAction = null;
1078
        closeOthersAction = null;
Lines 1271-1276 Link Here
1271
        closeAction = ActionFactory.CLOSE.create(window);
1274
        closeAction = ActionFactory.CLOSE.create(window);
1272
        register(closeAction);
1275
        register(closeAction);
1273
1276
1277
        closePartAction = ActionFactory.CLOSE_PART.create(window);
1278
        register(closePartAction);
1279
1274
        closeAllAction = ActionFactory.CLOSE_ALL.create(window);
1280
        closeAllAction = ActionFactory.CLOSE_ALL.create(window);
1275
        register(closeAllAction);
1281
        register(closeAllAction);
1276
1282

Return to bug 77014