当前位置: 首页>>代码示例>>Java>>正文


Java ElementChangedEvent类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.ElementChangedEvent的典型用法代码示例。如果您正苦于以下问题:Java ElementChangedEvent类的具体用法?Java ElementChangedEvent怎么用?Java ElementChangedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ElementChangedEvent类属于org.eclipse.jdt.core包,在下文中一共展示了ElementChangedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachSource

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public static void attachSource(final IPackageFragmentRoot fragment, final IPath newSourcePath,
    IProgressMonitor monitor) {
  try {
    if (fragment == null || fragment.getKind() != IPackageFragmentRoot.K_BINARY) {
      return;
    }
    if (!Objects.equals(fragment.getSourceAttachmentPath(), newSourcePath)) {
      // would be so cool if it refreshed the UI automatically
      fragment.attachSource(newSourcePath, null, monitor);
      // close the root so that source attachment cache is flushed. Else UI
      // won't update
      fragment.close();
      // we have to manually fire a delta to notify the UI about the source
      // attachment.
      JavaModelManager manager = JavaModelManager.getJavaModelManager();
      JavaElementDelta attachedSourceDelta = new JavaElementDelta(fragment.getJavaModel());
      attachedSourceDelta.sourceAttached(fragment);
      manager.getDeltaProcessor().fire(attachedSourceDelta, ElementChangedEvent.POST_CHANGE);
    }
  } catch (CoreException e) {
    // ignore
  }
}
 
开发者ID:fbricon,项目名称:pde.source.lookup,代码行数:24,代码来源:ClasspathUtils.java

示例2: firePostChangeDelta

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
private void firePostChangeDelta(
    IJavaElementDelta deltaToNotify,
    IElementChangedListener[] listeners,
    int[] listenerMask,
    int listenerCount) {

  // post change deltas
  if (DEBUG) {
    System.out.println(
        "FIRING POST_CHANGE 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
    flush();

    //			// mark the operation stack has not modifying resources since resource deltas are being
    // fired
    //			JavaModelOperation.setAttribute(JavaModelOperation.HAS_MODIFIED_RESOURCE_ATTR, null);

    notifyListeners(
        deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:DeltaProcessor.java

示例3: fireReconcileDelta

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
private void fireReconcileDelta(
    IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) {

  IJavaElementDelta deltaToNotify = mergeDeltas(this.reconcileDeltas.values());
  if (DEBUG) {
    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);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:DeltaProcessor.java

示例4: init

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
protected void init(IJavaProject project) {
	if (project == null || !project.exists() || !project.getResource().isAccessible())
		throw new IllegalArgumentException("Invalid javaProject");
	this.javaProject = project;
	getURLClassloader();
	listener = new IElementChangedListener() {

		public void elementChanged(final ElementChangedEvent event) {
			if (ignoreClasspathChanges(event))
				return;
			System.out.println("CLASSPATH CHANGED:" + event);
			// FIXME should release this classloader
			// what happend with current objects? we have 1 loader per
			// project, maybe se can filter some events? to have less
			// updates
			curlLoader = null;
			getURLClassloader();
			if (events != null)
				events.firePropertyChange("classpath", false, true);
		}
	};
	JavaCore.addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:24,代码来源:JavaProjectClassLoader.java

示例5: ignoreClasspathChanges

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
private boolean ignoreClasspathChanges(ElementChangedEvent event) {
	if (event.getDelta() == null && event.getDelta().getChangedChildren() == null)
		return true;
	for (IJavaElementDelta delta : event.getDelta().getChangedChildren()) {
		if (delta.getResourceDeltas() == null)
			return false;
		for (IResourceDelta rd : delta.getResourceDeltas()) {
			if (rd.getFullPath() == null)
				continue;
			String path = rd.getFullPath().getFileExtension();
			if (path != null && !(path.equalsIgnoreCase(FileExtension.JRXML) || path.equalsIgnoreCase(FileExtension.JASPER)))
				return false;
		}
	}
	return true;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:JavaProjectClassLoader.java

示例6: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void elementChanged(ElementChangedEvent event) {
	IWorkingSet[] workingSets;
	synchronized(fWorkingSets) {
		workingSets= fWorkingSets.toArray(new IWorkingSet[fWorkingSets.size()]);
	}
	for (int w= 0; w < workingSets.length; w++) {
		WorkingSetDelta workingSetDelta= new WorkingSetDelta(workingSets[w]);
		processJavaDelta(workingSetDelta, event.getDelta());
		IResourceDelta[] resourceDeltas= event.getDelta().getResourceDeltas();
		if (resourceDeltas != null) {
			for (int r= 0; r < resourceDeltas.length; r++) {
				processResourceDelta(workingSetDelta, resourceDeltas[r]);
			}
		}
		workingSetDelta.process();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaWorkingSetUpdater.java

示例7: fire

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public static void fire(final ElementChangedEvent extraEvent) {
    for (int i = 0; i < elementChangedListenerCount; i++) {
        if ((elementChangedListenerMasks[i] & extraEvent.getType()) != 0) {
            final IElementChangedListener listener = elementChangedListeners[i];

            // wrap callbacks with Safe runnable for subsequent listeners to
            // be called when some are causing grief
            SafeRunner.run(new ISafeRunnable() {
                @Override
                public void handleException(Throwable exception) {
                // Util.log(exception, "Exception occurred in listener
                // of Java element change notification"); //$NON-NLS-1$
                }

                @Override
                public void run() throws Exception {
                    listener.elementChanged(extraEvent);
                }
            });

        }
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:24,代码来源:ForceIdeEditorsPlugin.java

示例8: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
@Override
public void elementChanged(ElementChangedEvent event) {
	final IJavaProject javaProject = getCachedJavaProject();
	if (javaProject == null) {
		return;
	}

	final IJavaElementDelta[] children = event.getDelta().getChangedChildren();
	for (int i = 0; i < children.length; i++) {
		final IJavaElementDelta child = children[i];
		if (javaProject.equals(child.getElement())) {
			if (isClasspathChange(child)) {
				setCachedJavaProject(null);
			}
		}
	}
}
 
开发者ID:vogellacompany,项目名称:saneclipse,代码行数:18,代码来源:JFaceCompletionProposalComputer.java

示例9: start

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
	instance = this;
	detectionJob = new WildlfySwarmDetectionJob();
	classpathChangeListener = new ClasspathChangeListener(detectionJob);
	JavaCore.addElementChangedListener(classpathChangeListener, ElementChangedEvent.POST_CHANGE);
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:8,代码来源:CoreActivator.java

示例10: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public void elementChanged(ElementChangedEvent event) {
	if (event.getDelta() != null) {
		if (isAffectingPackageFragmentRoots(event.getDelta())) {
			initialize();
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:8,代码来源:AbstractJavaProjectsState.java

示例11: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public void elementChanged(ElementChangedEvent event) {
  // long t0= System.currentTimeMillis();
  IJavaElementDelta delta = event.getDelta();
  Set<IAdaptable> removedElements = new HashSet<IAdaptable>();
  Set<IAdaptable> potentiallyRemovedElements = new HashSet<IAdaptable>();
  collectRemoved(potentiallyRemovedElements, removedElements, delta);
  if (removedElements.size() > 0) handleRemoved(removedElements);
  if (potentiallyRemovedElements.size() > 0) handleRemoved(potentiallyRemovedElements);
  // System.out.println(this+"handled delta in: "+(System.currentTimeMillis()-t0));
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:SearchResultUpdater.java

示例12: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public void elementChanged(ElementChangedEvent event) {
  for (IJavaElementDelta delta : event.getDelta().getChangedChildren()) {
    int flags = delta.getFlags();
    if ((flags & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0) {
      IJavaElement element = delta.getElement();
      if (element.getElementType() != IJavaElement.JAVA_PROJECT) {
        continue;
      }

      classpathChanged((IJavaProject) element);
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:14,代码来源:ClasspathChangedListener.java

示例13: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public void elementChanged(ElementChangedEvent event) {
  final Map<IJavaElement, IJavaElementDelta> changedElements = new HashMap<IJavaElement, IJavaElementDelta>();

  JavaModelSearch.visitJavaElementDelta(event.getDelta(),
      new IJavaElementDeltaVisitor() {
        public boolean visit(IJavaElementDelta delta) {
          IJavaElement element = delta.getElement();

          /*
           * We care about packages being only added or removed because if we
           * called the change listeners on a change to a package, any change
           * to any file in that package will cause all ui.xml files that
           * reference that package (say with xmlns urn imports) to be
           * revalidated. Some projects end up having hundreds of ui.xml files
           * referencing a package, and then saving any change in that package
           * ends up taking tens of seconds.
           */
          int type = element.getElementType();
          if (type == IJavaElement.PACKAGE_FRAGMENT
              && delta.getKind() == IJavaElementDelta.CHANGED) {
            return true;
          }

          Set<IReference> references = referenceManager.getReferencesWithMatchingJavaElement(
              element, EnumSet.of(ReferenceLocationType.TARGET));
          if (references != null && references.size() > 0) {
            changedElements.put(element, delta);
          }
          return true;
        }
      });

  if (changedElements.size() > 0) {
    callReferenceChangeListeners(changedElements);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:37,代码来源:ElementChangeListener.java

示例14: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public void elementChanged(ElementChangedEvent e) {
	IJavaElementDelta delta= findElement(fInput, e.getDelta());
	if (delta != null && (delta.getFlags() & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_CHILDREN)) != 0) {

		if (shouldIgnoreDelta(e.getDelta().getCompilationUnitAST(), delta))
			return;

		fUpdatingCount++;
		try {
			update(createContext(false));
		} finally {
			fUpdatingCount--;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:DefaultJavaFoldingStructureProvider.java

示例15: elementChanged

import org.eclipse.jdt.core.ElementChangedEvent; //导入依赖的package包/类
public void elementChanged(final ElementChangedEvent event) {
	try {
		processDelta(event.getDelta());
	} catch(JavaModelException e) {
		JavaPlugin.log(e);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:JavaElementContentProvider.java


注:本文中的org.eclipse.jdt.core.ElementChangedEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。