本文整理汇总了Java中org.eclipse.core.runtime.CoreException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java CoreException.getMessage方法的具体用法?Java CoreException.getMessage怎么用?Java CoreException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.CoreException
的用法示例。
在下文中一共展示了CoreException.getMessage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getITypeMainByWorkspaceScope
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
/**
* search the bundle that contains the Main class. The search is done in the
* workspace scope (ie. if it is defined in the current workspace it will
* find it
*
* @return the name of the bundle containing the Main class or null if not
* found
*/
private IType getITypeMainByWorkspaceScope(String className) {
SearchPattern pattern = SearchPattern.createPattern(className, IJavaSearchConstants.CLASS,
IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH);
IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
final List<IType> binaryType = new ArrayList<IType>();
SearchRequestor requestor = new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
binaryType.add((IType) match.getElement());
}
};
SearchEngine engine = new SearchEngine();
try {
engine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope,
requestor, null);
} catch (CoreException e1) {
throw new RuntimeException("Error while searching the bundle: " + e1.getMessage());
// return new Status(IStatus.ERROR, Activator.PLUGIN_ID, );
}
return binaryType.isEmpty() ? null : binaryType.get(0);
}
示例2: performFinish
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
/**
* Creates the project, all the directories and files and open the .odesign.
*
* @return true if successful
*/
@Override
public boolean performFinish() {
try {
// if user do not reach page 2, the VSM name is defined according to
// the project name
if (!newOdesignPage.isVsmNameChanged) {
newOdesignPage.modelName.setText(newOdesignPage
.extractModelName(newOdesignPage.firstPage
.getProjectName()));
}
ViewpointSpecificationProject
.createNewViewpointSpecificationProject(workbench,
newProjectPage.getProjectName(), newProjectPage
.getLocationPath(), newOdesignPage
.getModelName().getText(), newOdesignPage
.getInitialObjectName(), newOdesignPage
.getEncoding(), getContainer());
return true;
} catch (final CoreException e) {
final IStatus status = new Status(IStatus.ERROR,
SiriusEditorPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
SiriusEditorPlugin.getPlugin().getLog().log(status);
return false;
}
}
示例3: handleCoreException
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
/**
* Handles a core exception thrown during a testing environment operation
*/
private void handleCoreException(CoreException e) {
e.printStackTrace();
IStatus status = e.getStatus();
String message = e.getMessage();
if (status.isMultiStatus()) {
MultiStatus multiStatus = (MultiStatus) status;
IStatus[] children = multiStatus.getChildren();
StringBuffer buffer = new StringBuffer();
for (int i = 0, max = children.length; i < max; i++) {
IStatus child = children[i];
if (child != null) {
buffer.append(child.getMessage());
buffer.append(System.getProperty("line.separator"));//$NON-NLS-1$
Throwable childException = child.getException();
if (childException != null) {
childException.printStackTrace();
}
}
}
message = buffer.toString();
}
Assert.isTrue(false, "Core exception in testing environment: " + message); //$NON-NLS-1$
}
示例4: closeProject
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
/**
* Tries to close the project with the given name.
*/
private void closeProject(String projectName) {
IN4JSEclipseProject n4jsProject = eclipseN4jsCore.findProject(URI.createPlatformResourceURI(projectName, true))
.orNull();
if (null == n4jsProject) {
throw new IllegalArgumentException("Could not find project with name '" + projectName + "'");
}
try {
n4jsProject.getProject().close(new NullProgressMonitor());
} catch (CoreException e) {
throw new IllegalArgumentException(
"Could not close project with name '" + projectName + "': " + e.getMessage());
}
}
示例5: getMessage
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
static String getMessage(CoreException ce) {
String msg = ce.getMessage();
if(msg != null && !msg.trim().equals("")) { // NOI18N
return msg;
}
IStatus status = ce.getStatus();
msg = status != null ? status.getMessage() : null;
return msg != null ? msg.trim() : null;
}
示例6: instanciate
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
protected Object instanciate(String attributeName) throws CoreException {
try
{
return _configurationElement.createExecutableExtension(attributeName);
}
catch(CoreException e)
{
String message = "Instanciation of one agent failed: " + e.getMessage() + " (see inner exception for more detail).";
CoreException exception = new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, message, e));
throw exception;
}
}
示例7: resolveClasspaths
import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
/**
* Resolves class path for a java project.
* @param arguments a list contains the main class name and project name
* @return the class paths entries
* @throws Exception when there are any errors during resolving class path
*/
public String[][] resolveClasspaths(List<Object> arguments) throws Exception {
try {
return computeClassPath((String) arguments.get(0), (String) arguments.get(1));
} catch (CoreException e) {
logger.log(Level.SEVERE, "Failed to resolve classpath: " + e.getMessage(), e);
throw new Exception("Failed to resolve classpath: " + e.getMessage(), e);
}
}