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


Java JavaUI.createTypeDialog方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.ui.JavaUI.createTypeDialog方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaUI.createTypeDialog方法的具體用法?Java JavaUI.createTypeDialog怎麽用?Java JavaUI.createTypeDialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.ui.JavaUI的用法示例。


在下文中一共展示了JavaUI.createTypeDialog方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doBrowseTypes

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
private void doBrowseTypes(StringButtonDialogField dialogField) {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, dialogField.getText());
		dialog.setTitle(PreferencesMessages.NullAnnotationsConfigurationDialog_browse_title);
		dialog.setMessage(PreferencesMessages.NullAnnotationsConfigurationDialog_choose_annotation);
		if (dialog.open() == Window.OK) {
			IType res= (IType) dialog.getResult()[0];
			dialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), PreferencesMessages.NullAnnotationsConfigurationDialog_error_title, PreferencesMessages.NullAnnotationsConfigurationDialog_error_message);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:17,代碼來源:ProblemSeveritiesConfigurationBlock.java

示例2: run

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
@Override
public void run() {
	Shell shell= JavaPlugin.getActiveWorkbenchShell();
	SelectionDialog dialog= null;
	try {
		dialog= JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell),
			SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false);
	} catch (JavaModelException e) {
		String title= getDialogTitle();
		String message= PackagesMessages.GotoType_error_message;
		ExceptionHandler.handle(e, title, message);
		return;
	}

	dialog.setTitle(getDialogTitle());
	dialog.setMessage(PackagesMessages.GotoType_dialog_message);
	if (dialog.open() == IDialogConstants.CANCEL_ID) {
		return;
	}

	Object[] types= dialog.getResult();
	if (types != null && types.length > 0) {
		gotoType((IType) types[0]);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:26,代碼來源:GotoTypeAction.java

示例3: doBrowseTypes

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
/**
 * Creates the type hierarchy for type selection.
 */
private void doBrowseTypes() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
		dialog.setTitle(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title);
		dialog.setMessage(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_description);
		if (dialog.open() == Window.OK) {
			IType res= (IType)dialog.getResult()[0];
			fNameDialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title,
				CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_error_message);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:21,代碼來源:ExpandWithConstructorsConfigurationBlock.java

示例4: browseForBuilderClass

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
private void browseForBuilderClass() {
	try {
		IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { getType().getJavaProject() });
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), scope,
				IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*ToString", fExtension); //$NON-NLS-1$
		dialog.setTitle(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_windowTitle);
		dialog.setMessage(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_message);
		dialog.open();
		if (dialog.getReturnCode() == OK) {
			IType type= (IType)dialog.getResult()[0];
			fBuilderClassName.setText(type.getFullyQualifiedParameterizedName());
			List<String> suggestions= fValidator.getAppendMethodSuggestions(type);
			if (!suggestions.contains(fAppendMethodName.getText()))
				fAppendMethodName.setText(suggestions.get(0));
			suggestions= fValidator.getResultMethodSuggestions(type);
			if (!suggestions.contains(fResultMethodName.getText()))
				fResultMethodName.setText(suggestions.get(0));
		}
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:23,代碼來源:GenerateToStringDialog.java

示例5: doBrowseTypes

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
private void doBrowseTypes() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
		dialog.setTitle(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title);
		dialog.setMessage(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_description);
		if (dialog.open() == Window.OK) {
			IType res= (IType) dialog.getResult()[0];
			fNameDialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title, PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_error_message);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:17,代碼來源:CodeAssistFavoritesConfigurationBlock.java

示例6: doBrowseTypes

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
private void doBrowseTypes() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
		dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title);
		dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_description);
		if (dialog.open() == Window.OK) {
			IType res= (IType) dialog.getResult()[0];
			fNameDialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title, PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_error_message);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:17,代碼來源:ImportOrganizeInputDialog.java

示例7: getJavaClassDialog

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
public static String getJavaClassDialog(Shell shell, List<Class<?>> classes) {
	try {
		IJavaSearchScope searchScope = SearchEngine.createWorkspaceScope();
		if (classes != null && !classes.isEmpty()) {
			IProject prj = ((IFileEditorInput) SelectionHelper.getActiveJRXMLEditor().getEditorInput()).getFile()
					.getProject();
			if (prj != null) {
				IJavaProject jprj = JavaCore.create(prj);
				IType t;

				t = jprj.findType(classes.get(0).getName());
				// ITypeHierarchy hierarchy = t.newTypeHierarchy(new
				// NullProgressMonitor());
				// IType[] subTypes = hierarchy.getAllSubtypes(t);
				if (t != null)
					searchScope = BasicSearchEngine.createHierarchyScope(t);// (jprj, t, owner, true, true, true);

			}
		}
		// FilteredTypesSelectionDialog a = new FilteredTypesSelectionDialog();
		// a.
		// JavaModelUtil.g
		// searchScope.enclosingProjectsAndJars()[0].
		//
		// SearchEngine.createHierarchyScope(IType.);
		// IType focus = ...;
		// IJavaProject project = ...;
		// ITypeHierarchy hierarchy = focus.newTypeHierarchy(project, pm);
		// IType[] subTypes = hierarchy.getAllSubTypes(focus);
		// IJavaSearchScope scope = SearchEngine.createJavaSearchScope(subTypes);
		// SearchPattern sp = SearchPattern.createPattern("java.lang.String", IJavaSearchConstants.CLASS,
		// IJavaSearchConstants.IMPLEMENTORS, SearchPattern.R_EXACT_MATCH);
		// FilteredTypesSelectionDialog a = new FilteredTypesSelectionDialog(shell, false, new
		// ProgressMonitorDialog(shell),
		// searchScope, SearchPattern.R_EXACT_MATCH);

		// ;
		// -------------
		// IProject project; // currently selected project
		//
		// // get the java project and locate the interface type
		// JavaProject javaProject = JavaCore.create(project);
		// IType myInterface = javaProject.findType("MyInterface", "name.seller.rich");
		//
		// // get the sub types from the interface's type hierarchy
		// ITypeHierarchy hierarchy = myInterface.newTypeHierarchy(new NullProgressMonitor());
		//
		// IType[] subTypes = hierarchy.getAllSubtypes(myInterface);

		SelectionDialog dialog = JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell), searchScope,
				IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES, false);
		dialog.setTitle(Messages.ClassTypeCellEditor_open_type);
		dialog.setMessage(Messages.ClassTypeCellEditor_dialog_message);
		if (dialog.open() == Window.OK) {
			if (dialog.getResult() != null && dialog.getResult().length > 0) {
				IType bt = (IType) dialog.getResult()[0];
				return bt.getFullyQualifiedName();
			}
		}
	} catch (JavaModelException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:66,代碼來源:ClassTypeCellEditor.java


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