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

Collapse All | Expand All

(-)src/org/eclipse/e4/workbench/ui/internal/PartServiceImpl.java (-1 / +1 lines)
Lines 288-294 Link Here
288
		// 3) make it visible / active / re-layout
288
		// 3) make it visible / active / re-layout
289
289
290
		// bug with activation - need to deactivate first:
290
		// bug with activation - need to deactivate first:
291
		deactivate(part);
291
		// deactivate(part);
292
		activate(part);
292
		activate(part);
293
		return part;
293
		return part;
294
	}
294
	}
(-)src/org/eclipse/e4/workbench/ui/renderers/swt/StackRenderer.java (-1 / +42 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.e4.workbench.ui.renderers.swt;
11
package org.eclipse.e4.workbench.ui.renderers.swt;
12
12
13
import java.util.List;
13
import javax.inject.Inject;
14
import javax.inject.Inject;
14
import org.eclipse.e4.core.services.annotations.PostConstruct;
15
import org.eclipse.e4.core.services.annotations.PostConstruct;
15
import org.eclipse.e4.core.services.annotations.PreDestroy;
16
import org.eclipse.e4.core.services.annotations.PreDestroy;
Lines 63-68 Link Here
63
64
64
	private EventHandler dirtyUpdater;
65
	private EventHandler dirtyUpdater;
65
66
67
	private EventHandler activeChildUpdater;
68
66
	public StackRenderer() {
69
	public StackRenderer() {
67
		super();
70
		super();
68
	}
71
	}
Lines 159-164 Link Here
159
162
160
		eventBroker.subscribe(UIEvents.buildTopic(UIEvents.Dirtyable.TOPIC,
163
		eventBroker.subscribe(UIEvents.buildTopic(UIEvents.Dirtyable.TOPIC,
161
				UIEvents.Dirtyable.DIRTY), dirtyUpdater);
164
				UIEvents.Dirtyable.DIRTY), dirtyUpdater);
165
166
		activeChildUpdater = new EventHandler() {
167
			public void handleEvent(Event event) {
168
				Object objElement = event
169
						.getProperty(UIEvents.EventTags.ELEMENT);
170
				MElementContainer<?> uiElement = (MElementContainer<?>) objElement;
171
172
				// This listener only updates stacks -it- rendered
173
				if (!(uiElement.getRenderer() == StackRenderer.this)) {
174
					return;
175
				}
176
177
				CTabFolder folder = (CTabFolder) uiElement.getWidget();
178
				Object activeChild = uiElement.getActiveChild();
179
				if (activeChild == null) {
180
					List<?> children = uiElement.getChildren();
181
					if (children.isEmpty()) {
182
						return;
183
					}
184
185
					// FIXME: should be based on activation list
186
					activeChild = children.get(0);
187
				}
188
189
				CTabItem[] items = folder.getItems();
190
				for (int i = 0; i < items.length; i++) {
191
					if (items[i].getData(OWNING_ME) == activeChild) {
192
						folder.setSelection(i);
193
						return;
194
					}
195
				}
196
			}
197
		};
198
199
		eventBroker.subscribe(UIEvents.buildTopic(
200
				UIEvents.ElementContainer.TOPIC,
201
				UIEvents.ElementContainer.ACTIVECHILD), activeChildUpdater);
162
	}
202
	}
163
203
164
	@PreDestroy
204
	@PreDestroy
Lines 167-172 Link Here
167
207
168
		eventBroker.unsubscribe(itemUpdater);
208
		eventBroker.unsubscribe(itemUpdater);
169
		eventBroker.unsubscribe(dirtyUpdater);
209
		eventBroker.unsubscribe(dirtyUpdater);
210
		eventBroker.unsubscribe(activeChildUpdater);
170
	}
211
	}
171
212
172
	private String getLabel(MUILabel itemPart, String newName) {
213
	private String getLabel(MUILabel itemPart, String newName) {

Return to bug 299379