本文整理匯總了Java中org.eclipse.jdt.ui.JavaUI.ID_PLUGIN屬性的典型用法代碼示例。如果您正苦於以下問題:Java JavaUI.ID_PLUGIN屬性的具體用法?Java JavaUI.ID_PLUGIN怎麽用?Java JavaUI.ID_PLUGIN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jdt.ui.JavaUI
的用法示例。
在下文中一共展示了JavaUI.ID_PLUGIN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: evaluateTemplate
/**
* Evaluates a 'java' template in the context of a compilation unit
*
* @param template the template to be evaluated
* @param compilationUnit the compilation unit in which to evaluate the template
* @param position the position inside the compilation unit for which to evaluate the template
* @return the evaluated template
* @throws CoreException in case the template is of an unknown context type
* @throws BadLocationException in case the position is invalid in the compilation unit
* @throws TemplateException in case the evaluation fails
*/
public static String evaluateTemplate(Template template, ICompilationUnit compilationUnit, int position) throws CoreException, BadLocationException, TemplateException {
TemplateContextType contextType= JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(template.getContextTypeId());
if (!(contextType instanceof CompilationUnitContextType))
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, JavaTemplateMessages.JavaContext_error_message, null));
IDocument document= new Document();
if (compilationUnit != null && compilationUnit.exists())
document.set(compilationUnit.getSource());
CompilationUnitContext context= ((CompilationUnitContextType) contextType).createContext(document, position, 0, compilationUnit);
context.setForceEvaluation(true);
TemplateBuffer buffer= context.evaluate(template);
if (buffer == null)
return null;
return buffer.getString();
}
示例2: updateContainerClasspath
private static void updateContainerClasspath(IJavaProject jproject, IPath containerPath, IClasspathEntry newEntry, String[] changedAttributes, IProgressMonitor monitor) throws CoreException {
IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
if (container == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, "Container " + containerPath + " cannot be resolved", null)); //$NON-NLS-1$//$NON-NLS-2$
}
IClasspathEntry[] entries= container.getClasspathEntries();
IClasspathEntry[] newEntries= new IClasspathEntry[entries.length];
for (int i= 0; i < entries.length; i++) {
IClasspathEntry curr= entries[i];
if (curr.getEntryKind() == newEntry.getEntryKind() && curr.getPath().equals(newEntry.getPath())) {
newEntries[i]= getUpdatedEntry(curr, newEntry, changedAttributes, jproject);
} else {
newEntries[i]= curr;
}
}
requestContainerUpdate(jproject, container, newEntries);
monitor.worked(1);
}
示例3: ClasspathContainerDescriptor
public ClasspathContainerDescriptor(IConfigurationElement configElement) throws CoreException {
super();
fConfigElement = configElement;
fPage= null;
String id = fConfigElement.getAttribute(ATT_ID);
String name = configElement.getAttribute(ATT_NAME);
String pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
if (name == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, 0, "Invalid extension (missing name): " + id, null)); //$NON-NLS-1$
}
if (pageClassName == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, 0, "Invalid extension (missing page class name): " + id, null)); //$NON-NLS-1$
}
}
示例4: updateStatus
@Override
public void updateStatus(IStatus status) {
int count= 0;
for (int i= 0; i < fPages.length; i++) {
count+= fPages[i].getSelectedCleanUpCount();
}
if (count == 0) {
super.updateStatus(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, getEmptySelectionMessage()));
} else {
if (status == null) {
super.updateStatus(StatusInfo.OK_STATUS);
} else {
super.updateStatus(status);
}
}
}
示例5: getCleanUps
private static ICleanUp[] getCleanUps(IProject project) throws CoreException {
ICleanUp[] cleanUps;
Map<String, String> settings= CleanUpPreferenceUtil.loadSaveParticipantOptions(new ProjectScope(project));
if (settings == null) {
IEclipsePreferences contextNode= InstanceScope.INSTANCE.getNode(JavaUI.ID_PLUGIN);
String id= contextNode.get(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE, null);
if (id == null) {
id= DefaultScope.INSTANCE.getNode(JavaUI.ID_PLUGIN).get(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE, CleanUpConstants.DEFAULT_SAVE_PARTICIPANT_PROFILE);
}
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, Messages.format(FixMessages.CleanUpPostSaveListener_unknown_profile_error_message, id)));
}
if (CleanUpOptions.TRUE.equals(settings.get(CleanUpConstants.CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS))) {
cleanUps= getCleanUps(settings, null);
} else {
HashMap<String, String> filteredSettins= new HashMap<String, String>();
filteredSettins.put(CleanUpConstants.FORMAT_SOURCE_CODE, settings.get(CleanUpConstants.FORMAT_SOURCE_CODE));
filteredSettins.put(CleanUpConstants.FORMAT_SOURCE_CODE_CHANGES_ONLY, settings.get(CleanUpConstants.FORMAT_SOURCE_CODE_CHANGES_ONLY));
filteredSettins.put(CleanUpConstants.ORGANIZE_IMPORTS, settings.get(CleanUpConstants.ORGANIZE_IMPORTS));
Set<String> ids= new HashSet<String>(2);
ids.add("org.eclipse.jdt.ui.cleanup.format"); //$NON-NLS-1$
ids.add("org.eclipse.jdt.ui.cleanup.imports"); //$NON-NLS-1$
cleanUps= getCleanUps(filteredSettins, ids);
}
return cleanUps;
}
示例6: createBackup
private File createBackup(IFileStore source, String name) throws CoreException {
try {
File bak= File.createTempFile("eclipse-" + name, ".bak"); //$NON-NLS-1$//$NON-NLS-2$
copyFile(source, bak);
return bak;
} catch (IOException e) {
IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, Messages.format(NewWizardMessages.NewJavaProjectWizardPageTwo_problem_backup, name), e);
throw new CoreException(status);
}
}
示例7: createPackageHtml
private void createPackageHtml(IPackageFragmentRoot root, IProgressMonitor monitor) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IFolder createdPackage= workspace.getRoot().getFolder(fCreatedPackageFragment.getPath());
IFile packageHtml= createdPackage.getFile(PACKAGE_HTML_FILENAME);
String charset= packageHtml.getCharset();
String content= buildPackageHtmlContent(root, charset);
try {
packageHtml.create(new ByteArrayInputStream(content.getBytes(charset)), false, monitor);
} catch (UnsupportedEncodingException e) {
String message= "charset " + charset + " not supported by platform"; //$NON-NLS-1$ //$NON-NLS-2$
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, message, e));
}
}
示例8: updateStatus
@Override
public void updateStatus(IStatus status) {
int count= 0;
for (int i= 0; i < fPages.length; i++) {
count+= fPages[i].getSelectedCleanUpCount();
}
if (count == 0) {
super.updateStatus(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, CleanUpMessages.CleanUpModifyDialog_SelectOne_Error));
} else {
super.updateStatus(status);
}
}
示例9: JavaElementLine
/**
* @param element either an ICompilationUnit or an IClassFile
* @param lineNumber the line number, starting at 0
* @param lineStartOffset the start offset of the line
* @throws CoreException thrown when accessing of the buffer failed
*/
public JavaElementLine(ITypeRoot element, int lineNumber, int lineStartOffset) throws CoreException {
fElement= element;
fFlags= 0;
IBuffer buffer= element.getBuffer();
if (buffer == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, Messages.format( SearchMessages.JavaElementLine_error_nobuffer, BasicElementLabels.getFileName(element))));
}
int length= buffer.getLength();
int i= lineStartOffset;
char ch= buffer.getChar(i);
while (lineStartOffset < length && IndentManipulation.isIndentChar(ch)) {
ch= buffer.getChar(++i);
}
fLineStartOffset= i;
StringBuffer buf= new StringBuffer();
while (i < length && !IndentManipulation.isLineDelimiterChar(ch)) {
if (Character.isISOControl(ch)) {
buf.append(' ');
} else {
buf.append(ch);
}
i++;
if (i < length)
ch= buffer.getChar(i);
}
fLineContents= buf.toString();
fLineNumber= lineNumber;
}
示例10: runOnMultiple
private void runOnMultiple(final ICompilationUnit[] cus) {
ICleanUp[] cleanUps= getCleanUps(cus);
if (cleanUps == null)
return;
MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.OK, ActionMessages.CleanUpAction_MultiStateErrorTitle, null);
for (int i= 0; i < cus.length; i++) {
ICompilationUnit cu= cus[i];
if (!ActionUtil.isOnBuildPath(cu)) {
String cuLocation= BasicElementLabels.getPathLabel(cu.getPath(), false);
String message= Messages.format(ActionMessages.CleanUpAction_CUNotOnBuildpathMessage, cuLocation);
status.add(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, IStatus.ERROR, message, null));
}
}
if (!status.isOK()) {
ErrorDialog.openError(getShell(), getActionName(), null, status);
return;
}
try {
performRefactoring(cus, cleanUps);
} catch (InvocationTargetException e) {
JavaPlugin.log(e);
if (e.getCause() instanceof CoreException)
showUnexpectedError((CoreException)e.getCause());
}
}
示例11: hasSource
/**
* Checks whether the given Java element has accessible source.
*
* @param je the Java element to test
* @return <code>true</code> if the element has source
* @since 3.2
*/
private static boolean hasSource(ITypeRoot je) {
if (je == null || !je.exists())
return false;
try {
return je.getBuffer() != null;
} catch (JavaModelException ex) {
IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.OK, "Error in JDT Core during AST creation", ex); //$NON-NLS-1$
JavaPlugin.getDefault().getLog().log(status);
}
return false;
}
示例12: Descriptor
public Descriptor(IConfigurationElement configElement) throws CoreException {
fConfigElement = configElement;
fInstance= null;
String name = configElement.getAttribute(ATT_NAME);
String pageClassName = configElement.getAttribute(ATT_CLASS);
if (name == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, 0, "Invalid extension (missing attributeName)", null)); //$NON-NLS-1$
}
if (pageClassName == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, 0, "Invalid extension (missing class name): " + name, null)); //$NON-NLS-1$
}
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:14,代碼來源:ClasspathAttributeConfigurationDescriptors.java
示例13: JavaElementLine
/**
* @param element either an ICompilationUnit or an IClassFile
* @param lineNumber the line number
* @param lineStartOffset the start offset of the line
* @throws CoreException thrown when accessing of the buffer failed
*/
public JavaElementLine(ITypeRoot element, int lineNumber, int lineStartOffset) throws CoreException {
fElement= element;
fFlags= 0;
IBuffer buffer= element.getBuffer();
if (buffer == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, Messages.format( SearchMessages.JavaElementLine_error_nobuffer, BasicElementLabels.getFileName(element))));
}
int length= buffer.getLength();
int i= lineStartOffset;
char ch= buffer.getChar(i);
while (lineStartOffset < length && IndentManipulation.isIndentChar(ch)) {
ch= buffer.getChar(++i);
}
fLineStartOffset= i;
StringBuffer buf= new StringBuffer();
while (i < length && !IndentManipulation.isLineDelimiterChar(ch)) {
if (Character.isISOControl(ch)) {
buf.append(' ');
} else {
buf.append(ch);
}
i++;
if (i < length)
ch= buffer.getChar(i);
}
fLineContents= buf.toString();
fLineNumber= lineNumber;
}
示例14: wrapBadPositionCategoryException
private CoreException wrapBadPositionCategoryException(BadPositionCategoryException e) {
String message= e.getMessage();
if (message == null)
message= "BadPositionCategoryException"; //$NON-NLS-1$
return new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, 0, message, e));
}
示例15: createAddUnimplementedMethodsFix
public static IProposableFix createAddUnimplementedMethodsFix(final CompilationUnit root, IProblemLocation problem) {
ASTNode typeNode= getSelectedTypeNode(root, problem);
if (typeNode == null)
return null;
if (isTypeBindingNull(typeNode))
return null;
AddUnimplementedMethodsOperation operation= new AddUnimplementedMethodsOperation(typeNode);
if (operation.getMethodsToImplement().length > 0) {
return new UnimplementedCodeFix(CorrectionMessages.UnimplementedMethodsCorrectionProposal_description, root, new CompilationUnitRewriteOperation[] { operation });
} else {
return new IProposableFix() {
public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
CompilationUnitChange change= new CompilationUnitChange(CorrectionMessages.UnimplementedMethodsCorrectionProposal_description, (ICompilationUnit) root.getJavaElement()) {
@Override
public Change perform(IProgressMonitor pm) throws CoreException {
Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
String dialogTitle= CorrectionMessages.UnimplementedMethodsCorrectionProposal_description;
IStatus status= getStatus();
ErrorDialog.openError(shell, dialogTitle, CorrectionMessages.UnimplementedCodeFix_DependenciesErrorMessage, status);
return new NullChange();
}
};
change.setEdit(new MultiTextEdit());
return change;
}
public String getAdditionalProposalInfo() {
return new String();
}
public String getDisplayString() {
return CorrectionMessages.UnimplementedMethodsCorrectionProposal_description;
}
public IStatus getStatus() {
return new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, CorrectionMessages.UnimplementedCodeFix_DependenciesStatusMessage);
}
};
}
}