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


Java IJavaElementSearchConstants类代码示例

本文整理汇总了Java中org.eclipse.jdt.ui.IJavaElementSearchConstants的典型用法代码示例。如果您正苦于以下问题:Java IJavaElementSearchConstants类的具体用法?Java IJavaElementSearchConstants怎么用?Java IJavaElementSearchConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IJavaElementSearchConstants类属于org.eclipse.jdt.ui包,在下文中一共展示了IJavaElementSearchConstants类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doBrowseTypes

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的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.IJavaElementSearchConstants; //导入依赖的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.IJavaElementSearchConstants; //导入依赖的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.IJavaElementSearchConstants; //导入依赖的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.IJavaElementSearchConstants; //导入依赖的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.IJavaElementSearchConstants; //导入依赖的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: searchMainMethods

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的package包/类
/**
 * Searches for all main methods in the given scope.
 * Valid styles are IJavaElementSearchConstants.CONSIDER_BINARIES and
 * IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS
 * @param context runnable context
 * @param scope the search scope
 * @param style style search style constants (see {@link IJavaElementSearchConstants})
 * @return the types found
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
public IType[] searchMainMethods(IRunnableContext context, final IJavaSearchScope scope, final int style) throws InvocationTargetException, InterruptedException  {
	int allFlags=  IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS | IJavaElementSearchConstants.CONSIDER_BINARIES;
	Assert.isTrue((style | allFlags) == allFlags);

	final IType[][] res= new IType[1][];

	IRunnableWithProgress runnable= new IRunnableWithProgress() {
		public void run(IProgressMonitor pm) throws InvocationTargetException {
			try {
				res[0]= searchMainMethods(pm, scope, style);
			} catch (CoreException e) {
				throw new InvocationTargetException(e);
			}
		}
	};
	context.run(true, true, runnable);

	return res[0];
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:MainMethodSearchEngine.java

示例8: createRow

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的package包/类
private void createRow(final Composite parent, Composite panel,
    final Text text) {
  text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Button button = new Button(panel, SWT.BORDER);
  button.setText("Browse...");
  button.addListener(SWT.Selection, new Listener() {
    public void handleEvent(Event arg0) {
      try {
        AST ast = AST.newAST(3);

        SelectionDialog dialog = JavaUI.createTypeDialog(parent.getShell(),
            new ProgressMonitorDialog(parent.getShell()), SearchEngine
                .createWorkspaceScope(),
            IJavaElementSearchConstants.CONSIDER_CLASSES, false);
        dialog.setMessage("Select Mapper type (implementing )");
        dialog.setBlockOnOpen(true);
        dialog.setTitle("Select Mapper Type");
        dialog.open();

        if ((dialog.getReturnCode() == Window.OK)
            && (dialog.getResult().length > 0)) {
          IType type = (IType) dialog.getResult()[0];
          text.setText(type.getFullyQualifiedName());
          setDirty(true);
        }
      } catch (JavaModelException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  });
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:33,代码来源:LocalMapReduceLaunchTabGroup.java

示例9: handleSelectSuperClass

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的package包/类
private void handleSelectSuperClass() {
       Shell parent = getShell();
       SelectionDialog dialog;
	try {
		if (project != null) {
			dialog = JavaUI.createTypeDialog(
			    parent, new ProgressMonitorDialog(parent),
			    project,
			    IJavaElementSearchConstants.CONSIDER_CLASSES, SINGLE_SELECTION);
		} else {
			dialog = JavaUI.createTypeDialog(
			    parent, new ProgressMonitorDialog(parent),
			    SearchEngine.createWorkspaceScope(),
			    IJavaElementSearchConstants.CONSIDER_CLASSES, SINGLE_SELECTION);
		}
	} catch (JavaModelException e) {
		return;
	}
       
       dialog.setTitle("Select superclass");
       dialog.setMessage("Fixture superclass");
       if (dialog.open() == IDialogConstants.CANCEL_ID)
           return;

       Object[] types = dialog.getResult();
       if (types == null || types.length == 0)
           return;
       
       IType superClass = (IType) types[0];
       superClassText.setText(superClass.getFullyQualifiedName());
}
 
开发者ID:sunix,项目名称:org.concordion.ide.eclipse,代码行数:32,代码来源:NewSpecWizardPage.java

示例10: createBrowseClassControl

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的package包/类
private Text createBrowseClassControl(final Composite composite,
    final String string, String browseButtonLabel,
    final String baseClassName, final String dialogTitle) {
  Label label = new Label(composite, SWT.NONE);
  GridData data = new GridData(GridData.FILL_HORIZONTAL);
  label.setText(string);
  label.setLayoutData(data);

  final Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
  GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
  data2.horizontalSpan = 2;
  text.setLayoutData(data2);

  Button browse = new Button(composite, SWT.NONE);
  browse.setText(browseButtonLabel);
  GridData data3 = new GridData(GridData.FILL_HORIZONTAL);
  browse.setLayoutData(data3);
  browse.addListener(SWT.Selection, new Listener() {
    public void handleEvent(Event event) {
      IType baseType;
      try {
        baseType = getPackageFragmentRoot().getJavaProject().findType(
            baseClassName);

        // edit this to limit the scope
        SelectionDialog dialog = JavaUI.createTypeDialog(
            composite.getShell(), new ProgressMonitorDialog(composite
                .getShell()), SearchEngine.createHierarchyScope(baseType),
            IJavaElementSearchConstants.CONSIDER_CLASSES, false);

        dialog.setMessage("&Choose a type:");
        dialog.setBlockOnOpen(true);
        dialog.setTitle(dialogTitle);
        dialog.open();

        if ((dialog.getReturnCode() == Window.OK)
            && (dialog.getResult().length > 0)) {
          IType type = (IType) dialog.getResult()[0];
          text.setText(type.getFullyQualifiedName());
        }
      } catch (JavaModelException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  });

  if (!showContainerSelector) {
    label.setEnabled(false);
    text.setEnabled(false);
    browse.setEnabled(false);
  }

  return text;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:56,代码来源:NewDriverWizardPage.java

示例11: getJavaClassDialog

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的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

示例12: considerExternalJars

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的package包/类
private boolean considerExternalJars() {
	return (fStyle & IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS) != 0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:MainMethodSearchEngine.java

示例13: considerBinaries

import org.eclipse.jdt.ui.IJavaElementSearchConstants; //导入依赖的package包/类
private boolean considerBinaries() {
	return (fStyle & IJavaElementSearchConstants.CONSIDER_BINARIES) != 0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:MainMethodSearchEngine.java


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