Search in sources :

Example 11 with ResourceException

use of org.eclipse.core.internal.resources.ResourceException in project mdw-designer by CenturyLinkCloud.

the class WorkflowProjectManager method deleteProject.

public void deleteProject(IProject project) {
    WorkflowProject workflowProject = getWorkflowProject(project);
    if (workflowProject != null) {
        deleteProject(workflowProject);
    } else {
        try {
            project.delete(true, true, null);
        } catch (CoreException ex) {
            if (ex instanceof ResourceException && ex.getMessage().startsWith("Problems encountered while deleting"))
                MessageDialog.openWarning(MdwPlugin.getShell(), "Problems Deleting", "Not all resources under project '" + project.getName() + "' could be deleted.\nPlease delete the project manually on the file system.");
            else
                PluginMessages.uiError(ex, "Delete Project", workflowProject);
        }
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) ResourceException(org.eclipse.core.internal.resources.ResourceException)

Example 12 with ResourceException

use of org.eclipse.core.internal.resources.ResourceException in project jbosstools-hibernate by jbosstools.

the class HibernateErrorsTest2 method tearDown.

@Override
protected void tearDown() throws Exception {
    ccfg.reset();
    KnownConfigurations.getInstance().removeAllConfigurations();
    // super.tearDown();
    waitForJobs();
    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(// $NON-NLS-1$
    "org.eclipse.ui.resourcePerspective"));
    waitForJobs();
    // getProject().deleteIProject();
    // super.tearDown();
    final IProject proj = getProject().getIProject();
    String projRoot = proj.getLocation().toFile().getAbsolutePath();
    File file = new File(projRoot);
    deleted = false;
    int nTrys = 0;
    while (!deleted && nTrys++ < 5) {
        ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {

            public void run(IProgressMonitor monitor) throws CoreException {
                try {
                    proj.delete(true, true, null);
                    deleted = true;
                } catch (ResourceException re) {
                    // waitForJobs();
                    delay(1000);
                }
            }
        }, new NullProgressMonitor());
    }
    waitForJobs();
    FilesTransfer.delete(file);
}
Also used : IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) ResourceException(org.eclipse.core.internal.resources.ResourceException) File(java.io.File) IProject(org.eclipse.core.resources.IProject)

Aggregations

ResourceException (org.eclipse.core.internal.resources.ResourceException)12 IResourceStatus (org.eclipse.core.resources.IResourceStatus)4 IProject (org.eclipse.core.resources.IProject)3 CoreException (org.eclipse.core.runtime.CoreException)3 File (java.io.File)2 ResourceStatus (org.eclipse.core.internal.resources.ResourceStatus)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)1 IOException (java.io.IOException)1 JarEntry (java.util.jar.JarEntry)1 JarFile (java.util.jar.JarFile)1 IFile (org.eclipse.core.resources.IFile)1 IProjectDescription (org.eclipse.core.resources.IProjectDescription)1 IResource (org.eclipse.core.resources.IResource)1 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)1 IPath (org.eclipse.core.runtime.IPath)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 Path (org.eclipse.core.runtime.Path)1