List of usage examples for org.eclipse.jface.dialogs Dialog applyDialogFont
public static void applyDialogFont(Control control)
From source file:com.aptana.ide.search.epl.filesystem.ui.text.FileSystemReplaceConfigurationPage.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) *///from w w w . ja va 2 s .c o m public void createControl(Composite parent) { Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); result.setLayout(layout); Label description = new Label(result, SWT.NONE); int numberOfMatches = fReplaceRefactoring.getNumberOfMatches(); int numberOfFiles = fReplaceRefactoring.getNumberOfFiles(); String[] arguments = { String.valueOf(numberOfMatches), String.valueOf(numberOfFiles) }; if (numberOfMatches > 1 && numberOfFiles > 1) { description.setText( Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_many, arguments)); } else if (numberOfMatches == 1) { description.setText(SearchMessages.ReplaceConfigurationPage_description_one_in_one); } else { description.setText( Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_one, arguments)); } description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); FileSearchQuery query = fReplaceRefactoring.getQuery(); Label label1 = new Label(result, SWT.NONE); label1.setText(SearchMessages.ReplaceConfigurationPage_replace_label); Text clabel = new Text(result, SWT.BORDER | SWT.READ_ONLY); clabel.setText(query.getSearchString()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(50); clabel.setLayoutData(gd); Label label2 = new Label(result, SWT.NONE); label2.setText(SearchMessages.ReplaceConfigurationPage_with_label); fTextField = new Combo(result, SWT.DROP_DOWN); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(50); fTextField.setLayoutData(gd); fTextField.setFocus(); fTextField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { updateOKStatus(); } }); IDialogSettings settings = SearchPlugin.getDefault().getDialogSettings().getSection(SETTINGS_GROUP); if (settings != null) { String[] previousReplaceWith = settings.getArray(SETTINGS_REPLACE_WITH); if (previousReplaceWith != null) { fTextField.setItems(previousReplaceWith); fTextField.select(0); } } ComboContentAdapter contentAdapter = new ComboContentAdapter(); FindReplaceDocumentAdapterContentProposalProvider replaceProposer = new FindReplaceDocumentAdapterContentProposalProvider( false); fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[] { '$', '\\' }, true); new Label(result, SWT.NONE); fReplaceWithRegex = new Button(result, SWT.CHECK); fReplaceWithRegex.setText(SearchMessages.ReplaceConfigurationPage_isRegex_label); fReplaceWithRegex.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setContentAssistsEnablement(fReplaceWithRegex.getSelection()); } }); if (query.isRegexSearch()) { fReplaceWithRegex.setSelection(true); } else { fReplaceWithRegex.setSelection(false); fReplaceWithRegex.setEnabled(false); } fStatusLabel = new Label(result, SWT.NULL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.verticalAlignment = SWT.BOTTOM; gd.horizontalSpan = 2; fStatusLabel.setLayoutData(gd); setContentAssistsEnablement(fReplaceWithRegex.getSelection()); setControl(result); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ISearchHelpContextIds.REPLACE_DIALOG); }
From source file:com.aptana.ide.ui.editors.preferences.formatter.ProjectSelectionDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//*w w w .j a v a 2s . c o m*/ protected Control createDialogArea(Composite parent) { // page group Composite composite = (Composite) super.createDialogArea(parent); Font font = parent.getFont(); composite.setFont(font); createMessageArea(composite); fTableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { doSelectionChanged(((IStructuredSelection) event.getSelection()).toArray()); } }); fTableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { okPressed(); } }); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; fTableViewer.getTable().setLayoutData(data); fTableViewer.setLabelProvider(new WorkbenchLabelProvider()); fTableViewer.setContentProvider(new ArrayContentProvider()); fTableViewer.getControl().setFont(font); Button checkbox = new Button(composite, SWT.CHECK); checkbox.setText(Messages.getString("ProjectSelectionDialog.2")); //$NON-NLS-1$ checkbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false)); checkbox.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { updateFilter(((Button) e.widget).getSelection()); } public void widgetDefaultSelected(SelectionEvent e) { updateFilter(((Button) e.widget).getSelection()); } }); IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); boolean doFilter = !dialogSettings.getBoolean(DIALOG_SETTINGS_SHOW_ALL) && !fProjectsWithSpecifics.isEmpty(); checkbox.setSelection(doFilter); updateFilter(doFilter); IProject[] input = ResourcesPlugin.getWorkspace().getRoot().getProjects(); fTableViewer.setInput(input); doSelectionChanged(new Object[0]); Dialog.applyDialogFont(composite); return composite; }
From source file:com.aptana.ide.ui.editors.preferences.formatter.PropertyAndPreferencePage.java
License:Open Source License
/** * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */// w w w . ja v a2 s . c om protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setFont(parent.getFont()); GridData data = new GridData(GridData.FILL, GridData.FILL, true, true); fConfigurationBlockControl = createPreferenceContent(composite); fConfigurationBlockControl.setLayoutData(data); if (isProjectPreferencePage()) { boolean useProjectSettings = hasProjectSpecificOptions(getProject()); enableProjectSpecificSettings(useProjectSettings); } Dialog.applyDialogFont(composite); return composite; }
From source file:com.aptana.ide.ui.io.dialogs.CloakExpressionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); Label label = new Label(main, SWT.NONE); label.setText(Messages.CloakExpressionDialog_LBL_Expression); label.setLayoutData(GridDataFactory.swtDefaults().create()); expressionText = new Text(main, SWT.SINGLE | SWT.BORDER); expressionText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); expressionText.setText(expression);// w w w . j a v a 2 s . c o m expressionText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { getButton(IDialogConstants.OK_ID).setEnabled(!StringUtil.isEmpty(expressionText.getText())); } }); Dialog.applyDialogFont(main); setTitle(Messages.CloakExpressionDialog_LBL_Title); setMessage(Messages.CloakExpressionDialog_LBL_Message); return main; }
From source file:com.aptana.ide.ui.io.properties.FileInfoPropertyPage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { // first try to adapt to IFileStore directly final IFileStore fileStore = Utils.getFileStore(getElement()); if (fileStore == null) { Label label = new Label(parent, SWT.NONE); label.setText(IDEWorkbenchMessages.ResourceInfoPage_noResource); return label; }//from ww w . j av a 2 s .com try { if (getElement().getAdapter(File.class) != null) { fFileInfo = fileStore.fetchInfo(EFS.NONE, new NullProgressMonitor()); } else { final IFileInfo[] result = new IFileInfo[1]; ProgressMonitorDialog dlg = new ProgressMonitorDialog(parent.getShell()); try { dlg.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { result[0] = fileStore.fetchInfo(IExtendedFileStore.DETAILED, monitor); } catch (CoreException e) { throw new InvocationTargetException(e, e.getLocalizedMessage()); } finally { monitor.done(); } } }); } catch (InvocationTargetException e) { throw (CoreException) e.getTargetException(); } catch (InterruptedException e) { e.getCause(); } fFileInfo = result[0]; } } catch (CoreException e) { UIUtils.showErrorMessage(Messages.FileInfoPropertyPage_FailedToFetchInfo, e); } if (fFileInfo == null) { Label label = new Label(parent, SWT.NONE); label.setText(IDEWorkbenchMessages.ResourceInfoPage_noResource); return label; } Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(GridLayoutFactory.swtDefaults().margins(0, 0).create()); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Composite basicInfo = createBasicInfoGroup(composite, fileStore, fFileInfo); basicInfo.setLayoutData(GridDataFactory.fillDefaults().create()); Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Composite state = createStateGroup(composite, fileStore, fFileInfo); state.setLayoutData(GridDataFactory.fillDefaults().create()); if (fFileInfo instanceof IExtendedFileInfo) { IExtendedFileInfo extendedInfo = (IExtendedFileInfo) fFileInfo; Composite owner = createOwnerGroup(composite, extendedInfo); owner.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(0, 10).create()); Composite permissions = createPermissionsGroup(composite, extendedInfo); permissions.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(0, 5).create()); } /* * TODO new Label(composite, SWT.NONE); // a vertical spacer encodingEditor = new EncodingFieldEditor("", * fileInfo.isDirectory() ? IDEWorkbenchMessages.ResourceInfo_fileEncodingTitle : * IDEWorkbenchMessages.WorkbenchPreference_encoding, composite); encodingEditor.setPreferenceStore(null); * encodingEditor.setPage(this); encodingEditor.load(); encodingEditor.setPropertyChangeListener(new * IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if * (event.getProperty().equals(FieldEditor.IS_VALID)) { setValid(encodingEditor.isValid()); } } }); if * (fileInfo.isDirectory()) { lineDelimiterEditor = new LineDelimiterEditor(composite, resource.getProject()); * lineDelimiterEditor.doLoad(); } */ Dialog.applyDialogFont(composite); return composite; }
From source file:com.aptana.ide.update.preferences.AutomaticUpdatesPreferencePage.java
License:Open Source License
/** * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */// www. j a v a2 s. c o m protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; container.setLayout(layout); Link link = new Link(container, SWT.NULL); link.setText(Messages.AutomaticUpdatesPreferencePage_UseP2UpdatePreferences); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(getShell(), getPluginManager().getUpdatePreferencePageId(), null, null); } }); createSpacer(container, 1); Group updateTypeGroup = new Group(container, SWT.NONE); updateTypeGroup.setText(Messages.AutomaticUpdatesPreferencePage_WhatTypesOfUpdates); layout = new GridLayout(); layout.numColumns = 3; updateTypeGroup.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); updateTypeGroup.setLayoutData(gd); Label basicLabel = new Label(updateTypeGroup, SWT.NONE); basicLabel.setText(Messages.AutomaticUpdatesPreferencePage_AptanaWillDownloadOnNextRestart); basicLabel.setFont(SWTUtils.getDefaultSmallFont()); gd = new GridData(); gd.horizontalSpan = 3; gd.verticalIndent = 10; basicLabel.setLayoutData(gd); // boolean isEnabled = CoreUIPlugin.isKeyValid(); boolean isEnabled = true; basicLabel.setEnabled(isEnabled); SelectionAdapter adapter = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { pageChanged(); } }; currentRadio = new Button(updateTypeGroup, SWT.RADIO); currentRadio.setText(Messages.AutomaticUpdatesPreferencePage_StableReleasesOnly); gd = new GridData(); gd.horizontalSpan = 3; currentRadio.setLayoutData(gd); currentRadio.addSelectionListener(adapter); currentRadio.setEnabled(isEnabled); nextRadio = new Button(updateTypeGroup, SWT.RADIO); nextRadio.setText(Messages.AutomaticUpdatesPreferencePage_NextCandidateBuilds); gd = new GridData(); gd.horizontalSpan = 3; nextRadio.setLayoutData(gd); nextRadio.addSelectionListener(adapter); nextRadio.setEnabled(isEnabled); nightlyRadio = new Button(updateTypeGroup, SWT.RADIO); nightlyRadio.setText(Messages.AutomaticUpdatesPreferencePage_NightlyBuilds); gd = new GridData(); gd.horizontalSpan = 3; nightlyRadio.setLayoutData(gd); nightlyRadio.addSelectionListener(adapter); nightlyRadio.setEnabled(isEnabled); Label developerLabel = new Label(updateTypeGroup, SWT.NONE); developerLabel.setText(Messages.AutomaticUpdatesPreferencePage_ForAdvancedUsers); developerLabel.setFont(SWTUtils.getDefaultSmallFont()); gd = new GridData(); gd.horizontalSpan = 3; gd.verticalIndent = 10; developerLabel.setLayoutData(gd); developerLabel.setEnabled(isEnabled); developerRadio = new Button(updateTypeGroup, SWT.RADIO); developerRadio.setText(Messages.AutomaticUpdatesPreferencePage_SpecifyBranchName); gd = new GridData(); gd.horizontalSpan = 2; developerRadio.setLayoutData(gd); developerRadio.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { testBranchName(); } }); developerRadio.setEnabled(isEnabled); branchText = new Text(updateTypeGroup, SWT.BORDER); gd = new GridData(); gd.grabExcessVerticalSpace = true; gd.horizontalAlignment = SWT.FILL; branchText.setLayoutData(gd); branchText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { testBranchName(); } }); branchText.setEnabled(isEnabled); initialize(); Dialog.applyDialogFont(container); return container; }
From source file:com.aptana.js.debug.ui.internal.preferences.JSDetailFormattersPreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);//from ww w. j a v a2s . c o m Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); GridDataFactory.fillDefaults().applyTo(composite); composite.setFont(parent.getFont()); createFormattersList(composite); createOptions(composite); Dialog.applyDialogFont(composite); noDefaultAndApplyButton(); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.DETAIL_FORMATTER_PREFERENCE_PAGE); return composite; }
From source file:com.aptana.php.debug.ui.launching.LaunchConfigurationsSelectionDialog.java
License:Open Source License
@SuppressWarnings({ "rawtypes", "unchecked" }) protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);//from ww w.ja v a 2 s .c o m Composite comp = (Composite) super.createDialogArea(parent); String label = getMessage(); if (!StringUtil.isEmpty(label)) { SWTFactory.createWrapLabel(comp, label, 1); } label = getViewerLabel(); if (!StringUtil.isEmpty(label)) { SWTFactory.createLabel(comp, label, 1); } fViewer = createViewer(comp); fViewer.setLabelProvider(getLabelProvider()); fViewer.setContentProvider(getContentProvider()); fViewer.setInput(getViewerInput()); List selectedElements = getInitialElementSelections(); if (!CollectionsUtil.isEmpty(selectedElements)) { fViewer.setSelection(new StructuredSelection(selectedElements)); } addViewerListeners(fViewer); addCustomFooterControls(comp); Dialog.applyDialogFont(comp); return comp; }
From source file:com.aptana.projects.internal.wizards.ProjectTemplateSelectionPage.java
License:Open Source License
public void createControl(Composite parent) { defaultTemplateImage = wizardDesc.createImage(); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (defaultTemplateImage != null) { defaultTemplateImage.dispose(); defaultTemplateImage = null; }//from www . j av a 2 s . c o m for (Image image : templateImages.values()) { if (!image.isDisposed()) { image.dispose(); } } templateImages = null; } }); Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 10).create()); main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); stepIndicatorComposite = new StepIndicatorComposite(main, stepNames); stepIndicatorComposite.setSelection(getStepName()); Label label = new Label(main, SWT.NONE); label.setText(Messages.ProjectTemplateSelectionPage_AvailableTemplates_TXT); label.setLayoutData(GridDataFactory.swtDefaults().create()); SashForm sashForm = new SashForm(main, SWT.HORIZONTAL); sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); fTemplateSelectionViewer = new TableViewer(sashForm, SWT.BORDER); fTemplateSelectionViewer.setContentProvider(new ListContentProvider()); fTemplateSelectionViewer.setLabelProvider(new ListLabelProvider()); fTemplateSelectionViewer.setInput(fTemplates); fTemplateSelectionViewer.addSelectionChangedListener(this); fPreviewText = new Label(sashForm, SWT.WRAP | SWT.READ_ONLY); // auto-selects the first one if (!ArrayUtil.isEmpty(fTemplates)) { fTemplateSelectionViewer.setSelection(new StructuredSelection(fTemplates[0])); setSelectedTemplate(fTemplates[0]); } Dialog.applyDialogFont(main); setControl(main); }
From source file:com.aptana.projects.wizards.ProjectTemplateSelectionPage.java
License:Open Source License
public void createControl(Composite parent) { defaultTemplateImage = wizardDesc.createImage(); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (defaultTemplateImage != null) { defaultTemplateImage.dispose(); defaultTemplateImage = null; }//from ww w. j a v a 2s. co m for (Image image : templateImages.values()) { if (!image.isDisposed()) { image.dispose(); } } templateImages = null; } }); Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 10).create()); main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); stepIndicatorComposite = new StepIndicatorComposite(main, stepNames); stepIndicatorComposite.setSelection(getStepName()); Label label = new Label(main, SWT.NONE); label.setText(Messages.ProjectTemplateSelectionPage_AvailableTemplates_TXT); label.setLayoutData(GridDataFactory.swtDefaults().create()); Composite templateList = createTemplatesList(main); templateList.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // go through each tag and auto-select the first default template found; otherwise selects the first template in // the first tag if (!ArrayUtil.isEmpty(fTemplates)) { boolean foundDefault = false; TableItem[] items = tagsListViewer.getTable().getItems(); for (TableItem item : items) { String tag = item.getText(); List<IProjectTemplate> templates = templateTagsMap.get(tag); for (IProjectTemplate template : templates) { if (template instanceof IDefaultProjectTemplate) { foundDefault = true; setSelectedTemplate(tag, template); break; } } if (foundDefault) { break; } } if (!foundDefault) { String tag = items[0].getText(); setSelectedTemplate(tag, templateTagsMap.get(tag).get(0)); } } // Let left/right arrow keys traverse "list" of templates KeyListener keyListener = new KeyListener() { public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_RIGHT) { setSelectedTemplate(getNextTemplate(fSelectedTemplate)); } else if (e.keyCode == SWT.ARROW_LEFT) { setSelectedTemplate(getPreviousTemplate(fSelectedTemplate)); } } }; // When template list has focus this takes effect templatesListComposite.addKeyListener(keyListener); // When tag list has focus, still let left/right key listener work tagsListViewer.getTable().addKeyListener(keyListener); tagsListViewer.getTable().setFocus(); Dialog.applyDialogFont(main); setControl(main); }