public void testCreateView() { final MWindow window = createWindowWithOneView("Part Name"); MApplication application = ApplicationFactoryImpl.eINSTANCE.createApplication(); application.getChildren().add(window); application.setContext(appContext); appContext.set(MApplication.class.getName(), application); wb = new E4Workbench(application, appContext); wb.createAndRunUI(window); MPartSashContainer container = (MPartSashContainer) window.getChildren().get(0); MPartStack stack = (MPartStack) container.getChildren().get(0); MPart part = (MPart) stack.getChildren().get(0); CTabFolder folder = (CTabFolder) stack.getWidget(); CTabItem item = folder.getItem(0); assertEquals("Part Name", item.getText()); assertFalse(part.isDirty()); part.setDirty(true); assertEquals("*Part Name", item.getText()); part.setDirty(false); assertEquals("Part Name", item.getText()); }
/* (non-Javadoc) * @see org.eclipse.ui.IPresentationPreview#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.themes.ITheme) */ public void createControl(Composite parent, ITheme currentTheme) { this.theme = currentTheme; folder = new CTabFolder(parent, SWT.BORDER); folder.setUnselectedCloseVisible(false); folder.setEnabled(false); folder.setMaximizeVisible(true); folder.setMinimizeVisible(true); viewForm = new ViewForm(folder, SWT.NONE); viewForm.marginHeight = 0; viewForm.marginWidth = 0; viewForm.verticalSpacing = 0; viewForm.setBorderVisible(false); toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.WRAP); ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH); Image hoverImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU); toolItem.setImage(hoverImage); viewForm.setTopRight(toolBar); viewMessage = new CLabel(viewForm, SWT.NONE); viewMessage.setText("Etu?"); // $NON-NLS-1$ viewForm.setTopLeft(viewMessage); CTabItem item = new CTabItem(folder, SWT.CLOSE); item.setText("Lorem"); // $NON-NLS-1$ Label text = new Label(viewForm, SWT.NONE); viewForm.setContent(text); text.setText("Lorem ipsum dolor sit amet"); // $NON-NLS-1$ item = new CTabItem(folder, SWT.CLOSE); item.setText("Ipsum"); // $NON-NLS-1$ item.setControl(viewForm); item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_TOOL_COPY)); folder.setSelection(item); item = new CTabItem(folder, SWT.CLOSE); item.setText("Dolor"); // $NON-NLS-1$ item = new CTabItem(folder, SWT.CLOSE); item.setText("Sit"); // $NON-NLS-1$ currentTheme.addPropertyChangeListener(fontAndColorListener); setColorsAndFonts(); setTabPosition(); setTabStyle(); }
public void showImage(Image image) { if (tabItem.isDisposed()) return; tabItem.setImage(image); }
public void setStoppedImage(Image image) { tabItem.setImage(image); }
public void saveStoppedImage() { stoppedImage = tabItem.getImage(); }
/* (non-Javadoc) * @see org.eclipse.ui.internal.AnimationFeedbackBase#initialize(org.eclipse.ui.internal.AnimationEngine) */ public void initialize(AnimationEngine engine) { // TODO Auto-generated method stub background = tabItem.getParent().getBackground(); display = tabItem.getParent().getDisplay(); }