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


Java IResourceChangeEvent.PRE_DELETE属性代码示例

本文整理汇总了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));
	}
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:25,代码来源:PlatformHolder.java

示例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;
	}
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:16,代码来源:WorkspaceProjectTemplateProvider.java

示例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;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:ABasicEditor.java

示例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);
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:SendPingJob.java

示例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);
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:19,代码来源:BundleMonitor.java

示例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;
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:13,代码来源:PgDbParser.java

示例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;
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:14,代码来源:ProjectEditorDiffer.java

示例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());
    }

}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:13,代码来源:WorkspaceSpecManager.java

示例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);
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:36,代码来源:ResourcesWatcher.java

示例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);
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:11,代码来源:WorkspaceProjectTemplateProvider.java

示例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;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:38,代码来源:AMultiEditor.java

示例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;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:40,代码来源:JrxmlEditor.java

示例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();
				}
			}
		}

	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:38,代码来源:MultiPageCSVEditor.java

示例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();
    }
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:9,代码来源:ProjectProperties.java

示例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);
	}
}
 
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:14,代码来源:BibtexEntryView.java


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