List of usage examples for org.eclipse.jface.dialogs Dialog open
public int open()
From source file:org.eclipse.birt.report.designer.ui.internal.rcp.actions.NewLibraryAction.java
License:Open Source License
public void run() { Dialog dialog = new BaseWizardDialog(fWindow.getShell(), new NewLibraryWizard()); dialog.open(); }
From source file:org.eclipse.birt.report.designer.ui.internal.rcp.actions.NewReportAction.java
License:Open Source License
public void run() { Dialog dialog = new BaseWizardDialog(fWindow.getShell(), new NewReportWizard()); dialog.open(); }
From source file:org.eclipse.birt.report.designer.ui.internal.rcp.actions.NewReportTemplateAction.java
License:Open Source License
public void run() { Dialog dialog = new BaseWizardDialog(fWindow.getShell(), new NewReportTemplateWizard()); dialog.open(); }
From source file:org.eclipse.cdt.examples.dsf.filebrowser.FileBrowserAction.java
License:Open Source License
@Override public void run(IAction action) { if (fWindow != null) { // Create the dialog and open it. Dialog dialog = new FileBrowserDialog(fWindow.getShell()); dialog.open(); }// w w w. j a va 2s . c om }
From source file:org.eclipse.cdt.launch.ui.CDebuggerTab.java
License:Open Source License
protected void createOptionsComposite(Composite parent) { Composite optionsComp = new Composite(parent, SWT.NONE); int numberOfColumns = (fAttachMode) ? 1 : 3; GridLayout layout = new GridLayout(numberOfColumns, false); optionsComp.setLayout(layout);//from w w w . jav a2 s. c o m optionsComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 1, 1)); if (fAttachMode == false) { fStopInMain = createCheckButton(optionsComp, LaunchMessages.CDebuggerTab_Stop_at_main_on_startup); fStopInMain.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fStopInMainSymbol.setEnabled(fStopInMain.getSelection()); update(); } }); fStopInMainSymbol = new Text(optionsComp, SWT.SINGLE | SWT.BORDER); final GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); gridData.widthHint = 100; fStopInMainSymbol.setLayoutData(gridData); fStopInMainSymbol.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent evt) { update(); } }); fStopInMainSymbol.getAccessible().addAccessibleListener(new AccessibleAdapter() { @Override public void getName(AccessibleEvent e) { e.result = LaunchMessages.CDebuggerTab_Stop_at_main_on_startup; } }); } fAdvancedButton = createPushButton(optionsComp, LaunchMessages.CDebuggerTab_Advanced, null); ((GridData) fAdvancedButton.getLayoutData()).horizontalAlignment = GridData.END; fAdvancedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Dialog dialog = new AdvancedDebuggerOptionsDialog(getShell()); dialog.open(); } }); }
From source file:org.eclipse.compare.tests.TextMergeViewerTest.java
License:Open Source License
private void runInDialog(Object input, Runnable runnable, final CompareConfiguration cc) throws Exception { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); Dialog dialog = new Dialog(shell) { protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); viewer = new TestMergeViewer(composite, cc); return composite; }/*from w w w . j a va2 s. c o m*/ }; dialog.setBlockOnOpen(false); dialog.open(); viewer.setInput(input); try { runnable.run(); } catch (WrappedException e) { e.throwException(); } dialog.close(); viewer = null; }
From source file:org.eclipse.datatools.sqltools.routineeditor.ui.launching.LaunchUI.java
License:Open Source License
/** * This method will popup a dialog for config parameter values. * // ww w . j a va2 s. c om * @param shell * @param pds parameter descriptors. can't be null * @param valueList this parameter is both input and output. Input as initial value. Output as result value if * success. can't be null. * @param always whether always popup a dialog even though no parameter is needed. * @return null means the user clicks Cancel * not null means the parameter configs are modified */ public static List configParameter(Shell shell, ParameterDescriptor[] pds, List valueList, boolean always, ILaunchConfiguration configuration) { if ((pds == null || pds.length == 0) && !always) { // there is no need to config parameters, so just clear the value list and return valueList.clear(); return valueList; } ParameterWrapper[] wrappers = getParameterWrapper(pds, valueList); Dialog dialog = null; try { DatabaseIdentifier dbid = LaunchHelper.readDatabaseIdentifier(configuration); SQLDevToolsUIConfiguration conf = SQLToolsUIFacade.getConfiguration(dbid, null); dialog = conf.getUIComponentService().getParameterTableDialog(shell, wrappers, configuration); } catch (CoreException e) { RoutineEditorUIActivator.getDefault().log(e); } if (dialog == null) { dialog = new ParameterTableDialog(shell, wrappers); } if (dialog.open() == Dialog.OK) { valueList.clear(); for (int i = 0; i < wrappers.length; i++) { if (wrappers[i].isNull()) valueList.add(null); else valueList.add(wrappers[i].getValue()); } return valueList; } else { return null; } }
From source file:org.eclipse.debug.internal.ui.sourcelookup.browsers.ProjectSourceContainerBrowser.java
License:Open Source License
public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) { Object input = ResourcesPlugin.getWorkspace().getRoot(); IStructuredContentProvider contentProvider = new BasicContainerContentProvider(); ILabelProvider labelProvider = new WorkbenchLabelProvider(); Dialog dialog = new ProjectSourceContainerDialog(shell, input, contentProvider, labelProvider, SourceLookupUIMessages.projectSelection_chooseLabel); if (dialog.open() == Window.OK) { Object[] elements = ((ListSelectionDialog) dialog).getResult(); ArrayList res = new ArrayList(); for (int i = 0; i < elements.length; i++) { if (!(elements[i] instanceof IProject)) continue; res.add(new ProjectSourceContainer((IProject) elements[i], ((ProjectSourceContainerDialog) dialog).isAddRequiredProjects())); }//from w w w . j ava 2s . c o m return (ISourceContainer[]) res.toArray(new ISourceContainer[res.size()]); } return new ISourceContainer[0]; }
From source file:org.eclipse.debug.internal.ui.stringsubstitution.PasswordPrompt.java
License:Open Source License
public void prompt() { Dialog dialog = new Dialog((Shell) null) { private Text text; /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *///from w w w .j a v a 2 s .c o m protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); // create message if (dialogMessage != null) { Label label = new Label(composite, SWT.WRAP); label.setText(dialogMessage); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setFont(parent.getFont()); } text = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); String value = defaultValue == null ? lastValue : defaultValue; if (value != null) { text.setText(value); } applyDialogFont(composite); return composite; } /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) */ protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { returnValue = text.getText(); } else { returnValue = null; } super.buttonPressed(buttonId); } /* (non-Javadoc) * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(StringSubstitutionMessages.StringPromptExpander_0); } }; int dialogResult = dialog.open(); if (dialogResult == Window.OK) { dialogResultString = returnValue; } }
From source file:org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.java
License:Open Source License
public static void createMapProperties(Composite parent, final Messages Messages, final AbstractComponentEditor editor, String label, String tooltip, final EStructuralFeature feature, int vIndent) { Label l = new Label(parent, SWT.NONE); l.setText(label);// w ww .j av a 2s.c om if (tooltip != null) { l.setToolTipText(tooltip); } GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); gd.verticalIndent = vIndent; l.setLayoutData(gd); final TableViewer tableviewer = new TableViewer(parent); tableviewer.getTable().setHeaderVisible(true); ObservableListContentProvider cp = new ObservableListContentProvider(); tableviewer.setContentProvider(cp); gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 80; gd.verticalIndent = vIndent; tableviewer.getControl().setLayoutData(gd); TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText(Messages.ControlFactory_Key); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @Override public String getText(Object element) { Entry<String, String> entry = (Entry<String, String>) element; return entry.getKey(); } }); final TextCellEditor keyEditor = new TextCellEditor(tableviewer.getTable()); column.setEditingSupport(new EditingSupport(tableviewer) { @Override protected void setValue(Object element, Object value) { Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__KEY, value.toString().trim().length() == 0 ? null : value.toString()); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); tableviewer.refresh(); tableviewer.getTable().getColumn(0).pack(); } } @Override protected Object getValue(Object element) { Entry<String, String> entry = (Entry<String, String>) element; return entry.getKey(); } @Override protected CellEditor getCellEditor(Object element) { return keyEditor; } @Override protected boolean canEdit(Object element) { return true; } }); // FIXME How can we react upon changes in the Map-Value? column = new TableViewerColumn(tableviewer, SWT.NONE); column.getColumn().setText(Messages.ControlFactory_Value); column.getColumn().setWidth(200); column.setLabelProvider(new ColumnLabelProvider() { @SuppressWarnings("unchecked") @Override public String getText(Object element) { Entry<String, String> entry = (Entry<String, String>) element; return entry.getValue(); } }); final TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); column.setEditingSupport(new EditingSupport(tableviewer) { @Override protected void setValue(Object element, Object value) { Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__VALUE, value.toString().trim().length() == 0 ? null : value.toString()); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); tableviewer.refresh(); } } @SuppressWarnings("unchecked") @Override protected Object getValue(Object element) { Entry<String, String> entry = (Entry<String, String>) element; return entry.getValue() == null ? "" : entry.getValue(); //$NON-NLS-1$ } @Override protected CellEditor getCellEditor(Object element) { return cellEditor; } @Override protected boolean canEdit(Object element) { return true; } }); IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), feature); IObservableList observableList = prop.observeDetail(editor.getMaster()); tableviewer.setInput(observableList); observableList.addListChangeListener(new IListChangeListener() { @Override public void handleListChange(ListChangeEvent event) { tableviewer.getTable().getColumn(0).pack(); } }); final Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Dialog dialog = new Dialog(buttonComp.getShell()) { private Text key; private Text value; @Override protected Control createDialogArea(Composite parent) { getShell().setText(Messages.ControlFactory_KeyValueShellTitle); Composite comp = (Composite) super.createDialogArea(parent); Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); Label l = new Label(container, SWT.NONE); l.setText(Messages.ControlFactory_Key); key = new Text(container, SWT.BORDER); key.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l = new Label(container, SWT.NONE); l.setText(Messages.ControlFactory_Value); value = new Text(container, SWT.BORDER); value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return comp; } @Override protected void okPressed() { if (key.getText().trim().length() > 0) { BasicEMap.Entry<String, String> entry = (org.eclipse.emf.common.util.BasicEMap.Entry<String, String>) ApplicationFactoryImpl.eINSTANCE .createStringToStringMap(); entry.setHash(key.hashCode()); entry.setKey(key.getText()); entry.setValue(value.getText().trim().length() > 0 ? value.getText() : null); Command cmd = AddCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, entry); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); super.okPressed(); } } } }; dialog.open(); } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) tableviewer.getSelection(); if (!selection.isEmpty()) { Command cmd = RemoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, selection.toList()); if (cmd.canExecute()) { editor.getEditingDomain().getCommandStack().execute(cmd); } } } }); }