/* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) */ public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { final ReleaseWizard wizard = (ReleaseWizard) getWizard(); try { // Get updated selected project in case that some projects have outgoing changes and // excluded by user wizard.updateSelectedProject(); // Get the finalized selected projects and the associated tags from existing map files final IProject[] projects = wizard.getSelectedProjects(); final CVSTag[] tags = mapProject.getTagsFor(projects); // Collect all the out-of-sync projects from selected projects and update the selected // project again getContainer() .run( true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IResource[] r = null; if (projects != null && projects.length != 0) { try { r = getOutOfSyncProjects(projects, tags, monitor); wizard.setSelectedProjects(r); } catch (TeamException e) { throw new InvocationTargetException(e); } } } }); // Show no-project-changed information on the page book if condition satisfied if (wizard.getSelectedProjects() == null || wizard.getSelectedProjects().length == 0) { setPageComplete(false); pageBook.showPage(noneChangeMessage); } // Open a compare editor otherwise else { setPageComplete(true); pageBook.showPage(compareView); } } catch (InvocationTargetException e) { CVSUIPlugin.openError(getShell(), null, null, e); } catch (InterruptedException e) { CVSUIPlugin.openError(getShell(), null, null, e); } } // When the page is invisible, it should not affect the wizard work flow by anyway else { setPageComplete(true); } }
@Override public void refresh() { PictogramElement pe = getSelectedPictogramElement(); if (pe != null) { Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe); _interface = null; // the filter assured, that it is a Service or Reference if (bo == null) { _composite.showPage(_blank); _composite.redraw(); return; } if (bo instanceof Contract) { Contract contract = (Contract) bo; _interface = contract.getInterface(); } if (_interface != null) { if (_modelComposites.get(_interface) == null) { TabbedPropertySheetWidgetFactory factory = getWidgetFactory(); IInterfaceComposite composite = (IInterfaceComposite) InterfaceCompositeAdapter.adaptModelToComposite(_interface); if (composite != null) { ((AbstractSwitchyardComposite) composite).createContents(_composite, SWT.NONE); factory.adapt(((AbstractSwitchyardComposite) composite).getPanel()); _modelComposites.put(_interface, composite); } } IInterfaceComposite composite = (IInterfaceComposite) _modelComposites.get(_interface); if (composite != null) { composite.setInterface(_interface); _composite.showPage(((AbstractSwitchyardComposite) composite).getPanel()); Composite parent = _composite; // this is a hack to get it to refresh properly while (parent != null) { parent.layout(true, true); parent = parent.getParent(); } } else { _composite.getParent().layout(); _composite.showPage(_blank); _composite.layout(true, true); } } else { _composite.showPage(_blank); _composite.getParent().layout(); _composite.layout(true, true); } } }
/** * Show page. * * @param id the id */ protected void showPage(String id) { if (ID_ACTION_OUTLINE.equals(id)) { showOutlineAction.setChecked(true); showOverviewAction.setChecked(false); pageBook.showPage(outline); if (thumbnail != null) thumbnail.setVisible(false); } else if (ID_ACTION_OVERVIEW.equals(id)) { if (thumbnail == null) initializeOverview(); showOutlineAction.setChecked(false); showOverviewAction.setChecked(true); pageBook.showPage(overview); thumbnail.setVisible(true); } }
/** @param page */ public void setPageActive(IContentOutlinePage page) { synchronized (fEditor) // don't want to call this while a reconciling // action // is occuring! { Control control = fCurrentPage.getControl(); if ((control != null && !control.isDisposed()) && page == fCurrentPage) return; if (page == fMessagePage && fCurrentPage != fTapestryOutlinePage) page = fCurrentPage; if (page == fTapestryOutlinePage && fReconciledObject == null) page = fMessagePage; if (fCurrentPage != null) { fCurrentPage.removeSelectionChangedListener(this); } page.addSelectionChangedListener(this); this.fCurrentPage = page; if (fPageBook == null) { // still not being made return; } control = page.getControl(); if (control == null || control.isDisposed()) { // first time page.createControl(fPageBook); control = page.getControl(); } fPageBook.showPage(control); this.fCurrentPage = page; } updateToolbar(); }
/* * (non-Javadoc) * * @see * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls * (org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ @Override public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); TabbedPropertySheetWidgetFactory factory = getWidgetFactory(); _composite = new PageBook(parent, SWT.NONE); factory.adapt(_composite); _blank = factory.createFlatFormComposite(_composite); _composite.showPage(_blank); }
private void createTestViewers(final Composite parent) { fViewerbook = new PageBook(parent, SWT.NULL); viewer = new TreeViewer(fViewerbook, SWT.V_SCROLL | SWT.SINGLE); labelProvider = new TestViewLabelProvider(); contentProvider = new TestViewContentProvider(); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(labelProvider); fViewerbook.showPage(viewer.getTree()); }
/** * Shows page contained in the given page record in this view. The page record must be one from * this pagebook view. * * <p>The <code>PageBookView</code> implementation of this method asks the pagebook control to * show the given page's control, and records that the given page is now current. Subclasses may * extend. * * @param pageRec the page record containing the page to show */ protected void showPageRec(PageRec pageRec) { // If already showing do nothing if (activeRec == pageRec) { return; } // If the page is the same, just set activeRec to pageRec if (activeRec != null && pageRec != null && activeRec.page == pageRec.page) { activeRec = pageRec; return; } // Show new page. activeRec = pageRec; Control pageControl = activeRec.page.getControl(); if (pageControl != null && !pageControl.isDisposed()) { // Verify that the page control is not disposed // If we are closing, it may have already been disposed pageBook.showPage(pageControl); } }
/* * (non-Javadoc) * * @see org.eclipse.gef.ui.parts.ContentOutlinePage#createControl(org.eclipse.swt.widgets.Composite) */ @Override public void createControl(Composite parent) { pageBook = new PageBook(parent, SWT.NONE); outline = getViewer().createControl(pageBook); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(outline, "com.jaspersoft.studio.doc.view_outline"); overview = new Canvas(pageBook, SWT.NONE); pageBook.showPage(outline); configureOutlineViewer(); hookOutlineViewer(); setContents(editor.getModel()); if (outline instanceof Tree) { final Tree tree = (Tree) outline; tree.addFocusListener( new FocusListener() { @Override public void focusLost(FocusEvent e) { mousePosition.setLocation(-1, -1); } @Override public void focusGained(FocusEvent e) { if (enableFocusFix && mousePosition.x != -1) { EditPart part = getViewer().findObjectAt(mousePosition); if (part != null && part.getModel() instanceof MRoot) { EditPart translatedPart = getViewer().findObjectAt(new Point(mousePosition.x + 10, mousePosition.y)); if (translatedPart != null && translatedPart.getModel() != part.getModel()) { TreeItem item = (TreeItem) ((TreeEditPart) translatedPart).getWidget(); item.setExpanded(!item.getExpanded()); tree.deselectAll(); tree.select(item); tree.layout(true); } } } } }); tree.addMouseListener( new MouseListener() { public void mouseUp(MouseEvent e) {} public void mouseDown(MouseEvent e) {} public void mouseDoubleClick(MouseEvent e) { if (e.getSource() instanceof Tree) { Tree t = (Tree) e.getSource(); TreeItem[] ti = t.getSelection(); if (ti != null && ti.length > 0) { Object obj = ti[0].getData(); if (obj instanceof TreeEditPart && editor instanceof AbstractVisualEditor) { EditPart part = (EditPart) ((AbstractVisualEditor) editor) .getGraphicalViewer() .getEditPartRegistry() .get(((TreeEditPart) obj).getModel()); if (part != null) { SelectionRequest request = new SelectionRequest(); request.setType(RequestConstants.REQ_OPEN); part.performRequest(request); } else { TreeEditPart atep = (TreeEditPart) obj; if (atep.getModel() instanceof ANode) { EditableFigureEditPart.openEditor( ((ANode) atep.getModel()).getValue(), (IEditorPart) editor, (ANode) atep.getModel()); } } } } } } }); // This listener display the tooltip text for the abbreviated nodes names tree.addMouseMoveListener( new MouseMoveListener() { public void mouseMove(MouseEvent e) { mousePosition.setLocation(e.x, e.y); EditPart part = getViewer().findObjectAt(new Point(e.x, e.y)); Tree t = (Tree) e.getSource(); if (part != null && part.getModel() != null && !(part.getModel() instanceof MRoot)) { Object model = part.getModel(); String toolTipText = Misc.nvl(((ANode) model).getToolTip()); String displayText = Misc.nvl(((ANode) model).getDisplayText()); String text = ""; if (!toolTipText.isEmpty() && !toolTipText.equals(displayText)) text = toolTipText + "\n"; text += displayText; t.setToolTipText(text); return; } t.setToolTipText(null); } }); } }