Search in sources :

Example 76 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.

the class JobletContainer method setPropertyValue.

@Override
public void setPropertyValue(String id, Object value) {
    if (id.equals(EParameterName.COLLAPSED.getName())) {
        // outputs.clear();
        for (IConnection conn : node.getOutgoingConnections()) {
            outputs.add(conn);
        }
        // inputs.clear();
        for (IConnection conn : node.getIncomingConnections()) {
            inputs.add(conn);
        }
        if (needchangeLock) {
            if (!((Boolean) value)) {
                if (!new JobletUtil().isRed(this)) {
                    IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
                    if (service != null) {
                        service.lockJoblet(this.getNode());
                    }
                }
            } else {
                IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
                if (service != null) {
                    service.unlockJoblet(node, true);
                }
            }
        }
        needchangeLock = true;
        refreshJobletNodes(false, (Boolean) value);
        if (!canCollapse()) {
            Shell shell = Display.getCurrent().getActiveShell();
            MessageDialog dlg = new MessageDialog(new Shell(shell), "ERROR", null, "Please attach connection correctly!", MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
            dlg.open();
            return;
        }
        super.setPropertyValue(id, value);
        transferLocation(false);
        updateJobletContainer();
        if (node.isJoblet()) {
            refreshJobletConnections();
        }
        fireStructureChange(EParameterName.COLLAPSED.getName(), this);
    } else if (id.equals(UPDATE_JOBLET_DISPLAY)) {
        updateJobletDisplay();
    } else {
        super.setPropertyValue(id, value);
    }
}
Also used : IJobletProviderService(org.talend.core.ui.IJobletProviderService) Shell(org.eclipse.swt.widgets.Shell) IConnection(org.talend.core.model.process.IConnection) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 77 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.

the class FooterComposite method createComponents.

/**
     * amaumont Comment method "createComponents".
     */
private void createComponents() {
    GridData footerCompositeGridData = new GridData(GridData.FILL_HORIZONTAL);
    this.setLayoutData(footerCompositeGridData);
    FormLayout formLayout = new FormLayout();
    this.setLayout(formLayout);
    Button okButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    okButton.setText(Messages.getString("FooterComposite.0"));
    FormData okFormData = new FormData();
    Point minSize = okButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    okFormData.width = Math.max(IDialogConstants.BUTTON_WIDTH, minSize.x);
    okButton.setLayoutData(okFormData);
    okButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (foxManager.getUiManager().validateRootElement()) {
                foxManager.getUiManager().closeFOX(SWT.OK);
            } else {
                MessageDialog warningMessageDialog = new MessageDialog(composite.getShell(), Messages.getString(//$NON-NLS-1$
                "FooterComposite.RootElementError.Title"), //$NON-NLS-1$
                null, //$NON-NLS-1$
                Messages.getString("FooterComposite.RootElementError.Message"), //$NON-NLS-1$
                MessageDialog.ERROR, new String[] { Messages.getString("FooterComposite.0") }, //$NON-NLS-1$
                0);
                warningMessageDialog.open();
            }
        }
    });
    Button cancelButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    cancelButton.setText(Messages.getString("FooterComposite.1"));
    cancelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            foxManager.getUiManager().closeFOX(SWT.CANCEL);
        }
    });
    FormData cancelFormData = new FormData();
    minSize = cancelButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    cancelFormData.width = Math.max(IDialogConstants.BUTTON_WIDTH, minSize.x);
    cancelButton.setLayoutData(cancelFormData);
    Button autoMapButton = new Button(this, SWT.NONE);
    // see bug 7087
    if (foxManager != null) {
        boolean canModify = foxManager.getFoxComponent().getProcess().isReadOnly();
        if (foxManager.getFoxComponent().getOriginalNode().getJobletNode() != null) {
            canModify = foxManager.getFoxComponent().isReadOnly();
        }
        if (canModify) {
            autoMapButton.setEnabled(false);
        }
    }
    //$NON-NLS-1$
    autoMapButton.setToolTipText(Messages.getString("FooterComposite.AutoMapTip"));
    //$NON-NLS-1$
    autoMapButton.setText(Messages.getString("FooterComposite.AutoMap"));
    autoMapButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            foxManager.getUiManager().autoMap();
        }
    });
    FormData autoMapFormData = new FormData();
    minSize = autoMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    autoMapFormData.width = Math.max(IDialogConstants.BUTTON_WIDTH, minSize.x);
    autoMapButton.setLayoutData(autoMapFormData);
    cancelFormData.right = new FormAttachment(100, -5);
    okFormData.right = new FormAttachment(cancelButton, -5);
    autoMapFormData.left = new FormAttachment(0, 5);
    // tree operation buttons
    FormData treeNodeData = new FormData();
    moveDown = new MoveDownTreeNodeButton(this, foxManager);
    treeNodeData.right = new FormAttachment(okButton, -5);
    moveDown.getButton().setLayoutData(treeNodeData);
    moveUpBtn = new MoveUpTreeNodeButton(this, foxManager);
    treeNodeData = new FormData();
    treeNodeData.right = new FormAttachment(moveDown.getButton(), -5);
    moveUpBtn.getButton().setLayoutData(treeNodeData);
    removeNodeBtn = new RemoveTreeNodeButton(this, foxManager);
    treeNodeData = new FormData();
    treeNodeData.right = new FormAttachment(moveUpBtn.getButton(), -5);
    removeNodeBtn.getButton().setLayoutData(treeNodeData);
    addNodeBtn = new AddTreeNodeButton(this, foxManager);
    treeNodeData = new FormData();
    treeNodeData.right = new FormAttachment(removeNodeBtn.getButton(), -5);
    addNodeBtn.getButton().setLayoutData(treeNodeData);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Point(org.eclipse.swt.graphics.Point) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 78 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.

the class ExportJobScriptAction method doRun.

@Override
protected void doRun() {
    JobScriptsExportWizard processWizard = new JobScriptsExportWizard();
    IWorkbench workbench = getWorkbench();
    processWizard.setWindowTitle(EXPORTJOBSCRIPTS);
    processWizard.init(workbench, (IStructuredSelection) this.getSelection());
    Shell activeShell = Display.getCurrent().getActiveShell();
    WizardDialog dialog = new WizardDialog(activeShell, processWizard);
    if (checkDirtyPart(workbench)) {
        MessageDialog messageDialog = new //$NON-NLS-1$
        MessageDialog(//$NON-NLS-1$
        new Shell(), //$NON-NLS-1$
        "", //$NON-NLS-1$
        null, //$NON-NLS-1$
        Messages.getString("ExportJobScriptAction.confirmMessage"), MessageDialog.CONFIRM, new String[] { Messages.getString("ExportJobScriptAction.confirmContiune"), IDialogConstants.CANCEL_LABEL }, //$NON-NLS-1$
        0);
        if (messageDialog.open() != 0) {
            // don't do anything
            return;
        }
    }
    dialog.setPageSize(830, 580);
    dialog.open();
    // collector
    IPreferenceStore preferenceStore = RepositoryPlugin.getDefault().getPreferenceStore();
    int num = preferenceStore.getInt(ExportJobTokenCollector.TOS_COUNT_JOB_EXPORTS.getPrefKey());
    preferenceStore.setValue(ExportJobTokenCollector.TOS_COUNT_JOB_EXPORTS.getPrefKey(), num + 1);
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) JobScriptsExportWizard(org.talend.repository.ui.wizards.exportjob.JobScriptsExportWizard) Shell(org.eclipse.swt.widgets.Shell) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 79 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.

the class ComponentsPreferencePage method propertyChangeForComponents.

public void propertyChangeForComponents(PropertyChangeEvent event) {
    MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(), //$NON-NLS-1$
    Messages.getString("ComponentsPreferencePage.WarningTitle"), //$NON-NLS-1$
    null, //$NON-NLS-1$
    Messages.getString("ComponentsPreferencePage.WarningMsg"), //$NON-NLS-1$
    MessageDialog.WARNING, new String[] { Messages.getString("ComponentsPreferencePage.ButtonLabel0") }, //$NON-NLS-1$
    0);
    warningMessageDialog.open();
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 80 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project sling by apache.

the class ServersActionModeFiddlerActionDelegate method initToolbarContributedActions.

private void initToolbarContributedActions() {
    cleanAction = new Action("Clean Publish...", IAction.AS_PUSH_BUTTON) {

        public void run() {
            if (server == null) {
                MessageDialog.openInformation(view.getSite().getShell(), "No server selected", "A server must be selected");
                return;
            }
            int selection = 2;
            if (!doNotAskAgain) {
                MessageDialog dialog = new MessageDialog(view.getSite().getShell(), Messages.defaultDialogTitle, null, Messages.dialogPublishClean, MessageDialog.QUESTION_WITH_CANCEL, new String[] { "Cancel", "OK (do not ask again)", "OK" }, 1) {

                    @Override
                    protected void configureShell(Shell shell) {
                        super.configureShell(shell);
                        setShellStyle(getShellStyle() | SWT.SHEET);
                    }
                };
                selection = dialog.open();
            }
            if (selection != 0) {
                if (selection == 1) {
                    doNotAskAgain = true;
                }
                IAdaptable info = new IAdaptable() {

                    public Object getAdapter(Class adapter) {
                        if (Shell.class.equals(adapter))
                            return view.getSite().getShell();
                        if (String.class.equals(adapter))
                            return "user";
                        return null;
                    }
                };
                server.publish(IServer.PUBLISH_CLEAN, modules, info, null);
            }
        }
    };
    cleanAction.setText("Clean Publish...");
    cleanAction.setToolTipText("Clean and Publish...");
    ImageDescriptor cleanAndPublishImageDesc = new DecorationOverlayIcon(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_PUBLISH).createImage(), ImageDescriptor.createFromFile(SharedImages.class, "refresh.gif"), IDecoration.BOTTOM_RIGHT);
    cleanAction.setImageDescriptor(cleanAndPublishImageDesc);
    cleanAction.setId("org.apache.sling.ide.eclipse.ui.actions.CleanPublishAction");
    publishAction = new Action("Publish", IAction.AS_PUSH_BUTTON) {

        public void run() {
            if (server == null) {
                MessageDialog.openInformation(view.getSite().getShell(), "No server selected", "A server must be selected");
                return;
            }
            IAdaptable info = new IAdaptable() {

                public Object getAdapter(Class adapter) {
                    if (Shell.class.equals(adapter))
                        return view.getSite().getShell();
                    if (String.class.equals(adapter))
                        return "user";
                    return null;
                }
            };
            server.publish(IServer.PUBLISH_INCREMENTAL, modules, info, null);
        }
    };
    publishAction.setText("Publish");
    publishAction.setToolTipText("Publish");
    publishAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_PUBLISH));
    publishAction.setId("org.apache.sling.ide.eclipse.ui.actions.PublishAction");
    cleanAction.setEnabled(false);
    publishAction.setEnabled(false);
    cleanActionContributionItem = new ActionContributionItem(cleanAction);
    publishActionContributionItem = new ActionContributionItem(publishAction);
    appendedToolbarActionContributionItems.add(publishActionContributionItem);
    appendedToolbarActionContributionItems.add(cleanActionContributionItem);
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) Shell(org.eclipse.swt.widgets.Shell) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Aggregations

MessageDialog (org.eclipse.jface.dialogs.MessageDialog)129 Shell (org.eclipse.swt.widgets.Shell)27 CoreException (org.eclipse.core.runtime.CoreException)16 IPath (org.eclipse.core.runtime.IPath)14 File (java.io.File)10 ArrayList (java.util.ArrayList)10 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 Composite (org.eclipse.swt.widgets.Composite)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Point (org.eclipse.swt.graphics.Point)7 IOException (java.io.IOException)6 IFile (org.eclipse.core.resources.IFile)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 List (java.util.List)5 IStatus (org.eclipse.core.runtime.IStatus)5 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)4 Path (org.eclipse.core.runtime.Path)4