當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。