Java Code Examples for org.eclipse.core.runtime.CoreException
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.elasticbeanstalk/src/com/amazonaws/eclipse/elasticbeanstalk/.
Source file: Environment.java

@Override public IModule[] getRootModules(IModule module) throws CoreException { String moduleTypeId=module.getModuleType().getId().toLowerCase(); if (moduleTypeId.equals("jst.web")) { IStatus status=canModifyModules(new IModule[]{module},null); if (status == null || !status.isOK()) { throw new CoreException(status); } return new IModule[]{module}; } return J2EEUtil.getWebModules(module,null); }
Example 2
From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.elasticbeanstalk/src/com/amazonaws/eclipse/elasticbeanstalk/.
Source file: Environment.java

@Override public void modifyModules(IModule[] add,IModule[] remove,IProgressMonitor monitor) throws CoreException { IStatus status=canModifyModules(add,remove); if (status == null || !status.isOK()) { throw new CoreException(status); } if (add != null && add.length > 0 && getServer().getModules().length > 0) { ServerWorkingCopy serverWorkingCopy=(ServerWorkingCopy)getServer(); serverWorkingCopy.modifyModules(new IModule[0],serverWorkingCopy.getModules(),monitor); } }
Example 3
From project bel-editor, under directory /org.openbel.editor.core/src/org/openbel/editor/core/.
Source file: CoreFunctions.java

/** * Returns a compiler exception {@link CoreException}, deriving from the supplied exception as a result of executing the BEL compiler. <p> This method either returns the {@code e} supplied or provides somethingmore informative if {@code e} is has BEL compiler information.</p> * @param e {@link CoreException} * @return {@link CoreException} */ public static CoreException compilerException(CoreException e){ String msg=e.getMessage(); if (!msg.contains("exec returned:")) return e; String[] split=msg.split(" "); String strcode=split[split.length - 1]; ExitCode ec=getExitCode(parseInt(strcode)); if (ec == null) return e; String fmt="BEL Compiler failure (%d): %s"; msg=format(fmt,ec.getValue(),ec.getErrorMessage()); IStatus oldStatus=e.getStatus(); IStatus newStatus=new Status(IStatus.ERROR,oldStatus.getPlugin(),msg); CoreException ce=new CoreException(newStatus); ce.initCause(e); return ce; }
Example 4
From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/rcp/exception/.
Source file: ExceptionDetailsErrorDialog.java

/** * Put the details of the status of the error onto the stream. * @param buildingStatus * @param buffer * @param nesting */ private void populateCopyBuffer(IStatus buildingStatus,StringBuffer buffer,int nesting){ if (!buildingStatus.matches(displayMask)) { return; } for (int i=0; i < nesting; i++) { buffer.append(NESTING_INDENT); } buffer.append(buildingStatus.getMessage()); buffer.append("\n"); Throwable t=buildingStatus.getException(); if (t instanceof CoreException) { CoreException ce=(CoreException)t; populateCopyBuffer(ce.getStatus(),buffer,nesting + 1); } IStatus[] children=buildingStatus.getChildren(); for (int i=0; i < children.length; i++) { populateCopyBuffer(children[i],buffer,nesting + 1); } }
Example 5
From project Bio-PEPA, under directory /uk.ac.ed.inf.common/src/uk/ac/ed/inf/common/launching/.
Source file: LaunchingUtils.java

/** * Synchronously executes a process denoted by the given command-line and associates it to a launch. * @param launch the launch of the process * @param commandLine the command line arguments * @throws CoreException if the process does not quit OK. */ public static void executeAndWait(ILaunch launch,String[] commandLine) throws CoreException { Process p=DebugPlugin.exec(commandLine,null); RuntimeMonitorWithLock monitor=new RuntimeMonitorWithLock(launch,p,commandLine[0],null); int exitValue=monitor.waitFor(); if (exitValue != 0) throw new CoreException(new Status(IStatus.ERROR,CommonPlugin.PLUGIN_ID,commandLine[0] + " did not quit successfully",null)); }
Example 6
From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/contenttypes/.
Source file: CmlSpectrumFileDescriber.java

/** * Store parameters */ @SuppressWarnings("unchecked") public void setInitializationData(final IConfigurationElement config,final String propertyName,final Object data) throws CoreException { if (data instanceof String) count=(String)data; else if (data instanceof Hashtable) { Hashtable parameters=(Hashtable)data; type=(String)parameters.get(TYPE_TO_FIND); count=(String)parameters.get(COUNT_TO_FIND); } if (count == null) { String message=NLS.bind(ContentMessages.content_badInitializationData,CmlSpectrumFileDescriber.class.getName()); throw new CoreException(new Status(IStatus.ERROR,ContentMessages.OWNER_NAME,0,message,null)); } }
Example 7
From project bndtools, under directory /bndtools.core/src/bndtools/launch/.
Source file: AbstractOSGiLaunchDelegate.java

@Override public boolean buildForLaunch(ILaunchConfiguration configuration,String mode,IProgressMonitor monitor) throws CoreException { boolean result=super.buildForLaunch(configuration,mode,monitor); model=LaunchUtils.getBndProject(configuration); try { initialiseBndLauncher(configuration,model); } catch ( Exception e) { throw new CoreException(new Status(IStatus.ERROR,Plugin.PLUGIN_ID,0,"Error initialising bnd launcher",e)); } return result; }
Example 8
From project bndtools, under directory /bndtools.core/src/bndtools/launch/.
Source file: AbstractOSGiLaunchDelegate.java

@Override public File verifyWorkingDirectory(ILaunchConfiguration configuration) throws CoreException { try { return (model != null) ? model.getBase() : null; } catch ( Exception e) { throw new CoreException(new Status(IStatus.ERROR,Plugin.PLUGIN_ID,0,"Error getting working directory for Bnd project.",e)); } }
Example 9
From project BHT-FPA, under directory /patterns-codebeispiele/de.bht.fpa.examples.icashbox/src/de/bht/fpa/icashbox/.
Source file: ExecutableExtensionFactory.java

@SuppressWarnings("rawtypes") @Override public Object create() throws CoreException { final Bundle bundle=Activator.getDefault().getBundle(); final Injector injector=Activator.getDefault().getInjector(); try { final Class<?> clazz=bundle.loadClass(clazzName); final Object result=injector.getInstance(clazz); if (result instanceof IExecutableExtension) { ((IExecutableExtension)result).setInitializationData(config,null,null); } else if (result instanceof BasePresenter) { return ((BasePresenter)result).getView(); } return result; } catch ( Exception e) { throw new CoreException(new Status(IStatus.ERROR,bundle.getSymbolicName(),e.getMessage(),e)); } }
Example 10
From project Bio-PEPA, under directory /uk.ac.ed.inf.common/src/uk/ac/ed/inf/common/launching/.
Source file: BaseRunner.java

/** * Configures a runner with this launcher id * @param launcherId * @param optionMap * @throws CoreException */ public BaseRunner(String launcherId,Map<String,String> optionMap) throws CoreException { Assert.isNotNull(optionMap); Assert.isNotNull(launcherId); this.fOptionMap=optionMap; this.fLauncherId=launcherId; ILaunchManager manager=DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type=manager.getLaunchConfigurationType(fLauncherId); Assert.isNotNull(type); fCopy=type.newInstance(null,fLauncherId + " configuration"); for ( Map.Entry<String,String> entry : fOptionMap.entrySet()) { fCopy.setAttribute(entry.getKey(),entry.getValue()); } fResultFolder=LaunchingUtils.getOutputFolder(fCopy); if (fResultFolder == null) { throw new CoreException(StatusFactory.newCannotObtainResultFolder(null,null)); } }
Example 11
From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala/src/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/.
Source file: ScalaGeneratorPlugin.java

/** * Trace an Exception in the error log. * @param e Exception to log. * @param blocker <code>True</code> if the exception must be logged as error, <code>False</code> to log it as a warning. */ public static void log(Exception e,boolean blocker){ if (e == null) { throw new NullPointerException("Logging null exception"); } if (getDefault() == null) { e.printStackTrace(); } else if (e instanceof CoreException) { log(((CoreException)e).getStatus()); } else if (e instanceof NullPointerException) { int severity=IStatus.WARNING; if (blocker) { severity=IStatus.ERROR; } log(new Status(severity,PLUGIN_ID,severity,"Required element not found",e)); } else { int severity=IStatus.WARNING; if (blocker) { severity=IStatus.ERROR; } log(new Status(severity,PLUGIN_ID,severity,e.getMessage(),e)); } }
Example 12
From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.
Source file: ScalaEditor.java

/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void gotoMarker(IMarker marker){ try { if (marker.getType().equals(EValidator.MARKER)) { String uriAttribute=marker.getAttribute(EValidator.URI_ATTRIBUTE,null); if (uriAttribute != null) { URI uri=URI.createURI(uriAttribute); EObject eObject=editingDomain.getResourceSet().getEObject(uri,true); if (eObject != null) { setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); } } } } catch ( CoreException exception) { ScalaEditorPlugin.INSTANCE.log(exception); } }
Example 13
From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial/src/org/eclipse/acceleo/tutorial/wizard/.
Source file: EclipseConWizard.java

public static void writeFile(File file,IFolder folder,IProgressMonitor monitor){ String emtlContent=getFileContent(file); IFile newFile=folder.getFile(file.getName()); if (!newFile.exists()) { InputStream contents=new ByteArrayInputStream(emtlContent.getBytes()); try { newFile.create(contents,true,monitor); } catch ( CoreException e) { e.printStackTrace(); } } }
Example 14
From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.
Source file: WebappEditor.java

/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void gotoMarker(IMarker marker){ try { if (marker.getType().equals(EValidator.MARKER)) { String uriAttribute=marker.getAttribute(EValidator.URI_ATTRIBUTE,null); if (uriAttribute != null) { URI uri=URI.createURI(uriAttribute); EObject eObject=editingDomain.getResourceSet().getEObject(uri,true); if (eObject != null) { setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); } } } } catch ( CoreException exception) { WebappEditorPlugin.INSTANCE.log(exception); } }
Example 15
From project adt-cdt, under directory /com.android.ide.eclipse.adt.cdt/src/com/android/ide/eclipse/adt/cdt/internal/build/.
Source file: NDKCommandLauncher.java

@Override public Process execute(IPath commandPath,String[] args,String[] env,IPath changeToDirectory,IProgressMonitor monitor) throws CoreException { if (Platform.getOS().equals(Platform.OS_WIN32) || Platform.getOS().equals(Platform.OS_MACOSX)) { String command=commandPath.toString(); for ( String arg : args) command+=" " + arg; commandPath=new Path("sh"); args=new String[]{"-c",command}; } return super.execute(commandPath,args,env,changeToDirectory,monitor); }
Example 16
From project adt-cdt, under directory /com.android.ide.eclipse.adt.cdt/src/com/android/ide/eclipse/adt/cdt/internal/discovery/.
Source file: NDKDiscoveredPathInfo.java

public void update(IProgressMonitor monitor) throws CoreException { if (!needUpdating()) return; new NDKDiscoveryUpdater(this).runUpdate(monitor); if (includePaths != null && symbols != null) { recordUpdate(); save(); } }
Example 17
From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/rcp/.
Source file: AbstractElementExporterEPLoader.java

@SuppressWarnings("unchecked") public void handleTag(IConfigurationElement element) throws CoreException { String elementId=element.getAttribute(ELEMENT_ID_ATTRIBUTE_NAME); ElementExporter<Element> exporter; try { exporter=(ElementExporter<Element>)element.createExecutableExtension(CLASS_ATTRIBUTE_NAME); exporters.put(composeKey(elementId),exporter); } catch ( CoreException e) { e.printStackTrace(); } }
Example 18
From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/rcp/.
Source file: ExtensionLoader.java

public void loadExtension(ExtensionTagHandler handler){ IExtensionRegistry registry=Platform.getExtensionRegistry(); if (registry != null) { IExtensionPoint extensionPoint=registry.getExtensionPoint(extensionName); if (extensionPoint != null) { IExtension[] extensions=extensionPoint.getExtensions(); for ( IExtension extension : extensions) { IConfigurationElement[] configElements=extension.getConfigurationElements(); for ( IConfigurationElement tag : configElements) { try { handler.handleTag(tag); } catch ( CoreException e) { e.printStackTrace(); } } } } } }
Example 19
From project bel-editor, under directory /org.openbel.editor.core/src/org/openbel/editor/core/builder/.
Source file: BELCompileBuilder.java

@Override public boolean visit(IResourceDelta delta) throws CoreException { IResource resource=delta.getResource(); switch (delta.getKind()) { case IResourceDelta.ADDED: checkXML(resource); break; case IResourceDelta.REMOVED: break; case IResourceDelta.CHANGED: checkXML(resource); break; } return true; }
Example 20
From project Bioclipse.clustering, under directory /src/net/bioclipse/chem/clustering/business/.
Source file: ClusteringManagerFactory.java

public void setInitializationData(IConfigurationElement config,String propertyName,Object data) throws CoreException { manager=Activator.getDefault().getJavaScriptClusteringManager(); if (manager == null) { throw new IllegalStateException("Could not get the JavaScript flavoured " + "ClusteringManager"); } }
Example 21
From project bioclipse.opentox, under directory /plugins/net.bioclipse.opentox/src/net/bioclipse/opentox/business/.
Source file: OpentoxManagerFactory.java

public void setInitializationData(IConfigurationElement config,String propertyName,Object data) throws CoreException { manager=Activator.getDefault().getJavaScriptOpentoxManager(); if (manager == null) { throw new IllegalStateException("Could not get the JavaScript flavoured " + "OpentoxManager"); } }
Example 22
From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/actions/.
Source file: SjsFileContentProvider.java

public Object[] getChildren(Object parentElement){ ArrayList<IResource> childElements=new ArrayList<IResource>(); if (parentElement instanceof IContainer && ((IContainer)parentElement).isAccessible()) { IContainer container=(IContainer)parentElement; try { for (int i=0; i < container.members().length; i++) { IResource resource=container.members()[i]; if (resource instanceof IFile && isSjs((IFile)resource)) { childElements.add(resource); } else if (resource instanceof IContainer && resource.isAccessible() && containsMolecules((IContainer)resource)) { childElements.add(resource); } } } catch ( CoreException e) { LogUtils.handleException(e,logger,net.bioclipse.chemoinformatics.Activator.PLUGIN_ID); } catch ( IOException e) { LogUtils.handleException(e,logger,net.bioclipse.chemoinformatics.Activator.PLUGIN_ID); } } return childElements.toArray(); }
Example 23
From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/actions/.
Source file: SjsFileContentProvider.java

private boolean containsMolecules(IContainer container) throws CoreException, IOException { for (int i=0; i < container.members().length; i++) { if (container.members()[i] instanceof IFile && isSjs((IFile)container.members()[i])) { return true; } } for (int i=0; i < container.members().length; i++) { if (container.members()[i] instanceof IContainer) { if (containsMolecules((IContainer)container.members()[i])) return true; } } return false; }
Example 24
From project bioclipse.speclipse, under directory /plugins/net.bioclipse.bibtex/src/net/bioclipse/bibtex/business/.
Source file: BibtexManager.java

public IJabrefBibliodata loadBibliodata(IFile file) throws IOException, BioclipseException, CoreException { BibtexParser parser=new BibtexParser(new InputStreamReader(file.getContents())); if (Globals.prefs == null) { Globals.prefs=JabRefPreferences.getInstance(); } ParserResult result=parser.parse(); BibtexDatabase db=result.getDatabase(); return new JabrefBibliodata(db); }
Example 25
From project bioclipse.vscreen, under directory /net.bioclipse.vscreen/src/net/bioclipse/vscreen/business/.
Source file: VScreenManager.java

/** * @param filterName Name of filter to create * @return a new filter with name filterName * @throws BioclipseException if no filter with filterName exists or if creation fails */ private IScreeningFilter newFilter(String filterName) throws BioclipseException { if (!existsFilter(filterName)) throw new BioclipseException("No filter wih name: " + filterName); IExtensionRegistry registry=Platform.getExtensionRegistry(); if (registry == null) throw new BioclipseException("Eclipse registry=null. Cannot get screeningfilters from EPs."); IExtensionPoint serviceObjectExtensionPoint=registry.getExtensionPoint("net.bioclipse.vscreen.filter"); IExtension[] serviceObjectExtensions=serviceObjectExtensionPoint.getExtensions(); for ( IExtension extension : serviceObjectExtensions) { for ( IConfigurationElement element : extension.getConfigurationElements()) { if (element.getName().equals("screeningFilter")) { String pname=element.getAttribute("name"); if (pname.equalsIgnoreCase(filterName)) { String pid=element.getAttribute("id"); String picon=element.getAttribute("icon"); String pdescription=element.getAttribute("description"); String pluginID=element.getNamespaceIdentifier(); Object obj; try { obj=element.createExecutableExtension("class"); IScreeningFilter filter=(IScreeningFilter)obj; filter.setId(pid); filter.setName(pname); filter.setIconpath(picon); filter.setDescription(pdescription); filter.setPlugin(pluginID); return filter; } catch ( CoreException e) { LogUtils.handleException(e,logger,net.bioclipse.vscreen.Activator.PLUGIN_ID); } } } } } throw new BioclipseException("Could not find filter named " + filterName); }
Example 26
From project bioclipse.vscreen, under directory /net.bioclipse.vscreen/src/net/bioclipse/vscreen/business/.
Source file: VScreenManagerFactory.java

public void setInitializationData(IConfigurationElement config,String propertyName,Object data) throws CoreException { manager=Activator.getDefault().getJavaScriptVScreenManager(); if (manager == null) { throw new IllegalStateException("Could not get the JavaScript flavoured " + "VScreenManager"); } }