Java 类org.eclipse.ui.dialogs.WizardNewFileCreationPage 实例源码

项目:solidity-ide    文件:NewFileWizard.java   
@Override
public void addPages() {
    super.addPages();
    String fileExtension = fileExtensions.split("\\s*,\\s*")[0];
    mainPage = new WizardNewFileCreationPage("New File Page", getSelection()) {
        @Override
        protected InputStream getInitialContents() {
            NewFileTemplate template = new NewFileTemplate(this.getFileName().replace("."+fileExtension, ""), solidityVersion);

            return new StringInputStream(template.generate().toString());
        }
    };
    mainPage.setTitle("Solidity File");
    mainPage.setFileName("my_contract");
    mainPage.setFileExtension(fileExtension);
    addPage(mainPage);
}
项目:APICloud-Studio    文件:TemplateSelectionPage.java   
/**
 * Update the preview content with the given template.
 * 
 * @param template
 */
protected void setPreviewContent(TemplateElement template)
{
    WizardNewFileCreationPage fileCreationPage = (WizardNewFileCreationPage) getPreviousPage();
    String templateContent = null;
    try
    {
        IPath path = fileCreationPage.getContainerFullPath().append(fileCreationPage.getFileName());
        templateContent = NewFileWizard.getTemplateContent(template, path);
    }
    catch (Exception e)
    {
        // logs the exception but allows the page to continue
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
    if (templateContent == null)
    {
        templatePreview.setText(""); //$NON-NLS-1$
    }
    else
    {
        templatePreview.setText(templateContent);
    }
    scroll.setMinSize(templatePreview.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
项目:robovm-eclipse    文件:AbstractNewXcodeFileWizard.java   
@Override
public void addPages() {
    super.addPages();
    page = new WizardNewFileCreationPage(getPageName(), selection) {
        @Override
        protected void createAdvancedControls(Composite parent) {}

        @Override
        protected IStatus validateLinkedResource() {
            return Status.OK_STATUS;
        }
    };
    page.setImageDescriptor(RoboVMPlugin.getDefault().getImageRegistry()
            .getDescriptor(getPageBanner()));
    page.setTitle(getPageTitle());
    page.setDescription(getPageDescription());
    addPage(page);
}
项目:emfviews    文件:CreateViewWizard.java   
/**
 * The wizard is composed of two pages
 */
@Override
public void addPages() {
  viewContainerFolderSelectionPage =
      new WizardNewFileCreationPage(Messages.getString("VirtualModelFileWizard.Page.Name"), //$NON-NLS-1$
                                    selection);
  viewContainerFolderSelectionPage
      .setImageDescriptor(EmfViewsUIPlugin.getImageDescriptor("VirtualModelWizard.png")); //$NON-NLS-1$

  viewContainerFolderSelectionPage.setTitle(Messages.getString("VirtualModelFileWizard.Title")); //$NON-NLS-1$
  viewContainerFolderSelectionPage
      .setDescription(Messages.getString("VirtualModelFileWizard.Page.Description")); //$NON-NLS-1$
  viewContainerFolderSelectionPage.setFileExtension("eview"); //$NON-NLS-1$
  addPage(viewContainerFolderSelectionPage);
  String viewpoint = virtualMetamodel.getFullPath().makeRelative().toString();
  createViewScreen = new CreateViewScreen(viewpoint);

  addPage(createViewScreen);
}
项目:emfviews    文件:CreateViewpointWizard.java   
/**
 * The wizard is composed of two pages
 */
@Override
public void addPages() {
  simplePage =
      new WizardNewFileCreationPage(Messages.getString("VirtualMetamodelFileWizard.Page.Name"), //$NON-NLS-1$
                                    selection);
  simplePage.setImageDescriptor(EmfViewsUIPlugin.getImageDescriptor("VirtualModelWizard.png")); //$NON-NLS-1$

  simplePage.setTitle(Messages.getString("VirtualMetamodelFileWizard.Title")); //$NON-NLS-1$
  simplePage.setDescription(Messages.getString("VirtualModelFileWizard.Page.Description")); //$NON-NLS-1$
  simplePage.setFileExtension("eviewpoint"); //$NON-NLS-1$
  addPage(simplePage);

  advancedPage = new CreateViewpointScreen(selection);
  addPage(advancedPage);

  attSelectionPage = new AttributesSelectionPage();
  addPage(attSelectionPage);

}
项目:mappingtools    文件:TranslateDestinationWizard.java   
public void addPages() {
    for (Iterator<DataSource> it = activeSources.iterator();it.hasNext();)
    {
        DataSource ds = it.next();
        WizardNewFileCreationPage destinationPage = 
            new WizardNewFileCreationPage("FilePage", new StructuredSelection());
        String pageTitle = "Choose a new file to store the result of translation from data source "
            + ds.instanceURIString();
        destinationPage.setFileExtension(resultExtension);
        if (isXSLTGeneration) 
        {
            pageTitle = "Choose a new file to store generated XSLT to translate from mapped source "
                + ds.mappingSetURIString();
            destinationPage.setFileExtension("xsl");                
        }
        destinationPage.setTitle(pageTitle);
        addPage(destinationPage);   
        pages.add(destinationPage);
    }
}
项目:OCCI-Studio    文件:NewConfigurationWizard.java   
@Override
protected WizardNewFileCreationPage createNewFilePage() {
    return new NewFilePage(getSelection(), fileExt) {
        @Override
        public void createControl(Composite parent) {
            super.createControl(parent);
            Composite area = (Composite) getControl();
            Composite container = new Composite(area, SWT.NONE);
            container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            GridLayout layout = new GridLayout(2, false);
            container.setLayout(layout);
            Label lbtOcciServerUrl = new Label(container, SWT.NONE);
            lbtOcciServerUrl.setText(Messages.NewConfigurationWizard_OcciServerUrl);
            final Text txtOcciServerUrl = new Text(container, SWT.BORDER);
            txtOcciServerUrl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            txtOcciServerUrl.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e) {
                    occiServerUrl = txtOcciServerUrl.getText();
                    setPageComplete(validatePage());
                }
            });
        }

        @Override
        protected boolean validatePage() {
            // TODO add error messages
            return super.validatePage() && !Strings.isNullOrEmpty(occiServerUrl);
        }
    };
}
项目:OCCI-Studio    文件:NewConfigurationWizard.java   
@Override
protected WizardNewFileCreationPage createNewFilePage() {
    return new NewFilePage(getSelection(), fileExt) {
        @Override
        public void createControl(Composite parent) {
            super.createControl(parent);
            Composite control = (Composite) getControl();

            Composite extensionGroup = new Composite(control, SWT.NONE);
            GridLayout layout = new GridLayout();
            layout.numColumns = 2;
            extensionGroup.setLayout(layout);
            extensionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

            Label refOccieLabel = new Label(extensionGroup, SWT.NONE);
            refOccieLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
            refOccieLabel.setText(Messages.NewExtensionWizard_RefExtensionLabel);
            refOccieLabel.setFont(parent.getFont());

            Composite composite = new Composite(extensionGroup, SWT.NULL);
            GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
            composite.setLayoutData(layoutData);
            TableColumnLayout tableLayout = new TableColumnLayout();
            composite.setLayout(tableLayout);

            Table table = new Table(composite,
                    SWT.CHECK | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
            refExtensionViewer = new CheckboxTableViewer(table);

            refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());

            Collection<String> registeredExtensions = new ArrayList<String>(
                    OcciRegistry.getInstance().getRegisteredExtensions());
            refExtensionViewer.setInput(registeredExtensions);
        }
    };
}
项目:bdf2    文件:NewProcessWizard.java   
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    page=new WizardNewFileCreationPage("选择存储目录",selection);
    page.setFileName("process.jpdl.xml");
    page.setTitle("流程模版存储目录选择");
    page.setDescription("选择新建的流程模版文件存放目录");
    this.addPage(page);
}
项目:dawn-marketplace-server    文件:NewMarketplaceSolutionWizard.java   
@Override
public void addPages() {
    mainPage = new WizardNewFileCreationPage("newFilePage1", getSelection());//$NON-NLS-1$
    mainPage.setTitle("New Solution");
    mainPage.setDescription("Create a new marketplace solution. The file name must end with \".mps\".");
    addPage(mainPage);
}
项目:OpenSPIFe    文件:NewPlanResourceWizard.java   
@Override
public void addContentPages() {
       wizardNewFileCreationPage = new WizardNewFileCreationPage("newPlanFilePage1", getSelection());//$NON-NLS-1$
       wizardNewFileCreationPage.setTitle(getTranslatableName());
       wizardNewFileCreationPage.setFileExtension("plan");
       wizardNewFileCreationPage.setDescription(getDescription()); 

       temporalNewPlanWizardPage = new TemporalNewPlanWizardPage();
       temporalNewPlanWizardPage.setTitle(getTranslatableName());
       temporalNewPlanWizardPage.setDescription(getDescription());
       // descriptions is set in page

       addPage(wizardNewFileCreationPage);
       addPage(temporalNewPlanWizardPage);
   }
项目:klassviz    文件:NewKlavizFileWizard.java   
/**
 * {@inheritDoc}
 */
@Override
public void addPage(final IWizardPage page) {
    if (page instanceof WizardNewFileCreationPage) {
        ((WizardNewFileCreationPage) page).setFileName("classes.klaviz");
    }
    super.addPage(page);
}
项目:rustyeclipse    文件:NewPackageWizard.java   
@Override
public void addPages() {
        IStructuredSelection projectSelectionFromModulePath = getProjectSelection();
        mainPage = new WizardNewFileCreationPage("Create new Rust file", projectSelectionFromModulePath);
        mainPage.setTitle("Create new Rust file");
        mainPage.setFileExtension("rs");
        mainPage.setDescription("Create a new Rust file");
        addPage(mainPage);
}
项目:byteman-editor    文件:NewRuleWizard.java   
public static void openWizardDialog(IWorkbenchSite site, RuleTemplate ruleTemplate, IProject project) {
    NewRuleWizard wizard = new NewRuleWizard(ruleTemplate.toString());
    wizard.init(site.getWorkbenchWindow().getWorkbench(), new StructuredSelection(project));
    WizardDialog dialog = new WizardDialog(site.getShell(), wizard);
    dialog.setHelpAvailable(false);
    dialog.create();
    ((WizardNewFileCreationPage) dialog.getCurrentPage()).setFileName("rule.btm");
    dialog.open();
}
项目:MMINT    文件:EditorCreationWizardDialog.java   
protected void storeCreatedModelUri(IWizardPage page) {

        WizardNewFileCreationPage filePage = (WizardNewFileCreationPage) page;
        if (filePage.getNextPage() != null && filePage.getNextPage() instanceof WizardNewFileCreationPage) {
            WizardNewFileCreationPage nextPage = (WizardNewFileCreationPage) filePage.getNextPage();
            nextPage.setFileName(
                FileUtils.replaceFileNameInPath(
                    nextPage.getFileName(),
                    FileUtils.getFileNameFromPath(filePage.getFileName())
                )
            );
            filePage = nextPage;
        }
        createdModelUri = filePage.getContainerFullPath().toString() + IPath.SEPARATOR + filePage.getFileName();
    }
项目:MMINT    文件:EditorCreationWizardDialog.java   
/**
 * {@inheritDoc}
 * Remembers the uri of the created model.
 */
@Override
protected void finishPressed() {

    IWizardPage page = getCurrentPage();
    while (page.getPreviousPage() != null) { // first page or last WizardNewFileCreationPage
        if (page instanceof WizardNewFileCreationPage) {
            break;
        }
        page = page.getPreviousPage();
    }
    storeCreatedModelUri(page);

    super.finishPressed();
}
项目:mappingtools    文件:TranslateDestinationWizard.java   
/**
 * The wizard only succeeds if files are created for all active data sources
 */
public boolean performFinish() {
    boolean success =true;
    for (Iterator<WizardNewFileCreationPage> it = pages.iterator();it.hasNext();)
    {
        WizardNewFileCreationPage page = it.next();
        IFile file = page.createNewFile();
        success = success && (file != null) && (file.exists());
        if (success) destinationFiles.add(file);
    }
    if (!success) destinationFiles = new Vector<IFile>();
    return success;
}
项目:OCCI-Studio    文件:NewDiagramWizard.java   
protected WizardNewFileCreationPage createNewFilePage() {
    return new NewFilePage(getSelection(), fileExt);
}
项目:turnus    文件:ArchitectureBuilderWizard.java   
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {

    this.workbench = workbench;

    final WizardNewFileCreationPage page = new WizardNewFileCreationPage("filenameSelection", selection) {
        @Override
        protected boolean validatePage() {
            if (!super.validatePage()) {
                return false;
            }

            final IPath path = this.getContainerFullPath();
            final IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
            if (member instanceof IProject) {
                setMessage("The architecture can't be created directly " + "in a project. Please select a folder.",
                        DialogPage.ERROR);
                return false;
            }

            return true;
        }

        // We don't want "Advanced" section to be displayed.
        @Override
        protected void createAdvancedControls(Composite parent) {
            // Does nothing, DO NOT REMOVE. Overwrites link related stuff
        }

        @Override
        protected IStatus validateLinkedResource() {
            // Does nothing, DO NOT REMOVE. Overwrites link related stuff
            return Status.OK_STATUS;
        }

        @Override
        protected void createLinkTarget() {
            // Does nothing, DO NOT REMOVE. Overwrites link related stuff
        }
    };
    page.setFileExtension(TurnusExtensions.ARCHITECTURE);
    page.setDescription("Select a parent folder and a name for the new architecture.");
    page.setAllowExistingResources(false);

    // Fill the page with a filename, if user selected one
    if (!selection.isEmpty()) {
        final Object firstSel = selection.getFirstElement();
        if (firstSel instanceof IFile) {
            final IFile selectedFile = (IFile) firstSel;
            final String fileName = selectedFile.getName();
            final String ext = selectedFile.getFileExtension();
            if (ext == null || ext.isEmpty()) {
                page.setFileName(fileName);
            } else {
                int idx = fileName.indexOf(ext);
                if (idx > 0) {
                    page.setFileName(fileName.substring(0, idx - 1));
                }
            }
        }
    }

    addPage(page);
}
项目:KaiZen-OpenAPI-Editor    文件:SwagEditNewWizard.java   
@Override
protected WizardNewFileCreationPage newFileCreationPage(IStructuredSelection selection) {
    return new SwagEditNewWizardPage(selection);
}
项目:KaiZen-OpenAPI-Editor    文件:NewOpenApiV3SpecWizard.java   
@Override
protected WizardNewFileCreationPage newFileCreationPage(IStructuredSelection selection) {
    return new NewOpenApiV3SpecWizardPage(selection);
}
项目:eclipse-tapestry5-plugin    文件:OpenFileInTargetFolderAction.java   
private void createFile(final IFolder targetDir, final String fileName)
{
    try
    {
        preCreateFolder(targetDir);
    }
    catch (CoreException e)
    {
        throw new RuntimeException("Unable to pre-create folder for new file", e);
    }

    final WizardNewFileCreationPage fileCreationPage = new WizardNewFileCreationPage("", new TreeSelection())
    {
        @Override
        protected InputStream getInitialContents()
        {
            return OpenFileInTargetFolderAction.this.getInitialContents();
        }
    };

    WizardDialog dialog = new WizardDialog(window.getShell(), new Wizard()
    {
        @Override
        public boolean performFinish()
        {
            fileCreationPage.createNewFile();

            return true;
        }

        @Override
        public void addPages()
        {
            super.addPages();

            fileCreationPage.setFileName(fileName);

            fileCreationPage.setContainerFullPath(targetDir.getFullPath());

            addPage(fileCreationPage);
        }
    });

    dialog.create();
    try
    {
        dialog.getCurrentPage().getWizard().performFinish();
    }
    finally
    {
        dialog.close();
    }
}
项目:mappingtools    文件:FileSaverWizard.java   
public void addPages() {
    savedViewFileCreationPage = 
        new WizardNewFileCreationPage("FilePage", new StructuredSelection());
    savedViewFileCreationPage.setTitle(pageTitle);
    addPage(savedViewFileCreationPage);
}
项目:KaiZen-OpenAPI-Editor    文件:NewFileWizard.java   
abstract protected WizardNewFileCreationPage newFileCreationPage(IStructuredSelection selection);