Package org.eclipse.jdt.internal.ui.dialogs

Examples of org.eclipse.jdt.internal.ui.dialogs.PackageSelectionDialog


          scope.add((JavaProject)project, JavaSearchScope.SOURCES, new HashSet<Integer>(2, 1));
        } catch(Exception ex){
          ClickPlugin.log(ex);
        }

        PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, style, scope);
        dialog.setMultipleSelection(false);
        if(dialog.open()==PackageSelectionDialog.OK){
          Object[] result = dialog.getResult();
          if(result.length >= 1){
            IPackageFragment fragment = (IPackageFragment)result[0];
            packageName.setText(fragment.getElementName());
          }
        }
      }
    });

    ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.classname"));
    Composite classField = FieldAssistUtils.createNullDecoratedPanel(classGroup, false);
    className = new Text(classField, SWT.BORDER);
    classField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    className.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if(initClassName!=null){
      className.setText(initClassName);
    }
    className.addModifyListener(new ModifyListener(){
      public void modifyText(ModifyEvent e){
        validate();
      }
    });

    ClickUtils.createLabel(classGroup, "");

    ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.superclass"));
    ContentAssistField superClassField = new ContentAssistField(classGroup, SWT.BORDER,
        new TextControlCreator(), new TextContentAdapter(), typeAssistProvider,
        ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0]);
    superClass = (Text)superClassField.getControl();
    superClassField.getLayoutControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    superClass.setText(settings.get(NewClickPageWizard.SUPERCLASS));
    superClass.addModifyListener(new ModifyListener(){
      public void modifyText(ModifyEvent e){
        validate();
      }
    });
    browseSuperClass = new Button(classGroup, SWT.PUSH);
    browseSuperClass.setText(ClickPlugin.getString("action.browse"));
    browseSuperClass.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(SelectionEvent evt){
        Shell shell = getShell();
        try {
          IJavaProject project = JavaCore.create(getProject());

          SelectionDialog dialog = JavaUI.createTypeDialog(
              shell, new ProgressMonitorDialog(shell),
              SearchEngine.createJavaSearchScope(new IJavaElement[]{project}),
              IJavaElementSearchConstants.CONSIDER_CLASSES,false);

          if(dialog.open()==SelectionDialog.OK){
            Object[] result = dialog.getResult();
            superClass.setText(((IType)result[0]).getFullyQualifiedName());
          }
        } catch(Exception ex){
          ClickPlugin.log(ex);
        }
View Full Code Here


          scope.add((JavaProject)project, JavaSearchScope.SOURCES, new HashSet(2, 1));
        } catch(Exception ex){
          ClickPlugin.log(ex);
        }
       
        PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, style, scope);
        dialog.setMultipleSelection(false);
        if(dialog.open()==PackageSelectionDialog.OK){
          Object[] result = dialog.getResult();
          if(result.length >= 1){
            IPackageFragment fragment = (IPackageFragment)result[0];
            packageName.setText(fragment.getElementName());
          }
        }
      }
    });
   
    ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.classname"));
    Composite classField = FieldAssistUtils.createNullDecoratedPanel(classGroup, false);
    className = new Text(classField, SWT.BORDER);
    classField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    className.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if(initClassName!=null){
      className.setText(initClassName);
    }
    className.addModifyListener(new ModifyListener(){
      public void modifyText(ModifyEvent e){
        validate();
      }
    });
   
    ClickUtils.createLabel(classGroup, "");
   
    ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.superclass"));
    ContentAssistField superClassField = new ContentAssistField(classGroup, SWT.BORDER,
        new TextControlCreator(), new TextContentAdapter(), typeAssistProvider,
        ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0]);
    superClass = (Text)superClassField.getControl();
    superClassField.getLayoutControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    superClass.setText(settings.get(NewClickPageWizard.SUPERCLASS));
    superClass.addModifyListener(new ModifyListener(){
      public void modifyText(ModifyEvent e){
        validate();
      }
    });
    browseSuperClass = new Button(classGroup, SWT.PUSH);
    browseSuperClass.setText(ClickPlugin.getString("action.browse"));
    browseSuperClass.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(SelectionEvent evt){
        Shell shell = getShell();
        try {
          IJavaProject project = JavaCore.create(getProject());
         
          SelectionDialog dialog = JavaUI.createTypeDialog(
              shell, new ProgressMonitorDialog(shell),
              SearchEngine.createJavaSearchScope(new IJavaElement[]{project}),
              IJavaElementSearchConstants.CONSIDER_CLASSES,false);
         
          if(dialog.open()==SelectionDialog.OK){
            Object[] result = dialog.getResult();
            superClass.setText(((IType)result[0]).getFullyQualifiedName());
          }
        } catch(Exception ex){
          ClickPlugin.log(ex);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.ui.dialogs.PackageSelectionDialog

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.