Package org.eclipse.jdt.ui.wizards

Examples of org.eclipse.jdt.ui.wizards.NewEnumWizardPage


      // TODO [bm] pretty dirty hack to workaround 16: Refactoring should not use UI components for code changes
      //       http://code.google.com/p/constants-to-enum-eclipse-plugin/issues/detail?id=16
      final NewEnumWizardPage[] result = new NewEnumWizardPage[1];
      Display.getDefault().syncExec(new Runnable() {
        public void run() {
          result[0]= new NewEnumWizardPage();
        }
      });
      NewEnumWizardPage page = result[0];
      page.setTypeName((String) this.simpleTypeNames.get(col), false);

      final IPackageFragmentRoot root = this.getPackageFragmentRoot();
      page.setPackageFragmentRoot(root, false);

      final IPackageFragment pack = this.getPackageFragment(
          (String) this.packageNames.get(col), monitor);
      page.setPackageFragment(pack, false);

      /*******************************************************************
       * * TODO: This is somewhat of a dirty workaround. Basically, I am
       * creating a new Enum type only to replace the root AST node. If
       * you have any better ideas please let me know!
       ******************************************************************/
      /*******************************************************************
       * TODO: Need a way of inserting this new type such that it appears
       * in the text changes for rollback purposes, etc.
       ******************************************************************/
      try {
        page.createType(monitor);
      } catch (final InterruptedException E) {
        status.addFatalError(E.getMessage());
      }

      // Modify the newly created enum type.
      final IType newEnumType = page.getCreatedType();
      final CompilationUnit node = (CompilationUnit) Util.getASTNode(
          newEnumType, monitor);

      final ASTRewrite astRewrite = ASTRewrite.create(node.getAST());
      final ImportRewrite importRewrite = ImportRewrite
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.ui.wizards.NewEnumWizardPage

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.