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 94153 | Differences between
and this patch

Collapse All | Expand All

(-)fragment-cocoa.properties (+3 lines)
Lines 12-14 Link Here
12
12
13
providerName=Eclipse.org
13
providerName=Eclipse.org
14
fragmentName=Eclipse UI MacOS X Enhancements
14
fragmentName=Eclipse UI MacOS X Enhancements
15
16
command.closeDialog.name=Close Dialog
17
command.closeDialog.desc=Closes the active Dialog
(-)fragment.xml (+25 lines)
Lines 8-12 Link Here
8
            class="org.eclipse.ui.internal.cocoa.CocoaUIEnhancer">
8
            class="org.eclipse.ui.internal.cocoa.CocoaUIEnhancer">
9
      </startup>
9
      </startup>
10
   </extension>
10
   </extension>
11
   <extension
12
         point="org.eclipse.ui.commands">
13
      <command
14
            categoryId="org.eclipse.ui.category.dialogs"
15
            description="%command.closeDialog.desc"
16
            id="org.eclipse.ui.cocoa.closeDialog"
17
            name="%command.closeDialog.name">
18
      </command>
19
   </extension>
20
   <extension
21
         point="org.eclipse.ui.handlers">
22
      <handler
23
            class="org.eclipse.ui.internal.cocoa.CloseDialogHandler"
24
            commandId="org.eclipse.ui.cocoa.closeDialog">
25
      </handler>
26
   </extension>
27
   <extension
28
         point="org.eclipse.ui.bindings">
29
      <key
30
            commandId="org.eclipse.ui.cocoa.closeDialog"
31
            contextId="org.eclipse.ui.contexts.dialog"
32
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
33
            sequence="M1+W">
34
      </key>
35
   </extension>
11
   
36
   
12
</fragment>
37
</fragment>
(-)src/org/eclipse/ui/internal/cocoa/CloseDialogHandler.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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.cocoa;
12
13
import org.eclipse.core.commands.AbstractHandler;
14
import org.eclipse.core.commands.ExecutionEvent;
15
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.core.commands.IHandler;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.widgets.Display;
19
import org.eclipse.swt.widgets.Shell;
20
21
/**
22
 * 
23
 * @author Prakash G.R. (grprakash@gmail.com)
24
 * @since 3.6 
25
 *
26
 */
27
public class CloseDialogHandler extends AbstractHandler implements IHandler {
28
29
	public Object execute(ExecutionEvent event) throws ExecutionException {
30
		
31
		Shell activeShell = Display.getDefault().getActiveShell();
32
		if((activeShell.getStyle() & SWT.CLOSE) == 0) {
33
			// if close not enabled, do nothing
34
			return null;
35
		}
36
		
37
		activeShell.close();
38
		return null;
39
	}
40
41
}

Return to bug 94153