本文整理汇总了Java中org.eclipse.jdt.ui.JavaUI类的典型用法代码示例。如果您正苦于以下问题:Java JavaUI类的具体用法?Java JavaUI怎么用?Java JavaUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaUI类属于org.eclipse.jdt.ui包,在下文中一共展示了JavaUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInitialLayout
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
@SuppressWarnings ( "deprecation" )
@Override
public void createInitialLayout ( final IPageLayout factory )
{
final IFolderLayout topLeft = factory.createFolder ( "topLeft", IPageLayout.LEFT, 0.25f, factory.getEditorArea () );
topLeft.addPlaceholder ( IPageLayout.ID_RES_NAV );
topLeft.addView ( JavaUI.ID_PACKAGES );
topLeft.addPlaceholder ( JavaUI.ID_TYPE_HIERARCHY );
topLeft.addView ( "org.eclipse.scada.core.ui.connection.ConnectionView" ); //$NON-NLS-1$
final IFolderLayout bottom = factory.createFolder ( "bottomRight", IPageLayout.BOTTOM, 0.75f, factory.getEditorArea () );
bottom.addView ( "org.eclipse.pde.runtime.LogView" ); //$NON-NLS-1$
bottom.addView ( IPageLayout.ID_TASK_LIST );
bottom.addView ( IPageLayout.ID_PROBLEM_VIEW );
factory.addView ( IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.75f, factory.getEditorArea () );
factory.addNewWizardShortcut ( "org.eclipse.pde.ui.NewProjectWizard" ); //$NON-NLS-1$
factory.addNewWizardShortcut ( "org.eclipse.pde.ui.NewFeatureProjectWizard" ); //$NON-NLS-1$
}
示例2: launch
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
@Override
public void launch(IEditorPart editor, String mode) {
ITypeRoot element= JavaUI.getEditorInputTypeRoot(editor.getEditorInput());
if (element != null) {
launch(new Object[] { element }, mode);
}
}
示例3: openInbuiltOperationClass
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
private void openInbuiltOperationClass(String operationName, PropertyDialogButtonBar propertyDialogButtonBar) {
String operationClassName = null;
Operations operations = XMLConfigUtil.INSTANCE.getComponent(FilterOperationClassUtility.INSTANCE.getComponentName())
.getOperations();
List<TypeInfo> typeInfos = operations.getStdOperation();
for (int i = 0; i < typeInfos.size(); i++) {
if (typeInfos.get(i).getName().equalsIgnoreCase(operationName)) {
operationClassName = typeInfos.get(i).getClazz();
break;
}
}
propertyDialogButtonBar.enableApplyButton(true);
javaProject = FilterOperationClassUtility.getIJavaProject();
if (javaProject != null) {
try {
IType findType = javaProject.findType(operationClassName);
JavaUI.openInEditor(findType);
} catch (JavaModelException | PartInitException e) {
Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,Messages.CLASS_NOT_EXIST,null);
StatusManager.getManager().handle(status, StatusManager.BLOCK);
logger.error(e.getMessage(), e);
}
} else {
WidgetUtility.errorMessage(Messages.SAVE_JOB_MESSAGE);
}
}
示例4: getDeclarationImage
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
/**
* Obtient une image pour une déclaration KSP.
*
* @param kspDeclaration Déclaration KSP.
* @return Image.
*/
public static Image getDeclarationImage(KspDeclaration kspDeclaration) { // NOSONAR
org.eclipse.ui.ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
org.eclipse.jdt.ui.ISharedImages sharedImagesJdt = JavaUI.getSharedImages();
switch (kspDeclaration.getNature()) {
case "DtDefinition": // Kasper >= 4
case "DT": // Kasper <= 3
return sharedImagesJdt.getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_CLASS);
case "Task": // Kasper >= 5
case "Service": // Kasper <= 4
return sharedImagesJdt.getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_PUBLIC);
case "Domain":
return sharedImagesJdt.getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_ANNOTATION);
case "FileInfo":
return sharedImages.getImage(org.eclipse.ui.ISharedImages.IMG_OBJ_FILE);
default:
/*
* Pas d'images spécifiques pour : Constraint, Formatter, Association, PublisherNode, Controller...
*/
return sharedImages.getImage(org.eclipse.ui.ISharedImages.IMG_OBJ_ELEMENT);
}
}
示例5: execute
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
final ICompilationUnit icu = JavaUI.getWorkingCopyManager().getWorkingCopy(editorPart.getEditorInput());
try {
final IType type = icu.getTypes()[0];
final List<Field> fields = new ArrayList<>();
for (final IField field : type.getFields()) {
final String fieldName = field.getElementName();
final String fieldType = Signature.getSignatureSimpleName(field.getTypeSignature());
fields.add(new Field(fieldName, fieldType));
}
new WizardDialog(HandlerUtil.getActiveShell(event), new BuilderGeneratorWizard(icu, fields)).open();
}
catch (final JavaModelException e) {
e.printStackTrace();
}
return null;
}
示例6: textEditor
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
private SWTBotEclipseEditor textEditor(String fullyQualifiedType) throws JavaModelException, PartInitException {
IType type = javaProject.findType(fullyQualifiedType);
IEditorPart editorPart = UIThreadRunnable.syncExec(new Result<IEditorPart>() {
public IEditorPart run() {
try {
return JavaUI.openInEditor(type, true, true);
} catch (PartInitException | JavaModelException e) {
throw new RuntimeException(e);
}
}
});
// IEditorPart editorPart = JavaUI.openInEditor(type, true, true);
SWTBotEditor editor = bot.editorById(editorPart.getEditorSite().getId());
return editor.toTextEditor();
}
示例7: run
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
@Override
public void run() {
ITypeBinding typeBinding = Crystal.getInstance().getTypeBindingFromName(fullyQualifiedName);
if(typeBinding!=null){
//get all types & names of fields & methods & class/interface
IJavaElement javaElement = typeBinding.getJavaElement();
if (javaElement != null && ASTUtils.isFromSource(typeBinding)) {
try {
// EditorUtility.openInEditor(javaElement, true);
/*
* code above causes a bug that if several classes are in
* the same java file, always open the first one no matter
* which one the user chooses
*/
JavaUI.openInEditor(javaElement);
// IEditorPart javaEditor = JavaUI.openInEditor(javaElement);
// JavaUI.revealInEditor(javaEditor, javaElement);
} catch (Exception e) {
e.printStackTrace();
}
}
}
super.run();
}
示例8: addViews
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
/**
* add Views
*/
private void addViews() {
// left
IFolderLayout left = fLayout.createFolder(UICoreConstant.PROJECT_CONSTANTS__LEFT,
IPageLayout.LEFT,
0.20f,
fLayout.getEditorArea());
left.addView(UICoreConstant.PROJECT_CONSTANTS__PROJECT_EXPLORER_ID);
left.addView(JavaUI.ID_PACKAGES);
// bottom
IFolderLayout bottom = fLayout.createFolder(UICoreConstant.PROJECT_CONSTANTS__BOTTOM,
IPageLayout.BOTTOM,
0.72f,
fLayout.getEditorArea());
bottom.addView(IPageLayout.ID_PROP_SHEET);
bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
// right
IFolderLayout right = fLayout.createFolder(UICoreConstant.PROJECT_CONSTANTS__RIGHT,
IPageLayout.RIGHT,
0.80f,
fLayout.getEditorArea());
right.addView(IPageLayout.ID_OUTLINE);
}
示例9: getSelectedMethod
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
public static IMethod getSelectedMethod() throws JavaModelException {
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
ITextEditor editor = (ITextEditor) page.getActiveEditor();
IJavaElement elem = JavaUI.getEditorInputJavaElement(editor
.getEditorInput());
if (elem instanceof ICompilationUnit) {
ITextSelection sel = (ITextSelection) editor.getSelectionProvider()
.getSelection();
IJavaElement selected = ((ICompilationUnit) elem).getElementAt(sel
.getOffset());
if (selected != null
&& selected.getElementType() == IJavaElement.METHOD) {
return (IMethod) selected;
}
}
return null;
}
示例10: handleManifestmainclassBrowse
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
/**
* Uses the standard container selection dialog to
* choose the new value for the container field.
*/
private void handleManifestmainclassBrowse() {
String mainClass = getManifestmainclass();
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IResource[] res=jproject.getResource();
IJavaSearchScope searchScope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(res, true);
SelectionDialog dialog = JavaUI.createMainTypeDialog(getShell(), getContainer(), searchScope, 0, false);
dialog.setMessage("Select Main-Class for JAR file");
dialog.setTitle("Fat Jar Config");
if (dialog.open() == SelectionDialog.OK) {
Object[] elements= dialog.getResult();
if (elements.length == 1) {
SourceType mainElement = (SourceType)elements[0];
mainClass = mainElement.getFullyQualifiedName();
manifestmainclassText.setText(mainClass);
}
}
}
示例11: run
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
@Override
public void run(IMarker marker) {
try {
IEditorPart part = EditorUtility.isOpenInEditor(cu);
if (part == null) {
part = JavaUI.openInEditor(cu, true, false);
if (part instanceof ITextEditor) {
((ITextEditor) part).selectAndReveal(offset, length);
}
}
if (part != null) {
IEditorInput input = part.getEditorInput();
IDocument doc = JavaPlugin.getDefault().getCompilationUnitDocumentProvider().getDocument(
input);
proposal.apply(doc);
}
} catch (CoreException e) {
CorePluginLog.logError(e);
}
}
示例12: evaluateTemplate
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
/**
* 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();
}
示例13: loadSaveParticipantOptions
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) {
IEclipsePreferences node;
if (hasSettingsInScope(context)) {
node= context.getNode(JavaUI.ID_PLUGIN);
} else {
IScopeContext instanceScope= InstanceScope.INSTANCE;
if (hasSettingsInScope(instanceScope)) {
node= instanceScope.getNode(JavaUI.ID_PLUGIN);
} else {
return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
}
}
Map<String, String> result= new HashMap<String, String>();
Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys();
for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) {
String key= iterator.next();
result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE));
}
return result;
}
示例14: getRunnable
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
private static IRunnableWithProgress getRunnable(final Shell shell, final IJavaElement elem, final URL javadocLocation, final IClasspathEntry entry, final IPath containerPath) {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
IJavaProject project= elem.getJavaProject();
if (elem instanceof IPackageFragmentRoot) {
CPListElement cpElem= CPListElement.createFromExisting(entry, project);
String loc= javadocLocation != null ? javadocLocation.toExternalForm() : null;
cpElem.setAttribute(CPListElement.JAVADOC, loc);
IClasspathEntry newEntry= cpElem.getClasspathEntry();
String[] changedAttributes= { CPListElement.JAVADOC };
BuildPathSupport.modifyClasspathEntry(shell, newEntry, changedAttributes, project, containerPath, entry.getReferencingEntry() != null, monitor);
} else {
JavaUI.setProjectJavadocLocation(project, javadocLocation);
}
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:JavadocConfigurationPropertyPage.java
示例15: updateContainerClasspath
import org.eclipse.jdt.ui.JavaUI; //导入依赖的package包/类
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);
}