public void setInput(FileEditorInput input) { if (input != null) { m_compilationUnit = Workspace.getInstance().getCompilationUnit(input.getFile()); } else { m_compilationUnit = null; } update(); }
@Override public void dispose() { super.dispose(); Workspace.getInstance().uninstallResourceListener(m_listener); if (fMenu != null && !fMenu.isDisposed()) { fMenu.dispose(); fMenu = null; } }
@Override public void dispose() { if (getActionGroup() != null) { getActionGroup().dispose(); } Workspace.getInstance().uninstallResourceListener(this); // ProjectBuilder.removePropertyChangeListener(this); super.dispose(); }
@SuppressWarnings("deprecation") @Override public void createPartControl(Composite parent) { // ProjectBuilder.addPropertyChangeListener(this); m_viewer = createViewer(parent); m_viewer.setSorter(new Sorter()); initContextMenu(); makeActions(); getSite().setSelectionProvider(m_viewer); getActionGroup().fillActionBars(getViewSite().getActionBars()); m_propertyPage = new PropertySheetPage(); m_propertyPage.setPropertySourceProvider(new AttributedPropertySourceProvider()); setInput(m_inputType); Workspace.getInstance().installResourceListener(this); Job job = new Job("") { @Override public IStatus run(IProgressMonitor monitor) { for (Project project : Workspace.getInstance().getProjects()) { try { ReconcileMessageConsumer consumer = new ReconcileMessageConsumer(); project.reconcile(consumer, monitor); } catch (Exception e) { return Status.CANCEL_STATUS; } ; } /*Display.getDefault().asyncExec(new Runnable() { public void run() { setInput(m_inputType); } });*/ return Status.OK_STATUS; } }; job.schedule(); }
private void updateMap() { List<IType> allTypes = new ArrayList<IType>(); List<IType> base = new ArrayList<IType>(); for (Project project : Workspace.getInstance().getProjects()) { IType[] types = project.getTypes(); for (IType type : types) { allTypes.add(type); base.add(type); IType[] nestedTypes = type.getNestedTypes(); for (IType nestedType : nestedTypes) { allTypes.add(nestedType); } } } m_map.clear(); for (IType type : allTypes) { IType baseType = type.getBaseType(); if (baseType != null) { List<IType> list = m_map.get(baseType); if (list == null) { list = new ArrayList<IType>(); m_map.put(type.getBaseType(), list); } list.add(type); base.remove(type); } else if (type.getAttribute(IAttribute.Native) == null) { base.remove(type); } } baseTypes = new IType[base.size()]; base.toArray(baseTypes); }
@Override public void createControl(Composite parent) { super.createControl(parent); Workspace.getInstance().installResourceListener(m_listener); TreeViewer treeViewer = getTreeViewer(); treeViewer.setContentProvider(new NavigatorTreeContentProvider()); treeViewer.setLabelProvider(new Z8LabelProvider(false)); treeViewer.addSelectionChangedListener(this); treeViewer.setSorter( new ViewerSorter() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if (e1 == e2) return 0; ISource s1, s2; if (e1 instanceof ISource) { s1 = (ISource) e1; } else { return -1; } if (e2 instanceof ISource) { s2 = (ISource) e2; } else { return 1; } return s1.getPosition().getOffset() > s2.getPosition().getOffset() ? 1 : -1; } }); treeViewer.addFilter(FILTER); if (m_compilationUnit != null) { treeViewer.setInput(m_compilationUnit); } }