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


Java CoreException类代码示例

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


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

示例1: performFinish

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
public boolean performFinish() {
	final Collection<ProjectDescriptor> projectDescriptors = getProjectDescriptors();
	
	WorkspaceJob job = new WorkspaceJob("Unzipping Projects") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			monitor.beginTask("Unzipping Projects", projectDescriptors.size());
			//System.out.println("Unzipping projects...");
			for ( ProjectDescriptor desc : projectDescriptors ) {
				unzipProject(desc, monitor);
				monitor.worked(1);
			}
			//System.out.println("Projects unzipped");
			return Status.OK_STATUS;
		}
	};
	job.setRule(ResourcesPlugin.getWorkspace().getRoot());
	job.schedule();
	return true;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:21,代码来源:AbstractExampleWizard.java

示例2: update

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
/**
 * @param project
 * @param buildPolicyFile
 * @param graphFilePath
 * @param updatedGenerators
 * @throws IOException
 * @throws CoreException
 * @throws InterruptedException
 */
public static void update(IProject project, IFile buildPolicyFile, String graphFilePath,
		List<String> updatedGenerators) throws IOException, CoreException, InterruptedException {
	Job job = new WorkspaceJob("Updating policies") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				_update(project, buildPolicyFile, graphFilePath, updatedGenerators, monitor);
			} catch (FileNotFoundException e) {
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(buildPolicyFile.getProject());
	job.setUser(true);
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:26,代码来源:BuildPolicyManager.java

示例3: taskDataUpdated

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
@Override
public void taskDataUpdated (TaskDataListener.TaskDataEvent event) {
    if (event.getTask() == task) {
        if (event.getTaskData() != null && !event.getTaskData().isPartial()) {
            repositoryDataRef = new SoftReference<TaskData>(event.getTaskData());
        }
        if (event.getTaskDataUpdated()) {
            NbTaskDataModel m = model;
            if (m != null) {
                try {
                    m.refresh();
                } catch (CoreException ex) {
                    LOG.log(Level.INFO, null, ex);
                }
            }
            AbstractNbTaskWrapper.this.taskDataUpdated();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:AbstractNbTaskWrapper.java

示例4: createXmlFilesForPastedJobFiles

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
private void createXmlFilesForPastedJobFiles(List<IFile> pastedFileList) {
	for (IFile file : pastedFileList) {
		try(InputStream inputStream=file.getContents()) {
			Container container = (Container) CanvasUtils.INSTANCE.fromXMLToObject(inputStream);
			IPath path = file.getFullPath().removeFileExtension().addFileExtension(XML);
			IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
			if(xmlFile.exists()){
				int userInput = showErrorMessage(xmlFile,xmlFile.getName()+" already exists.Do you want to replace it?");
				if (userInput == SWT.YES) {
					ConverterUtil.INSTANCE.convertToXML(container, true, xmlFile, null);
				} 
			}
			else {
				ConverterUtil.INSTANCE.convertToXML(container, true, xmlFile, null);
			}

		} catch (CoreException | InstantiationException | IllegalAccessException | InvocationTargetException
				| NoSuchMethodException | IOException exception) {
			logger.error("Error while generating xml files for pasted job files", exception);

		} 
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:PasteHandler.java

示例5: initializeFrom

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
 */
public void initializeFrom(final ILaunchConfiguration configuration) {
	super.initializeFrom(configuration);
	disableUpdate = true;

	siriusResourceURIText.setText("");

	try {
		siriusResourceURIText.setText(configuration.getAttribute(
				AbstractDSLLaunchConfigurationDelegate.RESOURCE_URI, ""));
	} catch (CoreException e) {
		Activator.getDefault().error(e);
	}

	disableUpdate = false;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:21,代码来源:DSLLaunchConfigurationTab.java

示例6: addJvmOptions

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
private void addJvmOptions ( final ILaunchConfigurationWorkingCopy cfg, final Profile profile, final IContainer container ) throws CoreException
{
    final List<String> args = new LinkedList<> ();

    args.addAll ( profile.getJvmArguments () );

    for ( final SystemProperty p : profile.getProperty () )
    {
        addSystemProperty ( profile, args, p.getKey (), p.getValue (), p.isEval () );
    }

    for ( final Map.Entry<String, String> entry : getInitialProperties ().entrySet () )
    {
        addSystemProperty ( profile, args, entry.getKey (), entry.getValue (), false );
    }

    final IFile dataJson = container.getFile ( new Path ( "data.json" ) ); //$NON-NLS-1$
    if ( dataJson.exists () )
    {
        addJvmArg ( args, "org.eclipse.scada.ca.file.provisionJsonUrl", escapeArgValue ( dataJson.getLocation ().toFile ().toURI ().toString () ) ); //$NON-NLS-1$
    }

    cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, StringHelper.join ( args, "\n" ) );
    cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, StringHelper.join ( profile.getArguments (), "\n" ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:LaunchShortcut.java

示例7: resolveSyncCodeLens

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
@Override
protected ICodeLens resolveSyncCodeLens(ICodeLensContext context, ICodeLens codeLens, IProgressMonitor monitor) {
	ITextEditor textEditor = ((IEditorCodeLensContext) context).getTextEditor();
	IFile file = EditorUtils.getFile(textEditor);
	if (file == null) {
		return null;
	}
	EditorConfigCodeLens cl = (EditorConfigCodeLens) codeLens;
	CountSectionPatternVisitor visitor = new CountSectionPatternVisitor(cl.getSection());
	try {
		file.getParent().accept(visitor, IResource.NONE);
		cl.update(visitor.getNbFiles() + " files match");
	} catch (CoreException e) {
		cl.update(e.getMessage());
	}
	return cl;
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:18,代码来源:EditorConfigCodeLensProvider.java

示例8: startServer

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
public Collection<? extends ServerDescriptor> startServer ( final URI exporterFileUri, final String locationLabel ) throws CoreException
{
    final ResourceSetImpl resourceSet = new ResourceSetImpl ();

    resourceSet.getResourceFactoryRegistry ().getExtensionToFactoryMap ().put ( "*", new ExporterResourceFactoryImpl () );

    final Resource resource = resourceSet.createResource ( exporterFileUri );
    try
    {
        resource.load ( null );
    }
    catch ( final IOException e )
    {
        throw new CoreException ( StatusHelper.convertStatus ( HivesPlugin.PLUGIN_ID, "Failed to load configuration", e ) );
    }

    final DocumentRoot root = (DocumentRoot)EcoreUtil.getObjectByType ( resource.getContents (), ExporterPackage.Literals.DOCUMENT_ROOT );
    if ( root == null )
    {
        throw new CoreException ( new Status ( IStatus.ERROR, HivesPlugin.PLUGIN_ID, "Failed to locate exporter configuration in: " + exporterFileUri ) );
    }
    return startServer ( root, locationLabel );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ServerHostImpl.java

示例9: getProjectCompilationUnits

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
/**
 * Returns all compilation units of a given project.
 * @param javaProject Project to collect units
 * @return List of org.eclipse.jdt.core.ICompilationUnit
 */
protected List getProjectCompilationUnits(IJavaProject javaProject) throws CoreException {
  IPackageFragmentRoot[] fragmentRoots = javaProject.getPackageFragmentRoots();
  int length = fragmentRoots.length;
  List allUnits = new ArrayList();
  for (int i = 0; i < length; i++) {
    if (fragmentRoots[i] instanceof JarPackageFragmentRoot)
      continue;
    IJavaElement[] packages = fragmentRoots[i].getChildren();
    for (int k = 0; k < packages.length; k++) {
      IPackageFragment pack = (IPackageFragment) packages[k];
      ICompilationUnit[] units = pack.getCompilationUnits();
      for (int u = 0; u < units.length; u++) {
        allUnits.add(units[u]);
      }
    }
  }
  return allUnits;
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:24,代码来源:FullSourceWorkspaceTests.java

示例10: add

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
@Override
public void add ( final ConnectionDescriptor connectionInformation ) throws CoreException
{
    try
    {
        if ( addConnection ( connectionInformation ) )
        {
            performAdd ( connectionInformation );
        }
    }
    catch ( final Exception e )
    {
        throw new CoreException ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
    }

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:AbstractPreferencesDiscoverer.java

示例11: setGW4ENature

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
/**
 * Set the GW4E Nature to the passed project
 * 
 * @param project
 * @return
 * @throws CoreException
 */
public static IStatus setGW4ENature(IProject project) throws CoreException {
	IProjectDescription description = project.getDescription();
	String[] natures = description.getNatureIds();
	String[] newNatures = new String[natures.length + 1];
	System.arraycopy(natures, 0, newNatures, 0, natures.length);

	// add our id
	newNatures[natures.length] = GW4ENature.NATURE_ID;

	// validate the natures
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	IStatus status = workspace.validateNatureSet(newNatures);

	if (status.getCode() == IStatus.OK) {
		description.setNatureIds(newNatures);
		project.setDescription(description, null);
	}
	return status;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:27,代码来源:GW4ENature.java

示例12: collectIndexableFiles

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
/**
 * Scans workspace for files that may end up in XtextIndex when given location is processed by the builder. This is
 * naive filtering based on {@link IndexableFilesDiscoveryUtil#INDEXABLE_FILTERS file extensions}. Symlinks are not
 * followed.
 *
 * @param workspace
 *            to scan
 * @return collection of indexable locations
 * @throws CoreException
 *             if scanning of the workspace is not possible.
 */
public static Collection<String> collectIndexableFiles(IWorkspace workspace) throws CoreException {
	Set<String> result = new HashSet<>();
	workspace.getRoot().accept(new IResourceVisitor() {

		@Override
		public boolean visit(IResource resource) throws CoreException {
			if (resource.getType() == IResource.FILE) {
				IFile file = (IFile) resource;
				if (INDEXABLE_FILTERS.contains(file.getFileExtension().toLowerCase())) {
					result.add(file.getFullPath().toString());
				}
			}
			return true;
		}
	});
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:IndexableFilesDiscoveryUtil.java

示例13: createHandler

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
static ExceptionHandler createHandler(CoreException ce, BugzillaExecutor executor, BugzillaRepository repository, ValidateCommand validateCommand, boolean forRexecute) {
    String errormsg = getLoginError(repository, validateCommand, ce);
    if(errormsg != null) {
        return new LoginHandler(ce, errormsg, executor, repository);
    }
    errormsg = getKenaiRedirectError(ce);
    if(errormsg != null) {
        return new LoginHandler(ce, errormsg, executor, repository);
    }
    errormsg = getNotFoundError(ce);
    if(errormsg != null) {
        return new NotFoundHandler(ce, errormsg, executor, repository);
    }
    errormsg = getMidAirColisionError(ce);
    if(errormsg != null) {
        if(forRexecute) { 
            return new MidAirHandler(ce, errormsg, executor, repository);
        } else {
            errormsg = MessageFormat.format(errormsg, repository.getDisplayName());
            return new DefaultHandler(ce, errormsg, executor, repository);
        }
    }
    return new DefaultHandler(ce, null, executor, repository);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:BugzillaExecutor.java

示例14: mkdirs

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
private static void mkdirs(IFolder destPath) {
	IContainer parent = destPath.getParent(); 
	if (! parent.exists()) {
		if (parent instanceof IFolder) {
			mkdirs((IFolder) parent);
		}
		else if (parent instanceof IProject) {
			mkdirs( ((IProject)parent).getFolder(".") );
		}
	}
	try {
		destPath.create(/*force*/true, /*local*/true, Constants.NULL_PROGRESS_MONITOR);
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:17,代码来源:FileUtil.java

示例15: removeResource

import org.eclipse.core.runtime.CoreException; //导入依赖的package包/类
/**
 * Remove a resource (i.e. all its properties) from the builder's preferences.
 * 
 * @param prefs the preferences
 * @param resource the resource
 * @throws BackingStoreException
 */
public static void removeResource(Preferences prefs, IResource resource) 
		throws CoreException {
	try {
		String[] keys = prefs.keys();
		for (String key: keys) {
			if (key.endsWith("//" + resource.getProjectRelativePath().toPortableString())) {
				prefs.remove(key);
			}
		}
		prefs.flush();
	} catch (BackingStoreException e) {
		throw new CoreException(new Status(
				IStatus.ERROR, MinifyBuilder.BUILDER_ID, e.getMessage(), e));
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:23,代码来源:PrefsAccess.java


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