Package org.eclipse.ui.dialogs

Examples of org.eclipse.ui.dialogs.SelectionDialog


        if (root == null) { return null; }

        IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() };
        IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);

        SelectionDialog dialog;
    try {
      dialog = JavaUI.createTypeDialog(
          getShell(),
          getWizard().getContainer(),
          scope,
          IJavaElementSearchConstants.CONSIDER_CLASSES,
          false,
          "**");
    } catch (JavaModelException e) {
      setErrorMessage(e.getMessage());
            return null;
    }
       
        //  TODO out    //BEFORE - delete
//        TypeSelectionDialog dialog = new TypeSelectionDialog(getShell(), getWizard().getContainer(), IJavaSearchConstants.TYPE,
//                scope);
        dialog.setTitle("Target Class Selection");
        dialog.setMessage("&Choose a type:");

        if (dialog.open() == Window.OK) { return (IType) dialog.getResult()[0]; }
        return null;
    }
View Full Code Here


     * @return the selected type or <code>null</code> if none.
     */
    protected IType chooseType(IType[] types, String mode, IRunnableContext context) {
     
      try {
      SelectionDialog dialog = JavaUI.createTypeDialog(
        getShell(),
        context,
        SearchEngine.createJavaSearchScope(types),
        IJavaElementSearchConstants.CONSIDER_CLASSES,
        false,
        "**");
     
       
          //MainTypeSelectionDialog dialog = new MainTypeSelectionDialog(getShell(), types); TODO not longer supported
          if (mode.equals(ILaunchManager.DEBUG_MODE)) {
              dialog.setTitle("Debug Type");
          } else {
              dialog.setTitle("Run Type");
          }
          //dialog.setMultipleSelection(false); TODO now part of the dialog constructor
          if (dialog.open() == Window.OK) { return (IType) dialog.getResult()[0]; //TODO out of range exception possible?
          return null;
      } catch(Exception e) {
        return null;
      }
    }
View Full Code Here

            setErrorMessage(e.getMessage());
            return;
        }

      
        SelectionDialog dialog;
    try {
      dialog = JavaUI.createTypeDialog(
          getShell(),
          getLaunchConfigurationDialog(),
          SearchEngine.createJavaSearchScope(types),
          IJavaElementSearchConstants.CONSIDER_CLASSES,
          false,
          "**");
    } catch (JavaModelException e) {
      setErrorMessage(e.getMessage());
            return;
    }
       
        dialog.setTitle("Choose Main Type");
        dialog.setMessage("Choose Main Type");
        if (dialog.open() == Window.CANCEL) { return; }

        Object[] results = dialog.getResult();
        if ((results == null) || (results.length < 1)) { return; }
        IType type = (IType) results[0];
        if (type != null) {
            fMainText.setText(type.getFullyQualifiedName());
            javaProject = type.getJavaProject();
View Full Code Here

        IJavaElement[] elements = new IJavaElement[] { root.getJavaProject()};
        IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
        // TODO Filter for subclasses of Throwable
       
        SelectionDialog dialog;
    try {
      dialog = JavaUI.createTypeDialog(
          getShell(),
          getWizard().getContainer(),
          scope,
          IJavaElementSearchConstants.CONSIDER_CLASSES,
          false,
          "**");
    } catch (JavaModelException e) {
      setErrorMessage(e.getMessage());
            return null;
    }

       // TODO old  //BEFORE - delete
       // TypeSelectionDialog dialog = new TypeSelectionDialog(getShell(), getWizard().getContainer(), IJavaSearchConstants.CLASS,
       //         scope);
        dialog.setTitle("Target Exception Selection");
        dialog.setMessage("&Choose an exception:");

        if (dialog.open() == Window.OK) {
            return (IType) dialog.getResult()[0];
        }
        return null;
    }
View Full Code Here

    }
  }

  private void handlePackageBrowse() {
    IJavaProject javaProject = JavaCore.create(project);
    SelectionDialog dialog;
    try {
      dialog = JavaUI.createPackageDialog(getShell(), javaProject, 0);
      if (dialog.open() == SelectionDialog.OK) {
        Object[] result = dialog.getResult();
        if (result.length == 1) {
          packageText.setText(((IPackageFragment) result[0]).getElementName());
        }
      }
    } catch (JavaModelException e) {
View Full Code Here

  protected final void handleChooseClassUnderTest() {
    try {
      List<IJavaProject> projectsList = Utils.getGWTProjects();
      IJavaProject[] projectsArray = projectsList.toArray(new IJavaProject[projectsList.size()]);
      IJavaSearchScope scope = SearchEngine.createJavaSearchScope(projectsArray);
      SelectionDialog dialog =
          JavaUI.createTypeDialog(
              getShell(),
              getWizard().getContainer(),
              scope,
              IJavaElementSearchConstants.CONSIDER_CLASSES,
              false);
      dialog.setTitle("Class Under Test");
      dialog.setMessage("Test stubs will be generated for class:");
      dialog.setInitialSelections(new Object[]{m_classUnderTestField.getText()});
      if (dialog.open() == Window.OK) {
        handleSelectClassUnderTest((IJavaElement) dialog.getResult()[0]);
      }
    } catch (Throwable e) {
      DesignerPlugin.log(e);
    }
  }
View Full Code Here

        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();
View Full Code Here

        if (designer != null)
          designer.setSelectedWidget(list);
      }else{
        Shell parent = expandBar.getShell();
        try {
          SelectionDialog typeDialog = JavaUI.createTypeDialog(parent, new ProgressMonitorDialog(parent), VisualSwingPlugin.getCurrentProject().getProject(), IJavaElementSearchConstants.CONSIDER_CLASSES, false);
          if(typeDialog.open()==Window.OK){
            Object[] result = typeDialog.getResult();
            if(result!=null&&result.length>0){
              IType type = (IType) result[0];
              String className = type.getElementName();
              IPackageFragment packageFragment = type.getPackageFragment();
              String pkg=packageFragment.getElementName();
View Full Code Here

    }
   
  }

    public IType selectType(Shell parent, String filter) throws JavaModelException {
        SelectionDialog dialog= JavaUI.createTypeDialog(
            parent, new ProgressMonitorDialog(parent),
            SearchEngine.createWorkspaceScope(),
            IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false,
            filter

       );
        dialog.setTitle("Choose Class");
        dialog.setMessage("");
        if (dialog.open() == IDialogConstants.CANCEL_ID)
            return null;

        Object[] types= dialog.getResult();
        if (types == null || types.length == 0)
            return null;
        return (IType)types[0];
    }
View Full Code Here

                        "named " + policyTypeElement.getName() +
                        ". Expected " + DeviceRepositorySchemaConstants.
                        POLICY_DEFINITION_TYPE_ELEMENT_NAME);
            }

            SelectionDialog dialog = null;

            Element unorderedSetElement = policyTypeElement.getChild(
                    DeviceRepositorySchemaConstants.
                    POLICY_DEFINITION_UNORDEREDSET_ELEMENT_NAME,
                    policyTypeElement.getNamespace());
View Full Code Here

TOP

Related Classes of org.eclipse.ui.dialogs.SelectionDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.