Package org.eclipse.jdt.internal.ui.wizards

Examples of org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard


    return null;
  }

  public void run(IMarker marker) {
    NewClassCreationWizard wizard = new NewClassCreationWizard();
    wizard.init(JavaPlugin.getDefault().getWorkbench(), null);
    Shell shell = JavaPlugin.getActiveWorkbenchShell();
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.create();
    dialog.getShell().setText("New");
    IWizardPage[] pages = wizard.getPages();
    NewTypeWizardPage page = (NewTypeWizardPage) pages[0];
    String markerMessage = marker.getAttribute(MESSAGE_ATTRIBUTE_KEY, "");

    IJavaProject javaProject = JdtUtils.getJavaProject(marker.getResource());

    IPackageFragmentRoot sourcePackageFragmentRoot = null;
    String packageName = extractPackageNameFromMessage(markerMessage);
    try {
      sourcePackageFragmentRoot = inferPackageFragmentRoot(javaProject, packageName);
      if (sourcePackageFragmentRoot != null) {
        page.setPackageFragmentRoot(sourcePackageFragmentRoot, true);
        IPackageFragment packageFragment = sourcePackageFragmentRoot.getPackageFragment(packageName);
        if (packageFragment != null) {
          page.setPackageFragment(packageFragment, true);
        }
      }
    }
    catch (CoreException e) {
      StatusHandler.log(e.getStatus());
    }

    page.setTypeName(extractClassNameFromMessage(markerMessage), true);

    if (dialog.open() == Window.OK) {
      IType createdType = (IType) wizard.getCreatedElement();
      String fullyQualifiedClassName = createdType.getFullyQualifiedName();
      updateXmlBeanClass(marker, fullyQualifiedClassName);
    }

  }
View Full Code Here


              }
            }

            page.setTypeName(className, false);

            NewClassCreationWizard wizard = new NewClassCreationWizard(page, true);
            IWorkbench workbench = PlatformUI.getWorkbench();
            wizard.init(workbench, null);

            Shell shell = workbench.getActiveWorkbenchWindow().getShell();
            WizardDialog dialog = new WizardDialog(shell, wizard);
            dialog.create();
            dialog.getShell().setText("New Class");
View Full Code Here

    if (enclosingType != null) {
      page.setEnclosingType(enclosingType, false);
      page.setEnclosingTypeSelection(true, false);
    }

    NewClassCreationWizard wizard = new NewClassCreationWizard(page, true);
    IWorkbench workbench = PlatformUI.getWorkbench();
    wizard.init(workbench, null);

    Shell shell = workbench.getActiveWorkbenchWindow().getShell();
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.create();
    dialog.getShell().setText("New Class");

    if (allowUserChanges) {
      dialog.setBlockOnOpen(true);
      if (dialog.open() != Window.OK) {
        return null;
      }
    }
    else {
      wizard.performFinish();
    }

    return wizard.getCreatedElement();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard

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.