use of org.eclipse.core.runtime.CoreException in project flux by eclipse.
the class ASTRewriteCorrectionProposal method addEdits.
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal#addEdits(org.eclipse.jface.text.IDocument)
*/
@Override
protected void addEdits(IDocument document, TextEdit editRoot) throws CoreException {
super.addEdits(document, editRoot);
ASTRewrite rewrite = getRewrite();
if (rewrite != null) {
try {
TextEdit edit = rewrite.rewriteAST();
editRoot.addChild(edit);
} catch (IllegalArgumentException e) {
throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, e));
}
}
if (fImportRewrite != null) {
editRoot.addChild(fImportRewrite.rewriteImports(new NullProgressMonitor()));
}
}
use of org.eclipse.core.runtime.CoreException in project flux by eclipse.
the class CUCorrectionProposal method getAdditionalProposalInfo.
@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
StringBuffer buf = new StringBuffer();
try {
TextChange change = getTextChange();
change.setKeepPreviewEdits(true);
IDocument previewDocument = change.getPreviewDocument(monitor);
TextEdit rootEdit = change.getPreviewEdit(change.getEdit());
EditAnnotator ea = new EditAnnotator(buf, previewDocument);
rootEdit.accept(ea);
// Final pre-existing region
ea.unchangedUntil(previewDocument.getLength());
} catch (CoreException e) {
JavaPlugin.log(e);
}
return buf.toString();
}
use of org.eclipse.core.runtime.CoreException in project flux by eclipse.
the class ChangeCorrectionProposal method getAdditionalProposalInfo.
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension5#getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor)
*/
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
StringBuffer buf = new StringBuffer();
//$NON-NLS-1$
buf.append("<p>");
try {
Change change = getChange();
if (change != null) {
String name = change.getName();
if (name.length() == 0) {
return null;
}
buf.append(name);
} else {
return null;
}
} catch (CoreException e) {
//$NON-NLS-1$
buf.append("Unexpected error when accessing this proposal:<p><pre>");
buf.append(e.getLocalizedMessage());
//$NON-NLS-1$
buf.append("</pre>");
}
//$NON-NLS-1$
buf.append("</p>");
return buf.toString();
}
use of org.eclipse.core.runtime.CoreException in project flux by eclipse.
the class ContributionContextTypeRegistry method createContextType.
private static TemplateContextType createContextType(IConfigurationElement element) throws CoreException {
String id = element.getAttribute(ID);
try {
TemplateContextType contextType = (TemplateContextType) element.createExecutableExtension(CLASS);
String name = element.getAttribute(NAME);
if (name == null)
name = id;
if (contextType.getId() == null)
contextType.setId(id);
if (contextType.getName() == null)
contextType.setName(name);
return contextType;
} catch (ClassCastException e) {
//$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, "extension does not implement " + TemplateContextType.class.getName(), e));
}
}
use of org.eclipse.core.runtime.CoreException in project flux by eclipse.
the class InitializeServiceEnvironment method initializeProject.
private void initializeProject(String projectName) {
try {
// already connected project
if (repository.isConnected(projectName))
return;
// project doesn't exist in workspace
DownloadProject downloadProject = new DownloadProject(messagingConnector, projectName, repository.getUsername());
downloadProject.run(new CompletionCallback() {
@Override
public void downloadFailed() {
}
@Override
public void downloadComplete(IProject downloadedProject) {
try {
downloadedProject.build(IncrementalProjectBuilder.FULL_BUILD, null);
} catch (CoreException e) {
e.printStackTrace();
}
repository.addProject(downloadedProject);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations