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 (-2 / +139 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 44-49 Link Here
44
    private static final int kHICommandServices = ('s' << 24) + ('e' << 16) + ('r' << 8) + 'v';
47
    private static final int kHICommandServices = ('s' << 24) + ('e' << 16) + ('r' << 8) + 'v';
45
48
46
    private static final String RESOURCE_BUNDLE = "org.eclipse.ui.carbon.Messages"; //$NON-NLS-1$
49
    private static final String RESOURCE_BUNDLE = "org.eclipse.ui.carbon.Messages"; //$NON-NLS-1$
50
	private static final String TOOLBAR_BUTTON_TOGGLE_FLAGS = "toolbarButtonToggleFlags"; //$NON-NLS-1$
47
51
48
    private String fAboutActionName;
52
    private String fAboutActionName;
49
53
Lines 79-90 Link Here
79
        final Display display = Display.getDefault();
83
        final Display display = Display.getDefault();
80
        display.syncExec(new Runnable() {
84
        display.syncExec(new Runnable() {
81
            public void run() {
85
            public void run() {
82
                hookApplicationMenu(display);
86
				hookApplicationMenu(display);
83
            }
87
				hookToolbarButtonCallback();
88
				hookWorkbenchListener();
89
				// modify all shells opened on startup
90
				IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
91
						.getWorkbenchWindows();
92
				for (int i = 0; i < windows.length; i++) {
93
					modifyWindowShell(windows[i]);
94
				}
95
			}
84
        });
96
        });
85
    }
97
    }
86
98
87
    /**
99
    /**
100
	 * Hooks a listener that tweaks newly opened workbench window shells with
101
	 * the proper OS flags.
102
	 * 
103
	 * @since 3.2
104
	 */
105
    protected void hookWorkbenchListener() {
106
		PlatformUI.getWorkbench().addWindowListener(new IWindowListener() {
107
108
			public void windowActivated(IWorkbenchWindow window) {
109
				// no-op
110
			}
111
112
			public void windowDeactivated(IWorkbenchWindow window) {
113
				// no-op
114
			}
115
116
			public void windowClosed(IWorkbenchWindow window) {
117
				// no-op
118
			}
119
120
			public void windowOpened(IWorkbenchWindow window) {
121
				modifyWindowShell(window);
122
			}});
123
	}
124
125
    /**
126
	 * Modify the given workbench window shell bits to show the toolbar toggle
127
	 * button.
128
	 * 
129
	 * @param window
130
	 *            the window to modify
131
	 * @since 3.2
132
	 */
133
	protected void modifyWindowShell(IWorkbenchWindow window) {
134
		// only add the button when either the coolbar or perspectivebar
135
		// is initially visible. This is so that RCP apps can choose to use
136
		// this fragment without fear that their explicitly invisble bars
137
		// can't be shown.
138
		boolean coolBarInitiallyVsible = ((WorkbenchWindow) window)
139
				.getCoolBarVisible();
140
		boolean perspectiveBarInitiallyVsible = ((WorkbenchWindow) window)
141
				.getPerspectiveBarVisible();
142
143
		if (coolBarInitiallyVsible || perspectiveBarInitiallyVsible) {
144
			// modify the newly opened window with the correct OS X
145
			// style bits such that it possesses the toolbar button
146
			Shell shell = window.getShell();
147
			boolean[] switchArray = new boolean[] { coolBarInitiallyVsible,
148
					perspectiveBarInitiallyVsible };
149
			shell.setData(TOOLBAR_BUTTON_TOGGLE_FLAGS, switchArray);
150
			int windowHandle = OS.GetControlOwner(shell.handle);
151
			OS.ChangeWindowAttributes(windowHandle,
152
					OS.kWindowToolbarButtonAttribute, 0);
153
		}
154
	}
155
	
156
	/**
157
	 * Hook the window toolbar button to toggle the visibility of the coolbar
158
	 * and perspective bar.
159
	 * 
160
	 * @since 3.2
161
	 */
162
    protected void hookToolbarButtonCallback() {
163
		Object target = new Object() {
164
			int toolbarProc (int nextHandler, int theEvent, int userData) {
165
				int eventKind = OS.GetEventKind (theEvent);
166
				if (eventKind != OS.kEventWindowToolbarSwitchMode)
167
					return OS.eventNotHandledErr;
168
				
169
				int [] theWindow = new int [1];
170
				OS.GetEventParameter (theEvent, OS.kEventParamDirectObject, OS.typeWindowRef, null, 4, null, theWindow);
171
				
172
				int [] theRoot = new int [1];
173
				OS.GetRootControl (theWindow [0], theRoot);
174
				Widget widget = Display.getCurrent().findWidget(theRoot [0]);
175
				
176
				if (!(widget instanceof Shell)) {
177
					return OS.eventNotHandledErr;
178
				}
179
				Shell shell = (Shell) widget;
180
				IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
181
						.getWorkbenchWindows();
182
				for (int i = 0; i < windows.length; i++) {
183
					if (windows[i].getShell() == shell) {
184
						WorkbenchWindow castedWindow = (WorkbenchWindow) windows[i];
185
						// get the switch flags that were set on the shell by
186
						// the window listener
187
						boolean[] switchFlags = (boolean[]) shell
188
								.getData(TOOLBAR_BUTTON_TOGGLE_FLAGS);
189
						if (switchFlags == null)
190
							return OS.eventNotHandledErr;
191
						boolean coolbarVisible = castedWindow
192
								.getCoolBarVisible();
193
						boolean perspectivebarVisible = castedWindow
194
								.getPerspectiveBarVisible();
195
						// only toggle the visibility of the components that
196
						// were on initially
197
						if (switchFlags[0])
198
							castedWindow.setCoolBarVisible(!coolbarVisible);
199
						if (switchFlags[1])
200
							castedWindow
201
									.setPerspectiveBarVisible(!perspectivebarVisible);
202
						shell.layout();
203
						return OS.noErr;
204
					}
205
				}
206
				return OS.eventNotHandledErr;
207
			}
208
209
		};
210
		
211
	    final Callback commandCallback = new Callback(target, "toolbarProc", 3); //$NON-NLS-1$
212
        int commandProc = commandCallback.getAddress();
213
        if (commandProc == 0) {
214
            commandCallback.dispose();
215
            return; // give up
216
        }
217
        
218
        int[] mask = new int[] { OS.kEventClassWindow, OS.kEventWindowToolbarSwitchMode };
219
        OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc,
220
                mask.length / 2, mask, 0, null);
221
		
222
	}
223
224
	/**
88
     * See Apple Technical Q&A 1079 (http://developer.apple.com/qa/qa2001/qa1079.html)
225
     * See Apple Technical Q&A 1079 (http://developer.apple.com/qa/qa2001/qa1079.html)
89
     */
226
     */
90
    private void hookApplicationMenu(Display display) {
227
    private void hookApplicationMenu(Display display) {

Return to bug 104280