use of org.eclipse.core.resources.IResourceChangeListener in project eclipse-cs by checkstyle.
the class AbstractStatsView method createPartControl.
//
// methods
//
/**
* {@inheritDoc}
*
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
mMainComposite = parent;
// create and register the workspace focus listener
mFocusListener = new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
AbstractStatsView.this.focusSelectionChanged(part, selection);
}
};
getSite().getPage().addSelectionListener(mFocusListener);
focusSelectionChanged(getSite().getPage().getActivePart(), getSite().getPage().getSelection());
// create and register the listener for resource changes
mResourceListener = new IResourceChangeListener() {
@Override
public void resourceChanged(IResourceChangeEvent event) {
IMarkerDelta[] markerDeltas = event.findMarkerDeltas(CheckstyleMarker.MARKER_ID, true);
if (markerDeltas.length > 0) {
refresh();
}
}
};
ResourcesPlugin.getWorkspace().addResourceChangeListener(mResourceListener);
makeActions();
initActionBars(getViewSite().getActionBars());
}
use of org.eclipse.core.resources.IResourceChangeListener in project flux by eclipse.
the class Activator method initCoreService.
private void initCoreService(String userChannel) throws CoreException {
repository = new Repository(messageConnector, userChannel);
liveEditCoordinator = new LiveEditCoordinator(messageConnector);
IWorkspace workspace = ResourcesPlugin.getWorkspace();
resourceListener = new CloudSyncResourceListener(repository);
workspace.addResourceChangeListener(resourceListener, IResourceChangeEvent.POST_CHANGE);
metadataListener = new CloudSyncMetadataListener(repository);
workspace.addResourceChangeListener(metadataListener, IResourceChangeEvent.POST_BUILD);
this.repositoryListener = new IRepositoryListener() {
@Override
public void projectDisconnected(IProject project) {
removeConnectedProjectPreference(project.getName());
}
@Override
public void projectConnected(IProject project) {
addConnectedProjectPreference(project.getName());
}
@Override
public void resourceChanged(IResource resource) {
// nothing
}
};
getRepository().addRepositoryListener(repositoryListener);
workspaceListener = new IResourceChangeListener() {
public void resourceChanged(IResourceChangeEvent event) {
if (event.getResource() instanceof IProject) {
IResourceDelta delta = event.getDelta();
if (delta == null) {
return;
}
if (delta.getKind() == IResourceDelta.REMOVED) {
IProject project = (IProject) event.getResource();
removeConnectedProjectPreference(project.getName());
} else if (delta.getKind() == IResourceDelta.CHANGED) {
// TODO, we aren't handling project renaming yet
// IProject project = (IProject) event.getResource();
// String oldName =
// delta.getMovedFromPath().lastSegment();
// removeConnectedProjectPreference(oldName);
// addConnectedProjectPreference(project.getName());
}
}
}
};
workspace.addResourceChangeListener(workspaceListener);
updateProjectConnections();
}
use of org.eclipse.core.resources.IResourceChangeListener in project eclipse-pmd by acanda.
the class PMDPlugin method initWorkspaceModel.
private void initWorkspaceModel() {
workspaceModel = new WorkspaceModel();
final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final ProjectModelRepository projectModelRepository = new ProjectModelRepository();
for (final IProject project : projects) {
final Optional<ProjectModel> model = projectModelRepository.load(project.getName());
if (model.isPresent()) {
workspaceModel.add(model.get());
} else {
workspaceModel.add(new ProjectModel(project.getName()));
}
}
final IResourceChangeListener workspaceChangeListener = new WorkspaceChangeListener(workspaceModel, projectModelRepository);
ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceChangeListener, IResourceChangeEvent.POST_CHANGE);
}
use of org.eclipse.core.resources.IResourceChangeListener in project erlide_eclipse by erlang.
the class ErlModel method setupWorkspaceListeners.
public final void setupWorkspaceListeners() {
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
final IPathVariableManager pvm = workspace.getPathVariableManager();
pvm.addChangeListener(fPathVariableChangeListener);
final IResourceChangeListener listener = new ResourceChangeListener();
workspace.addResourceChangeListener(listener);
}
use of org.eclipse.core.resources.IResourceChangeListener in project che by eclipse.
the class RefactoringHistoryService method connect.
/**
* {@inheritDoc}
*/
public void connect() {
fReferenceCount++;
if (fReferenceCount == 1) {
fOperationListener = new IOperationHistoryListener() {
public void historyNotification(final OperationHistoryEvent event) {
performHistoryNotification(event);
}
};
OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(fOperationListener);
fResourceListener = new IResourceChangeListener() {
public void resourceChanged(final IResourceChangeEvent event) {
peformResourceChanged(event);
}
};
ResourcesPlugin.getWorkspace().addResourceChangeListener(fResourceListener, IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.POST_CHANGE);
}
}
Aggregations