private void setRuler(RulerProvider provider, int orientation) { Object ruler = null; if (isRulerVisible && provider != null) // provider.getRuler() might return null (at least the API does not // prevent that) ruler = provider.getRuler(); if (ruler == null) { // Ruler is not visible or is not present setRulerContainer(null, orientation); // Layout right-away to prevent an empty control from showing layout(true); return; } GraphicalViewer container = getRulerContainer(orientation); if (container == null) { container = createRulerContainer(orientation); setRulerContainer(container, orientation); } if (container.getContents() != ruler) { container.setContents(ruler); needToLayout = true; Display.getCurrent().asyncExec(runnable); } }
private DisplayModel createDisplayModel() throws Exception { displayModel = new DisplayModel(path); XMLUtil.fillDisplayModelFromInputStream(ResourceUtil.pathToInputStream(path), displayModel); if (macrosInput != null) { macrosInput = macrosInput.getCopy(); macrosInput.getMacrosMap().putAll(displayModel.getMacrosInput().getMacrosMap()); displayModel.setPropertyValue(AbstractContainerModel.PROP_MACROS, macrosInput); } viewer.setContents(displayModel); displayModel.setViewer(viewer); displayModel.setOpiRuntime(this); return displayModel; }
protected void initializeGraphicalViewer() { GraphicalViewer viewer = getGraphicalViewer(); IFile file = ((IFileEditorInput) getEditorInput()).getFile(); RootModel root = null; if (file.exists()) { try { root = DiagramSerializer.deserialize(file.getContents()); validateModel(root); } catch (Exception ex) { UMLPlugin.logException(ex); } } if (root == null) { root = createInitializeModel(); } viewer.setContents(root); addDndSupport(viewer, getDiagramType()); applyPreferences(); }