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

Collapse All | Expand All

(-).settings/org.eclipse.jdt.core.prefs (-2 / +2 lines)
Lines 1-4 Link Here
1
#Wed May 25 13:12:47 EDT 2005
1
#Mon Jul 18 11:56:01 EDT 2005
2
eclipse.preferences.version=1
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
3
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
4
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
4
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
Lines 28-34 Link Here
28
org.eclipse.jdt.core.compiler.problem.deprecation=warning
28
org.eclipse.jdt.core.compiler.problem.deprecation=warning
29
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
29
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
30
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
30
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
31
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
31
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
32
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
32
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
33
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
33
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
34
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
34
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
(-).settings/org.eclipse.jdt.ui.prefs (-1 / +2 lines)
Lines 1-5 Link Here
1
#Tue Apr 26 09:53:11 EDT 2005
1
#Mon Jul 18 11:56:01 EDT 2005
2
eclipse.preferences.version=1
2
eclipse.preferences.version=1
3
internal.default.compliance=user
3
org.eclipse.jdt.ui.exception.name=e
4
org.eclipse.jdt.ui.exception.name=e
4
org.eclipse.jdt.ui.gettersetter.use.is=true
5
org.eclipse.jdt.ui.gettersetter.use.is=true
5
org.eclipse.jdt.ui.javadoc=false
6
org.eclipse.jdt.ui.javadoc=false
(-)src/org/eclipse/ui/carbon/CarbonUIEnhancer.java (+84 lines)
Lines 25-33 Link Here
25
import org.eclipse.swt.widgets.Menu;
25
import org.eclipse.swt.widgets.Menu;
26
import org.eclipse.swt.widgets.MenuItem;
26
import org.eclipse.swt.widgets.MenuItem;
27
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Widget;
28
import org.eclipse.ui.IStartup;
29
import org.eclipse.ui.IStartup;
30
import org.eclipse.ui.IWindowListener;
29
import org.eclipse.ui.IWorkbenchWindow;
31
import org.eclipse.ui.IWorkbenchWindow;
30
import org.eclipse.ui.PlatformUI;
32
import org.eclipse.ui.PlatformUI;
33
import org.eclipse.ui.internal.WorkbenchWindow;
31
34
32
/**
35
/**
33
 * The CarbonUIEnhancer provides the standard "About" and "Preference" menu items
36
 * The CarbonUIEnhancer provides the standard "About" and "Preference" menu items
Lines 80-90 Link Here
80
        display.syncExec(new Runnable() {
83
        display.syncExec(new Runnable() {
81
            public void run() {
84
            public void run() {
82
                hookApplicationMenu(display);
85
                hookApplicationMenu(display);
86
                hookToolbarButton();
87
                hookWorkbenchListener();
83
            }
88
            }
84
        });
89
        });
85
    }
90
    }
86
91
87
    /**
92
    /**
93
     * Hooks a listener that tweaks newly opened workbench window shells with the proper OS flags
94
     */
95
    protected void hookWorkbenchListener() {
96
		PlatformUI.getWorkbench().addWindowListener(new IWindowListener() {
97
98
			public void windowActivated(IWorkbenchWindow window) {
99
				// no-op
100
			}
101
102
			public void windowDeactivated(IWorkbenchWindow window) {
103
				// no-op
104
			}
105
106
			public void windowClosed(IWorkbenchWindow window) {
107
				// no-op
108
			}
109
110
			public void windowOpened(IWorkbenchWindow window) {
111
				// modify the newly opened window with the correct OS X style
112
				// bits such that it possesses the toolbar button
113
				Shell shell = window.getShell();
114
				int windowHandle = shell.shellHandle;
115
				OS.ChangeWindowAttributes(windowHandle,
116
						OS.kWindowToolbarButtonAttribute, 0);
117
			}});
118
		
119
	}
120
121
	/**
122
     * Hook the window toolbar button to toggle the visibility of the coolbar and perspective bar.
123
     */
124
    protected void hookToolbarButton() {
125
		Object target = new Object() {
126
			int toolbarProc (int nextHandler, int theEvent, int userData) {
127
				int eventKind = OS.GetEventKind (theEvent);
128
				if (eventKind != OS.kEventWindowToolbarSwitchMode)
129
					return OS.eventNotHandledErr;
130
				
131
				int [] theWindow = new int [1];
132
				OS.GetEventParameter (theEvent, OS.kEventParamDirectObject, OS.typeWindowRef, null, 4, null, theWindow);
133
				
134
				int [] theRoot = new int [1];
135
				OS.GetRootControl (theWindow [0], theRoot);
136
				Widget widget = Display.getCurrent().findWidget(theRoot [0]);
137
				
138
				if (!(widget instanceof Shell)) {
139
					return OS.eventNotHandledErr;
140
				}
141
				Shell shell = (Shell) widget;
142
				IWorkbenchWindow [] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
143
				for (int i = 0; i < windows.length; i++) {
144
					if (windows[i].getShell() == shell) {
145
						WorkbenchWindow castedWindow = (WorkbenchWindow) windows[i];
146
						boolean coolbarVisible = castedWindow.getCoolBarVisible();
147
						boolean perspectivebarVisible = castedWindow.getPerspectiveBarVisible();
148
						castedWindow.setCoolBarVisible(!coolbarVisible);
149
						castedWindow.setPerspectiveBarVisible(!perspectivebarVisible);
150
						shell.layout();
151
					}
152
				}
153
				return OS.eventNotHandledErr;
154
			}
155
156
		};
157
		
158
	    final Callback commandCallback = new Callback(target, "toolbarProc", 3); //$NON-NLS-1$
159
        int commandProc = commandCallback.getAddress();
160
        if (commandProc == 0) {
161
            commandCallback.dispose();
162
            return; // give up
163
        }
164
        
165
        int[] mask = new int[] { OS.kEventClassWindow, OS.kEventWindowToolbarSwitchMode };
166
        OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc,
167
                mask.length / 2, mask, 0, null);
168
		
169
	}
170
171
	/**
88
     * See Apple Technical Q&A 1079 (http://developer.apple.com/qa/qa2001/qa1079.html)
172
     * See Apple Technical Q&A 1079 (http://developer.apple.com/qa/qa2001/qa1079.html)
89
     */
173
     */
90
    private void hookApplicationMenu(Display display) {
174
    private void hookApplicationMenu(Display display) {

Return to bug 104280