List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN
int VERTICAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN.
Click Source Link
From source file:org.eclipse.cdt.internal.ui.preferences.PathEntryVariableDialog.java
License:Open Source License
/** * Creates and configures this dialog's main composite. * //from w ww . j a va2s.c o m * @param parentComposite parent's composite * @return this dialog's main composite */ private Composite createComposite(Composite parentComposite) { // creates a composite with standard margins and spacing Composite contents = new Composite(parentComposite, SWT.NONE); FormLayout layout = new FormLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); contents.setLayout(layout); contents.setFont(parentComposite.getFont()); if (newVariable) setTitle(PreferencesMessages.PathEntryVariableDialog_dialogTitle_newVariable); else setTitle(PreferencesMessages.PathEntryVariableDialog_dialogTitle_existingVariable); setMessage(standardMessage); return contents; }
From source file:org.eclipse.cdt.internal.ui.preferences.ScalabilityPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);/* www .ja va 2 s. co m*/ int nColumns = 1; Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.numColumns = nColumns; composite.setLayout(layout); GridData data = new GridData(); data.verticalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL; composite.setLayoutData(data); createDetectionSettings(composite); new Separator().doFillIntoGrid(composite, nColumns); createScalabilityModeSettings(composite); new Separator().doFillIntoGrid(composite, nColumns); String noteTitle = PreferencesMessages.ScalabilityPreferencePage_note; String noteMessage = PreferencesMessages.ScalabilityPreferencePage_preferenceOnlyForNewEditors; Composite noteControl = createNoteComposite(JFaceResources.getDialogFont(), composite, noteTitle, noteMessage); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; noteControl.setLayoutData(gd); initFields(); Dialog.applyDialogFont(composite); return composite; }
From source file:org.eclipse.cdt.internal.ui.preferences.WorkInProgressPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);//from w ww . ja v a 2s.c o m Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(10); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); result.setLayout(layout); // Add your controls here applyDialogFont(result); return result; }
From source file:org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. *//* www .ja va 2s.c om*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = CUIPlugin.getActiveWorkbenchShell(); String title = ContentAssistMessages.ContentAssistProcessor_all_disabled_title; String message = ContentAssistMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( ContentAssistMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /* * @see org.eclipse.cdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ @Override protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.cdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.cdt.launchbar.ui.internal.dialogs.LaunchConfigurationEditDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { // Clone super's implementation, removes the monitor since we don't run from here // And adds in the left button bar. Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*from www .j a v a 2 s . c o m*/ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(font); // create help control if needed if (isHelpAvailable()) { createHelpControl(composite); } Composite leftButtonComp = new Composite(composite, SWT.NULL); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.numColumns = 0; leftButtonComp.setLayout(layout); leftButtonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); leftButtonComp.setFont(parent.getFont()); createButton(leftButtonComp, DELETE_ID, "Delete", false); createButton(leftButtonComp, DUPLICATE_ID, "Duplicate", false); createButton(leftButtonComp, LAUNCH_ID, "Launch", false); Composite mainButtonComp = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.numColumns = 0; mainButtonComp.setLayout(layout); mainButtonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); mainButtonComp.setFont(parent.getFont()); createButton(mainButtonComp, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(mainButtonComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); return composite; }
From source file:org.eclipse.common_prefs.preferences.CommonPrefPreferencePage.java
License:Open Source License
protected Control createGeneralPage(Composite parent) { // Create the main composite Composite prefPage = new Composite(parent, SWT.NONE); GridData gdpp = new GridData(SWT.LEFT, SWT.TOP, false, false); prefPage.setLayoutData(gdpp);//from www .j a v a 2 s . c o m GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.numColumns = 1; prefPage.setLayout(layout); initializeDialogUnits(prefPage); // Add a label text describing the purpose of the Common Prefs prefGenInfoText = new Label(prefPage, SWT.WRAP); prefGenInfoText.setText(getGenInfoText()); GridData gdcpl = new GridData(SWT.LEFT, SWT.TOP, false, false); prefGenInfoText.setLayoutData(gdcpl); prefLoadButton = new Button(prefPage, SWT.CHECK); prefLoadButton.setText("Enable reading of preference files"); prefLoadButton.setSelection(getEnbleRead()); GridData gdlb = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); gdlb.verticalIndent = 16; prefLoadButton.setLayoutData(gdlb); prefLoadButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { updateImportEnablement(); } }); /* // Add a text input for setting timeout for http input // TODO: Not completed - need add of column. and property Label prefTimeoutLbl = new Label(prefPage, 0); prefTimeoutLbl.setText("Timeout for getting http files"); GridData ptlpl = new GridData(SWT.LEFT, SWT.TOP, false, false); prefTimeoutLbl.setLayoutData(ptlpl); Text prefTimeoutText = new Text(prefPage, SWT.SINGLE | SWT.LEFT); // prefTimeoutText.setText("Enable reading of preference files"); GridData ptlb = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); ptlb.verticalIndent = 16; prefTimeoutText.setLayoutData(ptlb); */ // ====================================== // Add a table for editing the pref files // New composite for handling the controls Composite inner = new Composite(prefPage, SWT.NULL); inner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); GridLayout layoutInner = new GridLayout(3, false); layoutInner.marginHeight = 0; layoutInner.marginWidth = 0; inner.setLayout(layoutInner); prefPathTable = new Table(inner, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER /*| SWT.CHECK*/); prefPathTable.setHeaderVisible(true); GridData gdpt = new GridData(SWT.FILL, SWT.FILL, true, true); gdpt.horizontalSpan = 2; gdpt.verticalSpan = 6; prefPathTable.setLayoutData(gdpt); prefPathTable.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { updateTableSize(prefPathTable); } }); prefPathTable.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { /* Display d = getShell().getDisplay(); Point pGlobal = d.getCursorLocation(); Point p = d.map(null, prefPathTable, pGlobal); // TODO: Check which column the user clicked in and if in the Type // column, create an editor for that item. Find example in Eclipse. // Now using a separate combobox instead. Not as elegant, but working */ updateImportEnablement(); } }); new TableColumn(prefPathTable, SWT.NULL); new TableColumn(prefPathTable, SWT.NULL); TableColumn[] columns = prefPathTable.getColumns(); columns[0].setResizable(true); columns[1].setResizable(true); columns[0].setText("Preference files"); columns[1].setText("Type"); // ====================================== // Add buttons prefFileUpButton = new Button(inner, SWT.PUSH); prefFileUpButton.setText("Move Up"); GridData gdub = new GridData(SWT.LEFT, SWT.TOP, false, false); int btnWidthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); gdub.widthHint = Math.max(btnWidthHint, prefFileUpButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); prefFileUpButton.setLayoutData(gdub); prefFileUpButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { TableItem[] selItems = prefPathTable.getSelection(); if (selItems == null || selItems.length != 1) return; CommonPrefEPFResource pfMov = (CommonPrefEPFResource) selItems[0].getData(); CommonPrefEPFResources prefFiles = StartupPlugin.getDefault().getCommonPrefFiles(null); if (prefFiles.movePrefFile(pfMov, false)) updatePrefFileTable(pfMov); } }); prefFileDownButton = new Button(inner, SWT.PUSH); prefFileDownButton.setText("Move Down"); GridData gddb = new GridData(SWT.LEFT, SWT.TOP, false, false); gddb.widthHint = Math.max(btnWidthHint, prefFileDownButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); prefFileDownButton.setLayoutData(gddb); prefFileDownButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { TableItem[] selItems = prefPathTable.getSelection(); if (selItems == null || selItems.length != 1) return; CommonPrefEPFResource pfMov = (CommonPrefEPFResource) selItems[0].getData(); CommonPrefEPFResources prefFiles = StartupPlugin.getDefault().getCommonPrefFiles(null); if (prefFiles.movePrefFile(pfMov, true)) updatePrefFileTable(pfMov); } }); prefFileAddButton = new Button(inner, SWT.PUSH); prefFileAddButton.setText("Add..."); GridData gdab = new GridData(SWT.LEFT, SWT.TOP, false, false); gdab.widthHint = Math.max(btnWidthHint, prefFileAddButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); prefFileAddButton.setLayoutData(gdab); prefFileAddButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { // Get selection CommonPrefEPFResource selectedPrefFile = null; TableItem[] selItems = prefPathTable.getSelection(); if (selItems != null && selItems.length == 1) selectedPrefFile = (CommonPrefEPFResource) selItems[0].getData(); // Create and open dialog PrefFileDialog pfd = new PrefFileDialog(getShell(), PrefFileDialogType.PREF_FILE_ADD, selectedPrefFile); int res = pfd.open(); if (res != Dialog.OK) return; CommonPrefEPFResource pf = pfd.getValue(); updatePrefFileTable(pf); } }); prefFileEditButton = new Button(inner, SWT.PUSH); prefFileEditButton.setText("Edit..."); GridData gdeb = new GridData(SWT.LEFT, SWT.TOP, false, false); gdeb.widthHint = Math.max(btnWidthHint, prefFileEditButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); prefFileEditButton.setLayoutData(gdeb); prefFileEditButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { // Get selection CommonPrefEPFResource selectedPrefFile = null; TableItem[] selItems = prefPathTable.getSelection(); if (selItems != null && selItems.length == 1) selectedPrefFile = (CommonPrefEPFResource) selItems[0].getData(); if (selectedPrefFile == null) return; // Create and open dialog PrefFileDialog pfd = new PrefFileDialog(getShell(), PrefFileDialogType.PREF_FILE_EDIT, selectedPrefFile); int res = pfd.open(); if (res != Dialog.OK) return; CommonPrefEPFResource pf = pfd.getValue(); updatePrefFileTable(pf); } }); prefFileRemoveButton = new Button(inner, SWT.PUSH); prefFileRemoveButton.setText("Remove"); GridData gdrb = new GridData(SWT.LEFT, SWT.TOP, false, false); gdrb.widthHint = Math.max(btnWidthHint, prefFileRemoveButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); prefFileRemoveButton.setLayoutData(gdrb); prefFileRemoveButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { TableItem[] selItems = prefPathTable.getSelection(); if (selItems == null || selItems.length == 0) return; boolean needUpdate = false; CommonPrefEPFResources prefFiles = StartupPlugin.getDefault().getCommonPrefFiles(null); for (TableItem item : selItems) { CommonPrefEPFResource pf = (CommonPrefEPFResource) item.getData(); boolean okToRemove = true; if (okToRemove && prefFiles.removePrefFile(pf)) needUpdate = true; } if (needUpdate) updatePrefFileTable(null); } }); prefFileLoadButton = new Button(inner, SWT.PUSH); prefFileLoadButton.setText("Load..."); GridData gdflb = new GridData(SWT.LEFT, SWT.TOP, false, false); gdflb.verticalIndent = 16; gdflb.widthHint = Math.max(btnWidthHint, prefFileLoadButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); prefFileLoadButton.setLayoutData(gdflb); prefFileLoadButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { boolean ok = MessageDialog.openQuestion(getShell(), "Load selected preferences?", "This will load the preferences in the selected file.\n\n" + "NOTE: To see changed preferences you might need to reopen\n" + "the preferences dialog.\n\n" + "OK to proceed?"); if (!ok) return; TableItem[] selItems = prefPathTable.getSelection(); if (selItems == null || selItems.length != 1) return; CommonPrefEPFResource pf = (CommonPrefEPFResource) selItems[0].getData(); IStatus s = CommonPrefsHelper.loadPreferenceFile(pf, null); if (!(s.getSeverity() == IStatus.INFO || s.isOK())) { ErrorDialog.openError(getShell(), "Preference Load failed", "One or more errors ocurred when trying to import the selected preferences.", s); } } }); // ====================================== // Add combo to set init/force value Label createFileTypeLabel = new Label(inner, SWT.LEFT); createFileTypeLabel.setText("Preference File Type: "); GridData gdftl = new GridData(SWT.LEFT, SWT.TOP, false, true); gdftl.verticalIndent = 2; createFileTypeLabel.setLayoutData(gdftl); prefFileTypeCombo = new Combo(inner, SWT.DROP_DOWN); GridData gdftc = new GridData(SWT.LEFT, SWT.TOP, false, true); prefFileTypeCombo.setLayoutData(gdftc); prefFileTypeCombo.add("init", INIT_INX); prefFileTypeCombo.add("force", FORCE_INX); prefFileTypeCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { TableItem[] selItems = prefPathTable.getSelection(); if (selItems == null || selItems.length != 1) return; CommonPrefEPFResource pf = (CommonPrefEPFResource) selItems[0].getData(); // Check if selection is changed boolean isForce = (prefFileTypeCombo.getSelectionIndex() == FORCE_INX); if (pf.isForce() == isForce) return; // Update the value of the file pf.setIsForce(isForce); updatePrefFileTable(pf); } }); // Fill in the table updatePrefFileTable(null); applyDialogFont(prefPage); return prefPage; }
From source file:org.eclipse.common_prefs.preferences.CommonPrefPreferencePage.java
License:Open Source License
protected Control createPropertiesComparePage(Composite parent) { // Create the main composite Composite prefPage = new Composite(parent, SWT.NONE); GridData gdpp = new GridData(SWT.LEFT, SWT.TOP, false, false); prefPage.setLayoutData(gdpp);/*from w ww . j a v a 2 s.c o m*/ GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.numColumns = 1; prefPage.setLayout(layout); initializeDialogUnits(prefPage); // Add a label text describing the Compare page prefCompInfoText = new Label(prefPage, SWT.WRAP); prefCompInfoText.setText(getCompInfoText()); GridData gdcpl = new GridData(SWT.LEFT, SWT.TOP, false, false); prefCompInfoText.setLayoutData(gdcpl); prefCompareCurrentButton = new Button(prefPage, SWT.CHECK); prefCompareCurrentButton.setText("Show current value for each preference key"); prefCompareCurrentButton.setSelection(getShowCurrent()); GridData gdlb = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); gdlb.verticalIndent = 16; prefCompareCurrentButton.setLayoutData(gdlb); prefCompareCurrentButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { updateCompareTree(); } }); // Create a checkboxed list of preference files prefComparePathTable = new Table(prefPage, SWT.FULL_SELECTION | SWT.BORDER | SWT.CHECK); prefComparePathTable.setHeaderVisible(true); GridData gdpt = new GridData(SWT.FILL, SWT.TOP, true, false); prefComparePathTable.setLayoutData(gdpt); prefComparePathTable.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { updateTableSize(prefComparePathTable); } }); prefComparePathTable.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // Since tree needs to be completely recreated for any change // no need to check what item that caused the selection event updateCompareTree(); } }); new TableColumn(prefComparePathTable, SWT.NULL); new TableColumn(prefComparePathTable, SWT.NULL); TableColumn[] columns = prefComparePathTable.getColumns(); columns[0].setResizable(true); columns[1].setResizable(true); columns[0].setText("Preference files"); columns[1].setText("Type"); // Create a tree showing the preferences for the selected files imPrefTree = new Tree(prefPage, SWT.MULTI | SWT.BORDER); GridData gdibst = new GridData(SWT.FILL, SWT.FILL, true, true); imPrefTree.setLayoutData(gdibst); imPrefTree.setHeaderVisible(true); imPrefTree.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { updateTreeSize(); } }); TreeColumn tc = new TreeColumn(imPrefTree, SWT.LEFT); tc.setText("Preference"); String toolTip = "The preference key. A green icon indicates that all values are\n"; toolTip += "same, a red icon indicates that one or more values differ and a blue\n"; toolTip += "icon indicates that the value is an added value (i.e. has no default)"; tc.setToolTipText(toolTip); tc.setResizable(true); initComparePage(); return prefPage; }
From source file:org.eclipse.compare.internal.patch.RetargetPatchElementDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); initializeDialogUnits(parent);/*from ww w .jav a 2s .c o m*/ getShell().setText(PatchMessages.PreviewPatchPage_RetargetPatch); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(data); //add controls to composite as necessary Label label = new Label(composite, SWT.LEFT | SWT.WRAP); label.setText(getTreeLabel()); final GridData data2 = new GridData(SWT.FILL, SWT.BEGINNING, true, false); label.setLayoutData(data2); fViewer = new TreeViewer(composite, SWT.BORDER); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = 0; gd.heightHint = 0; fViewer.getTree().setLayoutData(gd); fViewer.setContentProvider(new RetargetPatchContentProvider(fSelectedNode)); fViewer.setLabelProvider(new WorkbenchLabelProvider()); fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME)); fViewer.setInput(getViewerInput()); IResource resource = getInitialSelection(); if (resource != null) { fViewer.setSelection(new StructuredSelection(resource)); fViewer.expandToLevel(resource, 0); } setupListeners(); Dialog.applyDialogFont(composite); return parent; }
From source file:org.eclipse.datatools.sqltools.result.internal.ui.export.SaveResultSetDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { getShell().setData(HelpUtil.CONTEXT_PROVIDER_KEY, this); HelpUtil.setHelp(parent, HelpUtil.getContextId(IHelpConstants.DIALOG_SAVE_RESULTSET, ResultsViewUIPlugin.getDefault().getBundle().getSymbolicName())); // top level composite Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing Composite composite = new Composite(parentComposite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);// w w w . j ava2s. com composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Listener listener = new Listener() { public void handleEvent(Event event) { setDialogComplete(validatePage()); } }; if (_resultset != null) { _resourceGroup = new SaveResultGroup(composite, listener, Messages.SaveResultSetDialog_filename, //$NON-NLS-1$ "file", _resultset, _listener); //$NON-NLS-1$ } else if (_resultInstance != null) { _resourceGroup = new SaveResultGroup(composite, listener, Messages.SaveResultSetDialog_filename, //$NON-NLS-1$ "file", _resultInstance, _listener); //$NON-NLS-1$ } _resourceGroup.setAllowExistingResources(true); return parentComposite; }
From source file:org.eclipse.datatools.sqltools.schemaobjecteditor.ui.internal.ui.SaveAsDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { // top level composite Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing Composite composite = new Composite(parentComposite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);/*from w w w. j a va2 s . c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Listener listener = new Listener() { public void handleEvent(Event event) { setDialogComplete(validatePage()); } }; _resourceGroup = new ResourceAndContainerGroup(composite, listener, "", "file", _listener); //$NON-NLS-1$ //$NON-NLS-2$ _resourceGroup.setAllowExistingResources(true); return parentComposite; }