List of usage examples for org.eclipse.jdt.core ElementChangedEvent POST_RECONCILE
int POST_RECONCILE
To view the source code for org.eclipse.jdt.core ElementChangedEvent POST_RECONCILE.
Click Source Link
getDelta
. From source file:com.codenvy.ide.ext.java.server.internal.core.DeltaProcessor.java
License:Open Source License
private void fireReconcileDelta(IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) { IJavaElementDelta deltaToNotify = mergeDeltas(this.reconcileDeltas.values()); if (DEBUG) {/*w ww.j ava 2 s .c o m*/ System.out.println("FIRING POST_RECONCILE Delta [" + Thread.currentThread() + "]:"); //$NON-NLS-1$//$NON-NLS-2$ System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$ } if (deltaToNotify != null) { // flush now so as to keep listener reactions to post their own deltas for subsequent iteration this.reconcileDeltas = new HashMap(); notifyListeners(deltaToNotify, ElementChangedEvent.POST_RECONCILE, listeners, listenerMask, listenerCount); } }
From source file:com.salesforce.ide.ui.editors.ForceIdeEditorsPlugin.java
License:Open Source License
/** * Adds the given listener for changes to Java elements. Has no effect if an identical listener is already * registered./*w w w. j av a 2 s . com*/ * * This listener will only be notified during the POST_CHANGE resource change notification and any reconcile * operation (POST_RECONCILE). For finer control of the notification, use * <code>addElementChangedListener(IElementChangedListener,int)</code>, which allows to specify a different * eventMask. * * @param listener * the listener * @see ElementChangedEvent */ public static void addElementChangedListener(IElementChangedListener listener) { addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); }
From source file:com.technophobia.substeps.step.provider.StepImplementationClassChangedListener.java
License:Open Source License
@Override public void elementChanged(final ElementChangedEvent event) { if (event.getType() == ElementChangedEvent.POST_RECONCILE && event.getDelta().getResourceDeltas() != null) { final Collection<IResource> items = new ArrayList<IResource>(); for (final IResourceDelta resourceDelta : event.getDelta().getResourceDeltas()) { changedLeafItems(resourceDelta, items); }//from www .j a v a 2 s.c o m for (final IResource resource : items) { final String t = resource.getName(); } // onChangeCallback.doCallback(); } }
From source file:edu.wpi.cs.jburge.SEURAT.SEURATPlugin.java
License:Open Source License
/** * The constructor/*from w ww. jav a 2 s. co m*/ */ public SEURATPlugin() { super(); updateListeners = new Vector<IRationaleUpdateEventListener>(); plugin = this; try { resourceBundle = ResourceBundle.getBundle("edu.wpi.cs.jburge.SEURAT.SEURATPluginResources"); } catch (MissingResourceException x) { resourceBundle = null; } // Add the SEURAT element changed manager for rationale association persistence. JavaCore.addElementChangedListener(new SEURATElementChangedManager(), ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); }
From source file:org.codehaus.groovy.eclipse.astviews.ASTView.java
License:Apache License
private void hookGroovy() { partListener = new IPartListener() { public void partActivated(IWorkbenchPart part) { }// ww w . j ava 2 s . co m public void partBroughtToTop(IWorkbenchPart part) { try { if (part instanceof IEditorPart) { IFile file = (IFile) ((IEditorPart) part).getEditorInput().getAdapter(IFile.class); if (file != null && ContentTypeUtils.isGroovyLikeFileName(file.getName())) { ICompilationUnit unit = JavaCore.createCompilationUnitFrom(file); if (unit instanceof GroovyCompilationUnit) { if (editor != part) { editor = (IEditorPart) part; Object[] treePaths = viewer.getExpandedElements(); viewer.setInput(((GroovyCompilationUnit) unit).getModuleNode()); viewer.setExpandedElements(treePaths); } else { // nothing to do! } return; } } } } catch (Exception e) { GroovyCore.logException("Error updating AST Viewer", e); //$NON-NLS-1$ } editor = null; // This is a guard - the content provider should not be null, // but sometimes this happens when the // part is disposed of for various reasons (unhandled exceptions // AFAIK). Without this guard, // error message popups continue until Eclipse if forcefully // killed. if (viewer.getContentProvider() != null) { viewer.setInput(null); } } public void partClosed(IWorkbenchPart part) { } public void partDeactivated(IWorkbenchPart part) { } public void partOpened(IWorkbenchPart part) { } }; getSite().getPage().addPartListener(partListener); // Warm the listener up. if (getSite().getPage().getActiveEditor() instanceof GroovyEditor) { partListener.partBroughtToTop(getSite().getPage().getActiveEditor()); } listener = new IElementChangedListener() { public void elementChanged(ElementChangedEvent event) { // The editor is currently not a GroovyEditor, so // there is not // ASTView to refresh. if (editor == null) { return; } IJavaElementDelta delta = event.getDelta(); IFile file = (IFile) editor.getEditorInput().getAdapter(IFile.class); final GroovyCompilationUnit unit = (GroovyCompilationUnit) JavaCore.createCompilationUnitFrom(file); // determine if the delta contains the ICompUnit under question if (isUnitInDelta(delta, unit)) { Display.getDefault().asyncExec(new Runnable() { public void run() { Object[] treePaths = viewer.getExpandedElements(); viewer.setInput(unit.getModuleNode()); viewer.setExpandedElements(treePaths); } }); } } private boolean isUnitInDelta(IJavaElementDelta delta, GroovyCompilationUnit unit) { IJavaElement elt = delta.getElement(); if (elt.getElementType() == IJavaElement.COMPILATION_UNIT) { // comparing with a compilation unit // if test fails, no need to go further if (elt.getElementName().equals(unit.getElementName())) { return true; } else { return false; } } ICompilationUnit candidateUnit = (ICompilationUnit) elt.getAncestor(IJavaElement.COMPILATION_UNIT); if (candidateUnit != null) { // now if test fails, no need to go further if (candidateUnit.getElementName().equals(unit.getElementName())) { return true; } else { return false; } } // delta is a potential ancestor of this compilationUnit IJavaElementDelta[] deltas = delta.getAffectedChildren(); if (deltas != null) { for (IJavaElementDelta delta2 : deltas) { if (isUnitInDelta(delta2, unit)) { return true; } } } return false; } }; JavaCore.addElementChangedListener(listener, ElementChangedEvent.POST_RECONCILE); }
From source file:org.eclipse.e4.xwt.ui.editor.XWTEditor.java
License:Open Source License
public void addElementChangedListener(IJavaProject javaProject) { int eventMask = ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE; JavaModelManager.getDeltaState().addElementChangedListener(elementChangedListener, eventMask); }
From source file:org.eclipse.e4.xwt.ui.editor.XWTEditor.java
License:Open Source License
public void removeElementChangedListener(IJavaProject javaProject) { int eventMask = ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE; JavaModelManager.getDeltaState().removeElementChangedListener(elementChangedListener); }
From source file:org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPASolver.java
License:Open Source License
/** * Provides the unique key for the given business object. * /*from w w w .j a v a 2 s. co m*/ * @param bo * the given business object * * @return unique key */ public JPASolver() { this(EclipseFacade.INSTANCE, new JPAEditorUtilImpl()); synchronized (JPASolver.class) { if (wclsnr == null) { wclsnr = new WorkingCopyChangeListener(); JavaCore.addElementChangedListener(wclsnr, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); } } solversSet.add(this); }
From source file:org.eclipse.jst.jee.model.internal.common.AbstractAnnotationModelProvider.java
License:Open Source License
public void elementChanged(final ElementChangedEvent javaEvent) { if (javaEvent.getType() == ElementChangedEvent.POST_RECONCILE) internalPostReconcile(javaEvent); else if (javaEvent.getType() == ElementChangedEvent.POST_CHANGE) internalPostChange(javaEvent);// ww w .ja va2 s .c om }
From source file:org.eclipse.objectteams.otdt.core.OTModelManager.java
License:Open Source License
protected OTModelManager() { singleton = this; this.reconcileListener = new OTModelReconcileListener(); JavaCore.addElementChangedListener(this.reconcileListener, ElementChangedEvent.POST_RECONCILE); }