當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaUI類代碼示例

本文整理匯總了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$
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:ScadaPerspectiveFactory.java

示例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);
	}  
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:8,代碼來源:GW4ELaunchShortcut.java

示例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);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:27,代碼來源:ELTOpenFileEditorListener.java

示例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);
	}
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:28,代碼來源:ImageUtils.java

示例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;
}
 
開發者ID:khabali,項目名稱:java-builders-generator,代碼行數:25,代碼來源:GenerateBuildersHandler.java

示例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();
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:20,代碼來源:JavaEditorBookmarkPropertiesProviderTest.java

示例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();
	}
 
開發者ID:aroog,項目名稱:code,代碼行數:25,代碼來源:OpenTypeAction.java

示例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);
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:28,代碼來源:UMLPerspectiveFactory.java

示例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;
}
 
開發者ID:junit-tools-team,項目名稱:junit-tools,代碼行數:20,代碼來源:JDTUtils.java

示例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);
        }
    }
}
 
開發者ID:thahn0720,項目名稱:agui_eclipse_plugin,代碼行數:28,代碼來源:ConfigPage.java

示例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);
  }
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:21,代碼來源:QuickFixCompletionProposalWrapper.java

示例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();
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:30,代碼來源:JavaContext.java

示例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;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:23,代碼來源:CleanUpPreferenceUtil.java

示例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);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:19,代碼來源:BuildPathSupport.java


注:本文中的org.eclipse.jdt.ui.JavaUI類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。