Package org.pdtextensions.core.ui.wizards

Examples of org.pdtextensions.core.ui.wizards.NewClassWizard


public class CreateNewClassHandler extends AbstractWizardHandler {

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {

    openWizard(event, new NewClassWizard());
    return null;
  }
View Full Code Here


    {
        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
        ISelection selection = selectionService.getSelection();

        NewClassWizard wizard = new NewClassWizard();
        String serviceClass = "";
        String className = "";
        IScriptFolder folder = null;

        try {
            serviceClass = (String) marker.getAttribute(SymfonyMarker.SERVICE_CLASS);
        } catch (CoreException e) {
            Logger.logException(e);
        }
       
        if (serviceClass == null) {
          Logger.log(Logger.ERROR, "Could not retrieve service class to open class dialog");
          return;
        }

        ModelAccess composer = ModelAccess.getInstance();
        IResource resource = marker.getResource();
        className  = serviceClass.substring(serviceClass.lastIndexOf("\\"), serviceClass.length());
        String ns = serviceClass.replace(className, "");
    IPath folderPath = composer.reverseResolve(resource.getProject(), ns);
     
        if (folderPath == null) {
          MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error opening class wizard", "Could not open the New Class wizard. See the workspace log for details");
          Logger.log(Logger.ERROR, "Unable to retrieve target folder from composer information");
          return;
        }
       
        IFolder targetFolder = resource.getProject().getFolder(folderPath);
        if (targetFolder.exists() == false) {
          try {
        targetFolder.create(true, true, new NullProgressMonitor());
      } catch (CoreException e) {
        e.printStackTrace();
      }
        }
       
      folder = (IScriptFolder) DLTKCore.create(targetFolder);
       
        wizard.setClassName(className.replace("\\", ""));
        wizard.setNamespace(ns);
        wizard.setScriptFolder(folder);

        if (selection instanceof IStructuredSelection) {
            wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) selectionService.getSelection());
        }

        WizardDialog dialog = new WizardDialog(shell, wizard);
        dialog.create();
        dialog.open();
View Full Code Here

TOP

Related Classes of org.pdtextensions.core.ui.wizards.NewClassWizard

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.