|
Lines 11-17
Link Here
|
| 11 |
|
11 |
|
| 12 |
package org.eclipse.ui.internal.e4.compatibility; |
12 |
package org.eclipse.ui.internal.e4.compatibility; |
| 13 |
|
13 |
|
| 14 |
import java.util.List; |
|
|
| 15 |
import javax.annotation.PostConstruct; |
14 |
import javax.annotation.PostConstruct; |
| 16 |
import javax.annotation.PreDestroy; |
15 |
import javax.annotation.PreDestroy; |
| 17 |
import javax.inject.Inject; |
16 |
import javax.inject.Inject; |
|
Lines 25-38
Link Here
|
| 25 |
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer; |
24 |
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer; |
| 26 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
25 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
| 27 |
import org.eclipse.e4.ui.model.application.ui.MUIElement; |
26 |
import org.eclipse.e4.ui.model.application.ui.MUIElement; |
| 28 |
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; |
|
|
| 29 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
27 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
| 30 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
28 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
| 31 |
import org.eclipse.e4.ui.model.application.ui.basic.MWindow; |
|
|
| 32 |
import org.eclipse.e4.ui.widgets.CTabFolder; |
29 |
import org.eclipse.e4.ui.widgets.CTabFolder; |
| 33 |
import org.eclipse.e4.ui.widgets.CTabItem; |
30 |
import org.eclipse.e4.ui.widgets.CTabItem; |
| 34 |
import org.eclipse.e4.ui.workbench.UIEvents; |
31 |
import org.eclipse.e4.ui.workbench.UIEvents; |
| 35 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
|
| 36 |
import org.eclipse.swt.SWT; |
32 |
import org.eclipse.swt.SWT; |
| 37 |
import org.eclipse.swt.layout.FillLayout; |
33 |
import org.eclipse.swt.layout.FillLayout; |
| 38 |
import org.eclipse.swt.widgets.Composite; |
34 |
import org.eclipse.swt.widgets.Composite; |
|
Lines 289-322
Link Here
|
| 289 |
}); |
285 |
}); |
| 290 |
} |
286 |
} |
| 291 |
|
287 |
|
| 292 |
private void updateImages(MPart part) { |
288 |
void updateTabImages(MUIElement element) { |
| 293 |
// Try to update the image if we're using a CTF |
289 |
// Try to update the image if we're using a CTF |
| 294 |
EModelService ms = part.getContext().get(EModelService.class); |
290 |
MUIElement refParent = element.getParent(); |
| 295 |
MWindow topWin = ms.getTopLevelWindowFor(part); |
291 |
if (!(refParent instanceof MPartStack)) { |
| 296 |
List<MPlaceholder> partRefs = ms.findElements(topWin, part.getElementId(), |
292 |
return; |
| 297 |
MPlaceholder.class, null); |
293 |
} |
| 298 |
for (MUIElement ref : partRefs) { |
294 |
|
| 299 |
MUIElement refParent = ref.getParent(); |
295 |
if (!(refParent.getWidget() instanceof CTabFolder)) { |
| 300 |
if (!(refParent instanceof MPartStack)) |
296 |
return; |
| 301 |
continue; |
297 |
} |
| 302 |
|
298 |
|
| 303 |
if (!(refParent.getWidget() instanceof CTabFolder)) |
299 |
CTabFolder ctf = (CTabFolder) refParent.getWidget(); |
| 304 |
continue; |
300 |
if (ctf.isDisposed()) { |
| 305 |
|
301 |
return; |
| 306 |
CTabFolder ctf = (CTabFolder) refParent.getWidget(); |
302 |
} |
| 307 |
if (ctf.isDisposed()) |
303 |
|
| 308 |
continue; |
304 |
CTabItem[] items = ctf.getItems(); |
| 309 |
|
305 |
for (CTabItem item : items) { |
| 310 |
CTabItem[] items = ctf.getItems(); |
306 |
if (item.getData(AbstractPartRenderer.OWNING_ME) == element) { |
| 311 |
for (CTabItem item : items) { |
307 |
item.setImage(wrapped.getTitleImage()); |
| 312 |
if (item.getData(AbstractPartRenderer.OWNING_ME) == ref) { |
|
|
| 313 |
item.setImage(wrapped.getTitleImage()); |
| 314 |
ctf.getDisplay().update(); |
| 315 |
} |
| 316 |
} |
308 |
} |
| 317 |
} |
309 |
} |
| 318 |
} |
310 |
} |
| 319 |
|
311 |
|
|
|
312 |
abstract void updateImages(MPart part); |
| 313 |
|
| 320 |
public void deactivateActionBars(boolean forceHide) { |
314 |
public void deactivateActionBars(boolean forceHide) { |
| 321 |
PartSite site = getReference().getSite(); |
315 |
PartSite site = getReference().getSite(); |
| 322 |
site.deactivateActionBars(forceHide); |
316 |
site.deactivateActionBars(forceHide); |