use of org.eclipse.core.runtime.CoreException in project che by eclipse.
the class ContributionContextTypeRegistry method createResolver.
private static TemplateVariableResolver createResolver(IConfigurationElement element) throws CoreException {
try {
String type = element.getAttribute(TYPE);
if (type != null) {
TemplateVariableResolver resolver = (TemplateVariableResolver) element.createExecutableExtension(CLASS);
resolver.setType(type);
String desc = element.getAttribute(DESCRIPTION);
//$NON-NLS-1$
resolver.setDescription(desc == null ? "" : desc);
return resolver;
}
} catch (ClassCastException e) {
//$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.ui.editors", IStatus.OK, "extension does not implement " + TemplateVariableResolver.class.getName(), e));
}
return null;
}
use of org.eclipse.core.runtime.CoreException in project che by eclipse.
the class ContributionContextTypeRegistry method createContextType.
/**
* Tries to create a context type given an id. Contributions to the
* <code>org.eclipse.ui.editors.templates</code> extension point are
* searched for the given identifier and the specified context type
* instantiated if it is found. Any contributed
* {@link org.eclipse.jface.text.templates.TemplateVariableResolver}s
* are also instantiated and added to the context type.
*
* @param id the id for the context type as specified in XML
* @return the instantiated and configured context type, or
* <code>null</code> if it is not found or cannot be instantiated
*/
public static TemplateContextType createContextType(String id) {
Assert.isNotNull(id);
IConfigurationElement[] extensions = getTemplateExtensions();
TemplateContextType type;
try {
type = createContextType(extensions, id);
if (type != null) {
TemplateVariableResolver[] resolvers = createResolvers(extensions, id);
for (int i = 0; i < resolvers.length; i++) type.addResolver(resolvers[i]);
}
} catch (CoreException e) {
JavaPlugin.log(e);
type = null;
}
return type;
}
use of org.eclipse.core.runtime.CoreException in project jop by jop-devel.
the class JOPBoardConfigurationTab method updateQuartusProjectLocationFromConfig.
/**
* @param configuration
*/
protected void updateQuartusProjectLocationFromConfig(ILaunchConfiguration configuration) {
String qproj = IJOPUIConstants.EMPTY_STRING;
try {
qproj = configuration.getAttribute(IJOPLaunchConfigurationConstants.ATTR_QUARTUS_PROJECT, IJOPUIConstants.EMPTY_STRING);
} catch (CoreException e) {
setErrorMessage(e.getStatus().getMessage());
}
fQuartusProjectLocation = new Path(qproj);
fQuartusProjectText.setText(fQuartusProjectLocation.toOSString());
}
use of org.eclipse.core.runtime.CoreException in project che by eclipse.
the class CUCorrectionProposal method apply.
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#apply(org.eclipse.jface.text.IDocument)
*/
@Override
public void apply(IDocument document) {
try {
ICompilationUnit unit = getCompilationUnit();
// IEditorPart part= null;
if (unit.getResource().exists()) {
boolean canEdit = performValidateEdit(unit);
if (!canEdit) {
return;
}
// part= EditorUtility.isOpenInEditor(unit);
// if (part == null) {
// part= JavaUI.openInEditor(unit);
// if (part != null) {
// fSwitchedEditor= true;
// document= JavaUI.getDocumentProvider().getDocument(part.getEditorInput());
// }
// }
// IWorkbenchPage page= JavaPlugin.getActivePage();
// if (page != null && part != null) {
// page.bringToTop(part);
// }
// if (part != null) {
// part.setFocus();
// }
}
performChange(/*part, */
document);
} catch (CoreException e) {
// ExceptionHandler.handle(e, CorrectionMessages.CUCorrectionProposal_error_title, CorrectionMessages.CUCorrectionProposal_error_message);
JavaPlugin.log(e);
}
}
use of org.eclipse.core.runtime.CoreException in project che by eclipse.
the class RenameSupport method perform.
// /**
// * Opens the refactoring dialog for this rename support.
// *
// * @param parent a shell used as a parent for the refactoring dialog.
// * @throws CoreException if an unexpected exception occurs while opening the
// * dialog.
// *
// * @see #openDialog(Shell, boolean)
// */
// public void openDialog(Shell parent) throws CoreException {
// openDialog(parent, false);
// }
//
// /**
// * Opens the refactoring dialog for this rename support.
// *
// * <p>
// * This method has to be called from within the UI thread.
// * </p>
// *
// * @param parent a shell used as a parent for the refactoring, preview, or error dialog
// * @param showPreviewOnly if <code>true</code>, the dialog skips all user input pages and
// * directly shows the preview or error page. Otherwise, shows all pages.
// * @return <code>true</code> if the refactoring has been executed successfully,
// * <code>false</code> if it has been canceled or if an error has happened during
// * initial conditions checking.
// *
// * @throws CoreException if an error occurred while executing the
// * operation.
// *
// * @see #openDialog(Shell)
// * @since 3.3
// */
// public boolean openDialog(Shell parent, boolean showPreviewOnly) throws CoreException {
// ensureChecked();
// if (fPreCheckStatus.hasFatalError()) {
// showInformation(parent, fPreCheckStatus);
// return false;
// }
//
// UserInterfaceStarter starter;
// if (!showPreviewOnly) {
// starter = RenameUserInterfaceManager.getDefault().getStarter(fRefactoring);
// } else {
// starter = new RenameUserInterfaceStarter();
// RenameRefactoringWizard wizard = new RenameRefactoringWizard(fRefactoring, fRefactoring.getName(), null, null, null) {
// @Override
// protected void addUserInputPages() {
// // nothing to add
// }
// };
// wizard.setForcePreviewReview(showPreviewOnly);
// starter.initialize(wizard);
// }
// return starter.activate(fRefactoring, parent, getJavaRenameProcessor().getSaveMode());
// }
//
/**
* Executes the rename refactoring without showing a dialog to gather
* additional user input (for example the new name of the <tt>IJavaElement</tt>).
* Only an error dialog is shown (if necessary) to present the result
* of the refactoring's full precondition checking.
* <p>
* The method has to be called from within the UI thread.
* </p>
*
*
* @throws InterruptedException if the operation has been canceled by the
* user.
* @throws InvocationTargetException if an error occurred while executing the
* operation.
*/
public RefactoringStatus perform() throws InterruptedException, InvocationTargetException {
try {
ensureChecked();
if (fPreCheckStatus.hasFatalError()) {
return fPreCheckStatus;
}
RefactoringExecutionHelper helper = new RefactoringExecutionHelper(fRefactoring, RefactoringCore.getConditionCheckingFailedSeverity(), getJavaRenameProcessor().getSaveMode());
RefactoringStatus status = helper.perform(true, true);
fPerformChangeOperation = helper.getfPerformChangeOperation();
return status;
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
Aggregations