当前位置: 首页>>代码示例>>Java>>正文


Java JavaUI.ID_PLUGIN属性代码示例

本文整理汇总了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();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JavaContext.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:BuildPathSupport.java

示例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$
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:ClasspathContainerDescriptor.java

示例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);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:CleanUpSelectionDialog.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:CleanUpPostSaveListener.java

示例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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:NewJavaProjectWizardPageTwo.java

示例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));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:13,代码来源:NewPackageWizardPage.java

示例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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:12,代码来源:CleanUpModifyDialog.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:JavaElementLine.java

示例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());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:28,代码来源:CleanUpAction.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:ASTProvider.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:39,代码来源:JavaElementLine.java

示例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));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:CleanUpPostSaveListener.java

示例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);
			}
		};
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:43,代码来源:UnimplementedCodeFix.java


注:本文中的org.eclipse.jdt.ui.JavaUI.ID_PLUGIN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。