本文整理汇总了Java中org.eclipse.core.resources.IResourceChangeEvent.PRE_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java IResourceChangeEvent.PRE_DELETE属性的具体用法?Java IResourceChangeEvent.PRE_DELETE怎么用?Java IResourceChangeEvent.PRE_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.resources.IResourceChangeEvent
的用法示例。
在下文中一共展示了IResourceChangeEvent.PRE_DELETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: workspaceChanged
void workspaceChanged(IResourceChangeEvent event) {
try {
if (event.getType() == IResourceChangeEvent.PRE_DELETE || event.getType() == IResourceChangeEvent.PRE_CLOSE) {
if (Platform.isPlatformProject((IProject)event.getResource())) {
clear();
}
}
else if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
event.getDelta().accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (delta.getKind() == IResourceDelta.ADDED
&& delta.getResource().getType() == IResource.PROJECT) {
projectAdded((IProject) delta.getResource());
}
return delta.getResource().getType() == IResource.ROOT;
}
});
}
} catch (CoreException e) {
log.log(new Status(Status.ERROR, log.getBundle().getSymbolicName(), "Error when handling IResourceChangedEvent", e));
}
}
示例2: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
switch (event.getType()) {
case IResourceChangeEvent.POST_CHANGE:
handleResourceDelta(event.getDelta());
break;
case IResourceChangeEvent.PRE_DELETE:
// fall through
case IResourceChangeEvent.PRE_CLOSE:
IProject project = event.getResource().getProject();
if (isInterestingProject(project)) {
removeTemplates(project.getName());
}
break;
}
}
示例3: resourceChanged
public void resourceChanged(final IResourceChangeEvent event) {
switch (event.getType()) {
case IResourceChangeEvent.PRE_DELETE:
break;
case IResourceChangeEvent.POST_CHANGE:
try {
DeltaVisitor visitor = new DeltaVisitor(ABasicEditor.this);
event.getDelta().accept(visitor);
} catch (CoreException e) {
UIUtils.showError(e);
}
break;
case IResourceChangeEvent.PRE_BUILD:
case IResourceChangeEvent.POST_BUILD:
break;
}
}
示例4: resourceChanged
public void resourceChanged(IResourceChangeEvent event)
{
if (event.getType() == IResourceChangeEvent.PRE_DELETE)
{
// check if it is a studio project and then send the ping out
try
{
IProject project = event.getResource().getProject();
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
if (!ArrayUtil.isEmpty(natures))
{
// just checking the primary nature
String projectType = STUDIO_NATURE_MAP.get(natures[0]);
if (!StringUtil.isEmpty(projectType))
{
sendProjectDeleteEvent(project, projectType);
}
}
}
catch (Exception e)
{
UsagePlugin.logError(e);
}
}
}
示例5: resourceChanged
public void resourceChanged(IResourceChangeEvent event)
{
if (event.getType() == IResourceChangeEvent.PRE_DELETE)
{
handleProjectDeleteEvent((IProject) event.getResource());
}
else
{
try
{
event.getDelta().accept(this);
}
catch (CoreException e)
{
IdeLog.logError(ScriptingActivator.getDefault(),
Messages.BundleMonitor_Error_Processing_Resource_Change, e);
}
}
}
示例6: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
switch (event.getType()) {
case IResourceChangeEvent.PRE_CLOSE:
case IResourceChangeEvent.PRE_DELETE:
if (PROJ_PARSERS.remove(event.getResource(), this)) {
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
break;
default:
break;
}
}
示例7: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
switch (event.getType()) {
case IResourceChangeEvent.PRE_CLOSE:
case IResourceChangeEvent.PRE_DELETE:
handlerCloseProject(event);
break;
case IResourceChangeEvent.POST_CHANGE:
handleChangeProject(event.getDelta());
break;
default:
break;
}
}
示例8: resourceChanged
public void resourceChanged(IResourceChangeEvent event)
{
/*
* remove elements from the storage if the projects are deleted
*/
IResource resource = event.getResource();
if (resource != null && IResource.PROJECT == resource.getType()
&& IResourceChangeEvent.PRE_DELETE == event.getType())
{
specStorage.remove(resource.getName());
}
}
示例9: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
try {
IResource resource = event.getResource();
switch (event.getType()) {
case IResourceChangeEvent.PRE_DELETE:
if (resource != null) {
switch (resource.getType()) {
case IResource.PROJECT:
// called when project is deleted.
deleteProject((IProject) resource);
break;
}
}
break;
case IResourceChangeEvent.PRE_CLOSE:
if (resource != null) {
switch (resource.getType()) {
case IResource.PROJECT:
// called when project is closed.
closeProject((IProject) resource);
break;
}
}
break;
case IResourceChangeEvent.POST_CHANGE:
IResourceDelta delta = event.getDelta();
if (delta != null) {
delta.accept(this);
}
break;
}
} catch (Throwable e) {
Trace.trace(Trace.SEVERE, "Error while TypeScript resource changed", e);
}
}
示例10: initialise
private void initialise() {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
try {
workspaceRoot.accept(this);
} catch (CoreException e) {
throw new RuntimeException(e);
}
int event = IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.POST_CHANGE;
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, event);
}
示例11: resourceChanged
/**
* Closes all project files on project close.
*
* @param event
* the event
*/
public void resourceChanged(final IResourceChangeEvent event) {
switch (event.getType()) {
case IResourceChangeEvent.PRE_CLOSE:
Display.getDefault().asyncExec(new Runnable() {
public void run() {
IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
for (int i = 0; i < pages.length; i++) {
if (((FileEditorInput) xmlEditor.getEditorInput()).getFile().getProject().equals(event.getResource())) {
IEditorPart editorPart = pages[i].findEditor(xmlEditor.getEditorInput());
pages[i].closeEditor(editorPart, true);
}
}
}
});
break;
case IResourceChangeEvent.PRE_DELETE:
break;
case IResourceChangeEvent.POST_CHANGE:
try {
DeltaVisitor visitor = new DeltaVisitor(this);
event.getDelta().accept(visitor);
if (jrContext != null && getEditorInput() != null)
jrContext.init(((IFileEditorInput) getEditorInput()).getFile());
} catch (CoreException e) {
UIUtils.showError(e);
}
break;
case IResourceChangeEvent.PRE_BUILD:
case IResourceChangeEvent.POST_BUILD:
break;
}
}
示例12: resourceChanged
/**
* Closes all project files on project close.
*
* @param event
* the event
*/
public void resourceChanged(final IResourceChangeEvent event) {
if (isRefresh)
return;
switch (event.getType()) {
case IResourceChangeEvent.PRE_CLOSE:
Display.getDefault().asyncExec(new Runnable() {
public void run() {
IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
for (int i = 0; i < pages.length; i++) {
if (((FileEditorInput) xmlEditor.getEditorInput()).getFile().getProject().equals(event.getResource())) {
IEditorPart editorPart = pages[i].findEditor(xmlEditor.getEditorInput());
pages[i].closeEditor(editorPart, true);
}
}
}
});
break;
case IResourceChangeEvent.PRE_DELETE:
break;
case IResourceChangeEvent.POST_CHANGE:
try {
DeltaVisitor visitor = new DeltaVisitor(this);
event.getDelta().accept(visitor);
if (jrContext != null && getEditorInput() != null)
jrContext.init(((IFileEditorInput) getEditorInput()).getFile());
} catch (CoreException e) {
UIUtils.showError(e);
}
break;
case IResourceChangeEvent.PRE_BUILD:
case IResourceChangeEvent.POST_BUILD:
break;
}
}
示例13: resourceChanged
/**
* Closes all project files on project close.
*
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
*/
@Override
public void resourceChanged(final IResourceChangeEvent event) {
if (event.getType() == IResourceChangeEvent.PRE_CLOSE || event.getType() == IResourceChangeEvent.PRE_DELETE) {
WorkbenchHelper.asyncRun(() -> {
final IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
for (final IWorkbenchPage page : pages) {
if (((FileEditorInput) editor.getEditorInput()).getFile().getProject()
.equals(event.getResource())) {
final IEditorPart editorPart = page.findEditor(editor.getEditorInput());
page.closeEditor(editorPart, true);
}
}
});
} else {
final IResourceDelta delta = event.getDelta().findMember(getFileFor(getEditorInput()).getFullPath());
if (delta != null) {
// file deleted -- close the editor
if (delta.getKind() == IResourceDelta.REMOVED) {
final Runnable r = () -> getSite().getPage().closeEditor(MultiPageCSVEditor.this, false);
getSite().getShell().getDisplay().asyncExec(r);
}
// file changed -- reload
else if (delta.getKind() == IResourceDelta.CHANGED) {
final int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.LOCAL_CHANGED) != 0) {
MultiPageCSVEditor.this.updateTableFromTextEditor();
}
}
}
}
}
示例14: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResource resource = event.getResource();
if ((event.getType() == IResourceChangeEvent.PRE_CLOSE
|| event.getType() == IResourceChangeEvent.PRE_DELETE)
&& resource != null && resource.equals(project)) {
dispose();
}
}
示例15: resourceChanged
/**
* Fired whenever a resource is changed
*/
@Override
public void resourceChanged(IResourceChangeEvent event) {
if(event.getType() != IResourceChangeEvent.POST_CHANGE && event.getType() != IResourceChangeEvent.PRE_DELETE){
return;
}
if(event.getType() == IResourceChangeEvent.POST_CHANGE){
handleResourceChangeEvent(event);
} else if (event.getType() == IResourceChangeEvent.PRE_DELETE){
handleResourceDeleteEvent(event);
}
}