Search in sources :

Example 1 with Wizard

use of org.eclipse.jface.wizard.Wizard in project tdi-studio-se by Talend.

the class BusinessInitDiagramFileAction method run.

/**
     * @generated NOT
     */
public void run(IAction action) {
    TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
    ResourceSet resourceSet = new ResourceSetImpl();
    EObject diagramRoot = null;
    try {
        Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);
        diagramRoot = (EObject) resource.getContents().get(0);
    } catch (WrappedException ex) {
        BusinessDiagramEditorPlugin.getInstance().logError(Messages.getString("BusinessInitDiagramFileAction.UnableToLoadResource") + mySelectedModelFile.getFullPath().toString(), //$NON-NLS-1$
        ex);
    }
    if (diagramRoot == null) {
        MessageDialog.openError(myPart.getSite().getShell(), Messages.getString("BusinessInitDiagramFileAction.Error"), //$NON-NLS-1$ //$NON-NLS-2$
        Messages.getString("BusinessInitDiagramFileAction.LoadFaild"));
        return;
    }
    Wizard wizard = new BusinessNewDiagramFileWizard(mySelectedModelFile, myPart.getSite().getPage(), mySelection, diagramRoot, editingDomain);
    IDialogSettings pluginDialogSettings = BusinessDiagramEditorPlugin.getInstance().getDialogSettings();
    //$NON-NLS-1$
    IDialogSettings initDiagramFileSettings = pluginDialogSettings.getSection("InisDiagramFile");
    if (initDiagramFileSettings == null) {
        //$NON-NLS-1$
        initDiagramFileSettings = pluginDialogSettings.addNewSection("InisDiagramFile");
    }
    wizard.setDialogSettings(initDiagramFileSettings);
    wizard.setForcePreviousAndNextButtons(false);
    wizard.setWindowTitle(//$NON-NLS-1$ //$NON-NLS-2$
    Messages.getString("BusinessInitDiagramFileAction.IntialNew") + BusinessProcessEditPart.MODEL_ID + Messages.getString("BusinessInitDiagramFileAction.DiagramFile"));
    WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard);
    dialog.create();
    dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
    dialog.open();
}
Also used : WrappedException(org.eclipse.emf.common.util.WrappedException) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with Wizard

use of org.eclipse.jface.wizard.Wizard in project cubrid-manager by CUBRID.

the class TableEditorPart method createPartitionTabButtons.

/**
	 * Create Partition tab buttons
	 *
	 * @param parent Composite
	 */
private void createPartitionTabButtons(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    {
        GridLayout gl = new GridLayout();
        gl.numColumns = 5;
        composite.setLayout(gl);
        composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    }
    addPartitionBtn = new Button(composite, SWT.PUSH);
    {
        GridData gd = new GridData(SWT.NONE);
        gd.horizontalIndent = 10;
        addPartitionBtn.setLayoutData(gd);
    }
    addPartitionBtn.setText(Messages.btnAddPartition);
    addPartitionBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            String tableName = tableNameText.getText();
            if (tableName.trim().length() == 0) {
                CommonUITool.openErrorBox(getSite().getShell(), Messages.msgNoTableName);
                return;
            }
            newSchemaInfo.setClassname(tableName);
            Wizard wizard = new CreatePartitionWizard(database.getDatabaseInfo(), newSchemaInfo, partitionInfoList, isNewTableFlag, null);
            CMWizardDialog dialog = new CMWizardDialog(getSite().getShell(), wizard);
            dialog.setPageSize(600, 400);
            if (dialog.open() != IDialogConstants.OK_ID) {
                return;
            }
            partitionTableView.refresh();
            changePartitionTabButtonStatus();
        }
    });
    editPartitionBtn = new Button(composite, SWT.PUSH);
    {
        GridData gd = new GridData(SWT.NONE);
        gd.horizontalIndent = 10;
        editPartitionBtn.setLayoutData(gd);
    }
    editPartitionBtn.setText(Messages.btnEditPartition);
    editPartitionBtn.setEnabled(false);
    editPartitionBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            editPartition();
        }
    });
    delPartitionBtn = new Button(composite, SWT.PUSH);
    {
        GridData gd = new GridData(SWT.NONE);
        gd.horizontalIndent = 10;
        delPartitionBtn.setLayoutData(gd);
    }
    delPartitionBtn.setText(Messages.btnDelPartition);
    delPartitionBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            String confirmMsg = Messages.msgDelPartition;
            if (getPartitonType() == PartitionType.HASH) {
                confirmMsg = Messages.msgDelHashPartition;
            }
            boolean deleteConfirm = CommonUITool.openConfirmBox(getSite().getShell(), confirmMsg);
            if (!deleteConfirm) {
                return;
            }
            if (getPartitonType() == PartitionType.HASH) {
                partitionInfoList.clear();
            } else {
                IStructuredSelection selection = (IStructuredSelection) partitionTableView.getSelection();
                if (selection == null || selection.isEmpty()) {
                    return;
                }
                partitionInfoList.removeAll(selection.toList());
                if (getPartitonType() == PartitionType.RANGE) {
                    CreatePartitionWizard.resetRangePartitionInfoList(partitionInfoList);
                }
            }
            partitionTableView.refresh();
            changePartitionTabButtonStatus();
        }
    });
    final Table partitionTable = partitionTableView.getTable();
    partitionTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            changePartitionTabButtonStatus();
        }
    });
    changePartitionTabButtonStatus();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) CreatePartitionWizard(com.cubrid.common.ui.cubrid.table.control.CreatePartitionWizard) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Wizard(org.eclipse.jface.wizard.Wizard) CreatePartitionWizard(com.cubrid.common.ui.cubrid.table.control.CreatePartitionWizard) CMWizardDialog(com.cubrid.common.ui.spi.dialog.CMWizardDialog)

Example 3 with Wizard

use of org.eclipse.jface.wizard.Wizard in project sling by apache.

the class AbstractJcrNodeImportExportContentHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection sel = HandlerUtil.getCurrentSelection(event);
    JcrNode node = SelectionUtils.getFirst(sel, JcrNode.class);
    if (node == null) {
        return null;
    }
    IProject project = node.getProject();
    if (!ProjectHelper.isContentProject(project)) {
        return null;
    }
    IModule module = ServerUtil.getModule(project);
    if (module == null) {
        return null;
    }
    IResource resource = node.getResourceForImportExport();
    if (resource == null) {
        return null;
    }
    Wizard wiz = createWizard(resource);
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wiz);
    dialog.open();
    return null;
}
Also used : IModule(org.eclipse.wst.server.core.IModule) JcrNode(org.apache.sling.ide.eclipse.ui.nav.model.JcrNode) ISelection(org.eclipse.jface.viewers.ISelection) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IProject(org.eclipse.core.resources.IProject) IResource(org.eclipse.core.resources.IResource)

Example 4 with Wizard

use of org.eclipse.jface.wizard.Wizard in project linuxtools by eclipse.

the class StapNewWizard method performFinish.

/**
 * This method is called when 'Finish' button is pressed in
 * the wizard. We will create an operation and run it
 * using wizard as execution context.
 */
@Override
public boolean performFinish() {
    final String containerName = page.getContainerName();
    final String fileName = page.getFileName();
    IRunnableWithProgress op = monitor -> {
        try {
            doFinish(containerName, fileName, monitor);
        } catch (CoreException e) {
            throw new InvocationTargetException(e);
        } finally {
            monitor.done();
        }
    };
    try {
        getContainer().run(true, false, op);
    } catch (InterruptedException e) {
        // $NON-NLS-1$
        MessageDialog.openError(getShell(), "Error", e.getLocalizedMessage());
        return false;
    } catch (InvocationTargetException e) {
        Throwable realException = e.getTargetException();
        // $NON-NLS-1$
        MessageDialog.openError(getShell(), "Error", realException.getMessage());
        return false;
    }
    return true;
}
Also used : WorkbenchException(org.eclipse.ui.WorkbenchException) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) IDE(org.eclipse.ui.ide.IDE) PlatformUI(org.eclipse.ui.PlatformUI) CoreException(org.eclipse.core.runtime.CoreException) Wizard(org.eclipse.jface.wizard.Wizard) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IContainer(org.eclipse.core.resources.IContainer) IDEPerspective(org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPerspective) ByteArrayInputStream(java.io.ByteArrayInputStream) ResourceBundle(java.util.ResourceBundle) Path(org.eclipse.core.runtime.Path) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) INewWizard(org.eclipse.ui.INewWizard) IFile(org.eclipse.core.resources.IFile) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbench(org.eclipse.ui.IWorkbench) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 5 with Wizard

use of org.eclipse.jface.wizard.Wizard in project linuxtools by eclipse.

the class SpecfileNewWizard method performFinish.

/**
 * This method is called when 'Finish' button is pressed in the wizard. We
 * will create an operation and run it using wizard as execution context.
 */
@Override
public boolean performFinish() {
    final String containerName = page.getProjectName();
    final String fileName = page.getFileName();
    final InputStream contentInputStream = openContentStream();
    IRunnableWithProgress op = monitor -> {
        try {
            doFinish(containerName, fileName, contentInputStream, monitor);
        } catch (CoreException e) {
            throw new InvocationTargetException(e);
        } finally {
            monitor.done();
        }
    };
    try {
        getContainer().run(true, false, op);
    } catch (InterruptedException e) {
        return false;
    } catch (InvocationTargetException e) {
        SpecfileLog.logError(e);
        Throwable realException = e.getTargetException();
        MessageDialog.openError(getShell(), Messages.SpecfileNewWizard_0, realException.getMessage());
        return false;
    }
    return true;
}
Also used : ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) IDE(org.eclipse.ui.ide.IDE) SpecfileNewWizardPage(org.eclipse.linuxtools.rpm.ui.editor.wizards.SpecfileNewWizardPage) CoreException(org.eclipse.core.runtime.CoreException) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) IContainer(org.eclipse.core.resources.IContainer) SpecfileLog(org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileLog) IStatus(org.eclipse.core.runtime.IStatus) Activator(org.eclipse.linuxtools.internal.rpm.ui.editor.Activator) ByteArrayInputStream(java.io.ByteArrayInputStream) PartInitException(org.eclipse.ui.PartInitException) IFile(org.eclipse.core.resources.IFile) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Files(java.nio.file.Files) PlatformUI(org.eclipse.ui.PlatformUI) Status(org.eclipse.core.runtime.Status) IOException(java.io.IOException) Wizard(org.eclipse.jface.wizard.Wizard) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Paths(java.nio.file.Paths) Messages(org.eclipse.linuxtools.rpm.ui.editor.wizards.Messages) IResource(org.eclipse.core.resources.IResource) Path(org.eclipse.core.runtime.Path) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) INewWizard(org.eclipse.ui.INewWizard) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbench(org.eclipse.ui.IWorkbench) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) InputStream(java.io.InputStream) CoreException(org.eclipse.core.runtime.CoreException) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

Wizard (org.eclipse.jface.wizard.Wizard)39 WizardDialog (org.eclipse.jface.wizard.WizardDialog)34 InvocationTargetException (java.lang.reflect.InvocationTargetException)8 CoreException (org.eclipse.core.runtime.CoreException)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 IOException (java.io.IOException)5 Path (org.eclipse.core.runtime.Path)5 Shell (org.eclipse.swt.widgets.Shell)5 InvalidAlgorithmParameterException (de.flexiprovider.api.exceptions.InvalidAlgorithmParameterException)4 NoSuchAlgorithmException (de.flexiprovider.api.exceptions.NoSuchAlgorithmException)4 AlgorithmParameterSpec (de.flexiprovider.api.parameters.AlgorithmParameterSpec)4 IFile (org.eclipse.core.resources.IFile)4 IRepositoryNode (org.talend.repository.model.IRepositoryNode)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ISelection (org.eclipse.jface.viewers.ISelection)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 TableItem (org.eclipse.swt.widgets.TableItem)3 IMetaKeyGenerator (org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaKeyGenerator)3 IMetaLength (org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaLength)3 INewEntryDescriptor (org.jcryptool.crypto.keystore.descriptors.interfaces.INewEntryDescriptor)3