當前位置: 首頁>>代碼示例>>Java>>正文


Java CoreException.getMessage方法代碼示例

本文整理匯總了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);
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:34,代碼來源:PlainK3ExecutionEngine.java

示例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;
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:31,代碼來源:NewGemocSiriusProjectWizard.java

示例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$
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:27,代碼來源:TestingEnvironment.java

示例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());
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:17,代碼來源:SelectAllProjectExplorer_PluginUITest.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:BugzillaExecutor.java

示例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;
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:13,代碼來源:Extension.java

示例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);
    }
}
 
開發者ID:Microsoft,項目名稱:java-debug,代碼行數:15,代碼來源:ResolveClasspathsHandler.java


注:本文中的org.eclipse.core.runtime.CoreException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。