Search in sources :

Example 1 with WizardNewFileCreationPage

use of org.eclipse.ui.dialogs.WizardNewFileCreationPage in project tdi-studio-se by Talend.

the class BusinessNewDiagramFileWizard method addPages.

/**
     * @generated NOT
     */
public void addPages() {
    myFileCreationPage = new WizardNewFileCreationPage(Messages.getString(//$NON-NLS-1$
    "BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile"), //$NON-NLS-1$
    mySelection) {

        public void createControl(Composite parent) {
            super.createControl(parent);
            IContainer parentContainer = mySelectedModelFile.getParent();
            String originalFileName = mySelectedModelFile.getProjectRelativePath().removeFileExtension().lastSegment();
            //$NON-NLS-1$
            String fileExtension = ".business_diagram";
            String fileName = originalFileName + fileExtension;
            for (int i = 1; parentContainer.getFile(new Path(fileName)).exists(); i++) {
                fileName = originalFileName + i + fileExtension;
            }
            setFileName(fileName);
        }
    };
    //$NON-NLS-1$
    myFileCreationPage.setTitle(Messages.getString("BusinessNewDiagramFileWizard.DiagramFile"));
    myFileCreationPage.setDescription(Messages.getString("BusinessNewDiagramFileWizard.CreateNewDiagram", //$NON-NLS-1$ //$NON-NLS-2$
    BusinessProcessEditPart.MODEL_ID));
    addPage(myFileCreationPage);
    addPage(new RootElementSelectorPage());
}
Also used : Path(org.eclipse.core.runtime.Path) Composite(org.eclipse.swt.widgets.Composite) WizardNewFileCreationPage(org.eclipse.ui.dialogs.WizardNewFileCreationPage) IContainer(org.eclipse.core.resources.IContainer)

Example 2 with WizardNewFileCreationPage

use of org.eclipse.ui.dialogs.WizardNewFileCreationPage in project sling by apache.

the class AbstractNewSightlyFileWizard method init.

public void init(IWorkbench workbench, IStructuredSelection selection) {
    this.workbench = workbench;
    fileCreationPage = new WizardNewFileCreationPage(pageTitle, selection) {

        @Override
        protected InputStream getInitialContents() {
            String contents = AbstractNewSightlyFileWizard.this.getInitialContents();
            return new ByteArrayInputStream(contents.getBytes());
        }

        @Override
        protected boolean validatePage() {
            return super.validatePage() && validateFileToBeCreated();
        }
    };
    if (getInitialFileName() != null) {
        fileCreationPage.setFileName(getInitialFileName());
    }
    fileCreationPage.setTitle("Sightly");
    fileCreationPage.setDescription(wizardDescription);
    fileCreationPage.setImageDescriptor(SharedImages.SIGHTLY_WIZARD_BANNER);
    setWindowTitle(pageTitle);
    addPage(fileCreationPage);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) WizardNewFileCreationPage(org.eclipse.ui.dialogs.WizardNewFileCreationPage)

Example 3 with WizardNewFileCreationPage

use of org.eclipse.ui.dialogs.WizardNewFileCreationPage in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationMainTab method handlePropertyFileCreate.

private void handlePropertyFileCreate() {
    Wizard wizard = new Wizard() {

        String pageName = HibernateConsoleMessages.ConsoleConfigurationMainTab_create_property_file;

        WizardNewFileCreationPage cPage = null;

        @Override
        public void addPages() {
            StructuredSelection selection = null;
            IJavaProject project = findJavaProject();
            if (project != null) {
                selection = new StructuredSelection(project);
            } else {
                selection = StructuredSelection.EMPTY;
            }
            cPage = new WizardNewFileCreationPage(pageName, selection);
            cPage.setTitle(HibernateConsoleMessages.ConsoleConfigurationMainTab_create_hibernate_properties_file);
            cPage.setDescription(HibernateConsoleMessages.ConsoleConfigurationMainTab_create_new_properties_file);
            // $NON-NLS-1$
            cPage.setFileName("hibernate.properties");
            addPage(cPage);
        }

        @Override
        public boolean performFinish() {
            final IFile file = cPage.createNewFile();
            propertyFileText.setText(file.getFullPath().toOSString());
            return true;
        }
    };
    IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    WizardDialog wdialog = new WizardDialog(win.getShell(), wizard);
    wdialog.open();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IJavaProject(org.eclipse.jdt.core.IJavaProject) IFile(org.eclipse.core.resources.IFile) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) WizardNewFileCreationPage(org.eclipse.ui.dialogs.WizardNewFileCreationPage) Wizard(org.eclipse.jface.wizard.Wizard) NewConfigurationWizard(org.hibernate.eclipse.console.wizards.NewConfigurationWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 4 with WizardNewFileCreationPage

use of org.eclipse.ui.dialogs.WizardNewFileCreationPage in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationMainTab method handleConfigurationFileCreate.

private void handleConfigurationFileCreate() {
    StructuredSelection selection = null;
    IJavaProject project = findJavaProject();
    if (project != null) {
        selection = new StructuredSelection(project);
    } else {
        selection = StructuredSelection.EMPTY;
    }
    NewConfigurationWizard wizard = new NewConfigurationWizard();
    wizard.init(PlatformUI.getWorkbench(), selection);
    IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    WizardDialog wdialog = new WizardDialog(win.getShell(), wizard);
    wdialog.create();
    IWizardPage configPage = wizard.getPage(HibernateConsoleMessages.ConsoleConfigurationMainTab_wizard_page);
    if (configPage != null && configPage instanceof NewConfigurationWizardPage) {
        ((NewConfigurationWizardPage) configPage).setCreateConsoleConfigurationVisible(false);
        String cpName = nonEmptyTrimOrNull(connectionProfileCtrl.getSelectedConnectionName());
        if (cpName != null && !ConnectionProfileCtrl.JPA_CONNECTIN_NAME.equals(cpName) && !ConnectionProfileCtrl.NO_CONNECTIN_NAME.equals(cpName))
            ((NewConfigurationWizardPage) configPage).setConnectionProfileName(connectionProfileCtrl.getSelectedConnectionName());
    }
    // This opens a dialog
    if (wdialog.open() == Window.OK) {
        WizardNewFileCreationPage createdFilePath = ((WizardNewFileCreationPage) wizard.getStartingPage());
        if (createdFilePath != null) {
            // createNewFile() does not creates new file if it was created by wizard (OK was pressed)
            configurationFileText.setText(createdFilePath.createNewFile().getFullPath().toOSString());
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IJavaProject(org.eclipse.jdt.core.IJavaProject) NewConfigurationWizard(org.hibernate.eclipse.console.wizards.NewConfigurationWizard) NewConfigurationWizardPage(org.hibernate.eclipse.console.wizards.NewConfigurationWizardPage) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IWizardPage(org.eclipse.jface.wizard.IWizardPage) WizardNewFileCreationPage(org.eclipse.ui.dialogs.WizardNewFileCreationPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 5 with WizardNewFileCreationPage

use of org.eclipse.ui.dialogs.WizardNewFileCreationPage in project jbosstools-hibernate by jbosstools.

the class NewHibernateMappingFileWizard method addPages.

@Override
public void addPages() {
    super.addPages();
    if (selection == null) {
        selection = new StructuredSelection();
    }
    page0 = new NewHibernateMappingElementsSelectionPage2(JdtUiMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file, selection);
    page0.setTitle(JdtUiMessages.NewHibernateMappingElementsSelectionPage2_title);
    page0.setDescription(JdtUiMessages.NewHibernateMappingElementsSelectionPage2_description);
    addPage(page0);
    // $NON-NLS-1$
    cPage = new WizardNewFileCreationPage("Ccfgxml", selection);
    cPage.setTitle(JdtUiMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file);
    cPage.setDescription(JdtUiMessages.NewHibernateMappingFileWizard_create_empty_xml_mapping_file);
    // $NON-NLS-1$
    cPage.setFileName("hibernate.hbm.xml");
    addPage(cPage);
    page2 = new NewHibernateMappingFilePage(false);
    page2.setTitle(JdtUiMessages.NewHibernateMappingFilePage_title);
    page2.setMessage(JdtUiMessages.NewHibernateMappingFilePage_this_wizard_creates, IMessageProvider.WARNING);
    addPage(page2);
    previewPage = new NewHibernateMappingPreviewPage();
    previewPage.setTitle(JdtUiMessages.NewHibernateMappingPreviewPage_title);
    addPage(previewPage);
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) WizardNewFileCreationPage(org.eclipse.ui.dialogs.WizardNewFileCreationPage)

Aggregations

WizardNewFileCreationPage (org.eclipse.ui.dialogs.WizardNewFileCreationPage)11 InputStream (java.io.InputStream)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 NewConfigurationWizard (org.hibernate.eclipse.console.wizards.NewConfigurationWizard)3 IJavaProject (org.eclipse.jdt.core.IJavaProject)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 IWizardPage (org.eclipse.jface.wizard.IWizardPage)2 NewConfigurationWizardPage (org.hibernate.eclipse.console.wizards.NewConfigurationWizardPage)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 BuiltInTemplate (org.bndtools.core.ui.wizards.shared.BuiltInTemplate)1 TemplateParamsWizardPage (org.bndtools.core.ui.wizards.shared.TemplateParamsWizardPage)1 TemplateSelectionWizardPage (org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage)1 StringResource (org.bndtools.templating.StringResource)1 IContainer (org.eclipse.core.resources.IContainer)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1