Example usage for org.eclipse.jface.dialogs IDialogConstants OK_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants OK_ID.

Prototype

int OK_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.

Click Source Link

Document

Button id for an "Ok" button (value 0).

Usage

From source file:com.arc.embeddedcdt.gui.ARCCommonTab.java

License:Open Source License

/**
 * Creates the component set for the capture output composite
 * @param parent the parent to add this component to
 *///from  www  .ja v a 2s  . c o  m
private void createOutputCaptureComponent(Composite parent) {
    Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_4, 5, 2,
            GridData.FILL_HORIZONTAL);
    Composite comp = SWTFactory.createComposite(group, 5, 5, GridData.FILL_BOTH);
    GridLayout ld = (GridLayout) comp.getLayout();
    ld.marginWidth = 1;
    ld.marginHeight = 1;
    fConsoleOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_5);
    GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
    gd.horizontalSpan = 5;
    fConsoleOutput.setLayoutData(gd);
    fConsoleOutput.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateLaunchConfigurationDialog();
        }
    });

    fFileOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_6);
    fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
    fFileOutput.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            enableOuputCaptureWidgets(fFileOutput.getSelection());
            updateLaunchConfigurationDialog();
        }
    });
    fFileText = SWTFactory.createSingleText(comp, 4);
    fFileText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(AccessibleEvent e) {
            e.result = LaunchConfigurationsMessages.CommonTab_6;
        }
    });
    fFileText.addModifyListener(fBasicModifyListener);

    Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END);
    ld = (GridLayout) bcomp.getLayout();
    ld.marginHeight = 1;
    ld.marginWidth = 0;
    fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null);
    fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
                    new WorkbenchLabelProvider(), new WorkbenchContentProvider());
            dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13);
            dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14);
            dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
            dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
            dialog.setDialogBoundsSettings(getDialogBoundsSettings(WORKSPACE_SELECTION_DIALOG),
                    Dialog.DIALOG_PERSISTSIZE);
            if (dialog.open() == IDialogConstants.OK_ID) {
                IResource resource = (IResource) dialog.getFirstResult();
                if (resource != null) {
                    String arg = resource.getFullPath().toString();
                    String fileLoc = VariablesPlugin.getDefault().getStringVariableManager()
                            .generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
                    fFileText.setText(fileLoc);
                }
            }
        }
    });
    fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null);
    fFileBrowse.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            String filePath = fFileText.getText();
            FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
            filePath = dialog.open();
            if (filePath != null) {
                fFileText.setText(filePath);
            }
        }
    });
    fVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_9, null);
    fVariables.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
            dialog.open();
            String variable = dialog.getVariableExpression();
            if (variable != null) {
                fFileText.insert(variable);
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11);
    gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
    gd.horizontalSpan = 4;
    fAppend.setLayoutData(gd);
    fAppend.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateLaunchConfigurationDialog();
        }
    });
}

From source file:com.archimatetool.editor.diagram.actions.CreateDerivedRelationAction.java

License:Open Source License

@Override
public void run() {
    List<?> selection = getSelectedObjects();

    EditPart editPart = (EditPart) selection.get(0);
    IDiagramModelArchimateObject diagramModelObject1 = (IDiagramModelArchimateObject) editPart.getModel();
    editPart = (EditPart) selection.get(1);
    IDiagramModelArchimateObject diagramModelObject2 = (IDiagramModelArchimateObject) editPart.getModel();

    ChainList chainList1 = new ChainList(diagramModelObject1, diagramModelObject2);
    ChainList chainList2 = new ChainList(diagramModelObject2, diagramModelObject1);

    // Already has a direct relationship in both directions
    if (chainList1.hasExistingDirectRelationship() && chainList2.hasExistingDirectRelationship()) {
        MessageDialog.openInformation(getWorkbenchPart().getSite().getShell(),
                Messages.CreateDerivedRelationAction_1, Messages.CreateDerivedRelationAction_2);
        return;//w  w w  . j av a 2s . co m
    }

    // Both chains are too complicated
    if (chainList1.isTooComplicated && chainList2.isTooComplicated) {
        MessageDialog.openInformation(getWorkbenchPart().getSite().getShell(),
                Messages.CreateDerivedRelationAction_1, Messages.CreateDerivedRelationAction_3);
        return;
    }

    // No chains found, although perhaps one was too complicated...
    if (chainList1.getChains() == null && chainList2.getChains() == null) {
        if (chainList1.isTooComplicated || chainList2.isTooComplicated) {
            MessageDialog.openInformation(getWorkbenchPart().getSite().getShell(),
                    Messages.CreateDerivedRelationAction_1, Messages.CreateDerivedRelationAction_4);
        } else {
            MessageDialog.openInformation(getWorkbenchPart().getSite().getShell(),
                    Messages.CreateDerivedRelationAction_1, Messages.CreateDerivedRelationAction_5);
        }
        return;
    }

    CreateDerivedConnectionDialog dialog = new CreateDerivedConnectionDialog(
            getWorkbenchPart().getSite().getShell(), chainList1, chainList2);

    if (dialog.open() == IDialogConstants.OK_ID) {
        List<IRelationship> chain = dialog.getSelectedChain();
        if (chain != null) {
            ChainList chainList = dialog.getSelectedChainList();
            EClass relationshipClass = DerivedRelationsUtils.getWeakestType(chain);
            IRelationship relation = (IRelationship) IArchimateFactory.eINSTANCE.create(relationshipClass);
            CommandStack stack = (CommandStack) getWorkbenchPart().getAdapter(CommandStack.class);
            stack.execute(new CreateDerivedConnectionCommand(chainList.srcDiagramObject,
                    chainList.tgtDiagramObject, relation));
        }
    }
}

From source file:com.archimatetool.editor.diagram.dialog.NewNestedRelationDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.NewNestedRelationDialog_3, false);
}

From source file:com.archimatetool.editor.propertysections.UserPropertiesManagerDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Control c = super.createButtonBar(parent);
    getButton(IDialogConstants.OK_ID).setEnabled(false);
    return c;/*  w w w.  ja  va  2 s .com*/
}

From source file:com.archimatetool.editor.propertysections.UserPropertiesManagerDialog.java

License:Open Source License

private void deleteSelectedPropertyKeys() {
    for (Object o : ((IStructuredSelection) fTableViewer.getSelection()).toList()) {
        fKeysTable.entrySet().remove(o);
    }//from  w  w  w  . j a  va  2 s  .  c  om
    fTableViewer.refresh();
    getButton(IDialogConstants.OK_ID).setEnabled(true);
}

From source file:com.archimatetool.editor.ui.dialog.AboutDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    GridLayout layout = (GridLayout) parent.getLayout();
    layout.marginHeight = 0;// w w  w . jav a 2 s  .  com
    layout.marginBottom = 5;

    installationDetailsButton = createButton(parent, INSTALLATION_DETAILS_ID, Messages.AboutDialog_4, false);
    setButtonLayoutData(installationDetailsButton);

    createButton(parent, IDialogConstants.OK_ID, Messages.AboutDialog_6, true);
}

From source file:com.archimatetool.editor.ui.dialog.RelationshipsMatrixDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK button
    createButton(parent, IDialogConstants.OK_ID, Messages.RelationshipsMatrixDialog_2, true);
}

From source file:com.architexa.org.eclipse.gef.ui.palette.customize.PaletteCustomizerDialog.java

License:Open Source License

/**
 * This method should be invoked by EntryPages when an error that they had earlier
 * reported (using {@link #showProblem(String)}) is fixed.  This will hide the error
 * message, enable the OK and Apply buttons and re-allow changing selection in the outline
 * tree.//from w  ww  .  java  2 s .  c  o m
 * 
 * @see com.architexa.org.eclipse.gef.ui.palette.customize.EntryPageContainer#clearProblem()
 * @see #showProblem(String)
 */
public void clearProblem() {
    if (errorMessage != null) {
        titleSwitcher.showPage(titlePage);
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        getButton(APPLY_ID).setEnabled(true);
        errorMessage = null;
    }
}

From source file:com.architexa.org.eclipse.gef.ui.palette.customize.PaletteCustomizerDialog.java

License:Open Source License

/**
 * This method should be invoked by EntryPages when there is an error.  It will show the
 * given error in the title of the properties panel.  OK and Apply buttons will be
 * disabled.  Selecting some other entry in the outline tree will not be allowed until the
 * error is fixed.//from  www.  j  av a 2s .  c o  m
 * 
 * @see com.architexa.org.eclipse.gef.ui.palette.customize.EntryPageContainer#showProblem(String)
 */
public void showProblem(String error) {
    Assert.isNotNull(error);
    errorTitle.setText(error);
    titleSwitcher.showPage(errorPage);
    getButton(IDialogConstants.OK_ID).setEnabled(false);
    getButton(APPLY_ID).setEnabled(false);
    errorMessage = error;
}

From source file:com.arm.cmsis.pack.installer.CopyExampleDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fCopyButton = createButton(parent, IDialogConstants.OK_ID, "Copy", true); //$NON-NLS-1$
    if (fShowAttention) {
        fCopyButton.setEnabled(false);//from  w  w  w  .j a  v  a2  s .com
    }
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}