List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:org.eclipse.mylyn.internal.sandbox.ui.highlighters.EditHighlightersAction.java
License:Open Source License
@Override public void run() { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ID_PREFS_HIGHLIGHTERS, new String[] { ID_PREFS_HIGHLIGHTERS }, null); dlg.open(); }
From source file:org.eclipse.mylyn.internal.tasks.ui.actions.OpenTasksUiPreferencesAction.java
License:Open Source License
@Override public void run() { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TasksUiPreferencePage.ID, new String[] { TasksUiPreferencePage.ID }, null); dlg.open(); }
From source file:org.eclipse.mylyn.internal.tasks.ui.dialogs.UiLegendControl.java
License:Open Source License
private void createActivitySection(Composite parent) { Section activitySection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR); activitySection.setText(Messages.UiLegendControl_Task_Activity); activitySection.setLayout(new TableWrapLayout()); activitySection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); TableWrapLayout layout = new TableWrapLayout(); layout.numColumns = 2;/*from w w w.ja v a 2 s .c o m*/ layout.makeColumnsEqualWidth = false; layout.verticalSpacing = 1; layout.topMargin = 1; layout.bottomMargin = 1; Composite activityClient = toolkit.createComposite(activitySection); activityClient.setLayout(layout); activityClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); activitySection.setClient(activityClient); Label imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK)); Label labelToday = toolkit.createLabel(activityClient, Messages.UiLegendControl_Scheduled_for_today); labelToday.setForeground( themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_SCHEDULED_TODAY)); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK)); Label labelOverdue = toolkit.createLabel(activityClient, Messages.UiLegendControl_Past_scheduled_date); labelOverdue.setForeground( themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_SCHEDULED_PAST)); // imageLabel = toolkit.createLabel(activityClient, ""); // imageLabel.setImage(TasksUiImages.getImage(TasksUiImages.TASK)); // Label labelThisWeek = toolkit.createLabel(activityClient, "Scheduled for this // week"); // labelThisWeek.setForeground(themeManager.getCurrentTheme().getColorRegistry().get( // TaskListColorsAndFonts.THEME_COLOR_TASK_THISWEEK_SCHEDULED)); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK)); Label labelCompleted = toolkit.createLabel(activityClient, Messages.UiLegendControl_Completed); labelCompleted.setFont(CommonFonts.STRIKETHROUGH); // labelCompleted.setForeground(TaskListColorsAndFonts.COLOR_TASK_COMPLETED); labelCompleted .setForeground(themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_COMPLETED)); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK)); Label labelCompletedToday = toolkit.createLabel(activityClient, Messages.UiLegendControl_Completed_today); labelCompletedToday.setFont(CommonFonts.STRIKETHROUGH); labelCompletedToday.setForeground( themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_COMPLETED_TODAY)); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_DATE_DUE)); toolkit.createLabel(activityClient, Messages.UiLegendControl_Has_Due_date); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_DATE_OVERDUE)); Label textLabel = toolkit.createLabel(activityClient, Messages.UiLegendControl_Past_due_date); textLabel.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_OVERDUE)); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(TasksUiImages.NOTES)); toolkit.createLabel(activityClient, Messages.UiLegendControl_Notes); imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$ imageLabel.setImage(CommonImages.getImage(CommonImages.BLANK)); Hyperlink adjust = toolkit.createHyperlink(activityClient, Messages.UiLegendControl_Adjust_Colors_and_Fonts_, SWT.WRAP); adjust.addHyperlinkListener(new IHyperlinkListener() { public void linkActivated(HyperlinkEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ITasksUiConstants.ID_PREFERENCES_COLORS_AND_FONTS, new String[] { ITasksUiConstants.ID_PREFERENCES_COLORS_AND_FONTS }, null); dlg.open(); } public void linkEntered(HyperlinkEvent e) { // ignore } public void linkExited(HyperlinkEvent e) { // ignore } }); }
From source file:org.eclipse.mylyn.internal.team.ui.properties.ProjectTeamPage.java
License:Open Source License
private void createDescription(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.marginHeight = 0;/*from ww w . j ava2 s.c o m*/ layout.marginWidth = 0; layout.numColumns = 2; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); useProjectSettings = new Button(composite, SWT.CHECK); useProjectSettings.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!ignoreModifyEvents) { modified = true; } setPropertiesEnabled(useProjectSettings.getSelection()); } }); useProjectSettings.setText(Messages.ProjectTeamPage_Enable_project_specific_settings); GridDataFactory.fillDefaults().grab(true, false).applyTo(useProjectSettings); configurationHyperlink = new Hyperlink(composite, SWT.NONE); configurationHyperlink.setUnderlined(true); configurationHyperlink.setText(Messages.ProjectTeamPage_Configure_workspace); configurationHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), FocusedTeamPreferencePage.PAGE_ID, new String[] { FocusedTeamPreferencePage.PAGE_ID }, null); dlg.open(); } }); Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); horizontalLine.setFont(composite.getFont()); }
From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java
License:Open Source License
private void createProxySection() { ExpandableComposite section = createSection(innerComposite, Messages.AbstractRepositorySettingsPage_Proxy_Server_Configuration); proxyAuthComp = toolkit.createComposite(section, SWT.NONE); GridLayout gridLayout2 = new GridLayout(); gridLayout2.verticalSpacing = 0;/*from www.j a v a2 s .c o m*/ gridLayout2.numColumns = 3; proxyAuthComp.setLayout(gridLayout2); proxyAuthComp.setBackground(compositeContainer.getBackground()); section.setClient(proxyAuthComp); Composite systemSettingsComposite = new Composite(proxyAuthComp, SWT.NULL); GridLayout gridLayout3 = new GridLayout(); gridLayout3.verticalSpacing = 0; gridLayout3.numColumns = 2; gridLayout3.marginWidth = 0; systemSettingsComposite.setLayout(gridLayout3); systemProxyButton = new Button(systemSettingsComposite, SWT.CHECK); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT) .applyTo(systemSettingsComposite); systemProxyButton .setText(Messages.AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences); systemProxyButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { setUseDefaultProxy(systemProxyButton.getSelection()); } public void widgetDefaultSelected(SelectionEvent e) { // ignore } }); changeProxySettingsLink = toolkit.createHyperlink(systemSettingsComposite, Messages.AbstractRepositorySettingsPage_Change_Settings, SWT.NULL); changeProxySettingsLink.setBackground(compositeContainer.getBackground()); changeProxySettingsLink.addHyperlinkListener(new IHyperlinkListener() { public void linkActivated(HyperlinkEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_PROXY, new String[] { PREFS_PAGE_ID_NET_PROXY }, null); dlg.open(); } public void linkEntered(HyperlinkEvent e) { // ignore } public void linkExited(HyperlinkEvent e) { // ignore } }); proxyHostnameEditor = new StringFieldEditor("", Messages.AbstractRepositorySettingsPage_Proxy_host_address_, //$NON-NLS-1$ StringFieldEditor.UNLIMITED, proxyAuthComp) { @Override protected boolean doCheckState() { return true; } @Override protected void valueChanged() { super.valueChanged(); if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } @Override public int getNumberOfControls() { return 3; } }; proxyHostnameEditor.setStringValue(oldProxyHostname); proxyPortEditor = new RepositoryStringFieldEditor("", //$NON-NLS-1$ Messages.AbstractRepositorySettingsPage_Proxy_host_port_, StringFieldEditor.UNLIMITED, proxyAuthComp) { @Override protected boolean doCheckState() { return true; } @Override protected void valueChanged() { super.valueChanged(); if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } @Override public int getNumberOfControls() { return 3; } }; proxyPortEditor.setStringValue(oldProxyPort); proxyHostnameEditor.setEnabled(systemProxyButton.getSelection(), proxyAuthComp); proxyPortEditor.setEnabled(systemProxyButton.getSelection(), proxyAuthComp); // ************* PROXY AUTHENTICATION ************** proxyAuthButton = new Button(proxyAuthComp, SWT.CHECK); GridDataFactory.fillDefaults().span(3, SWT.DEFAULT).applyTo(proxyAuthButton); proxyAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_proxy_authentication); proxyAuthButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { setProxyAuth(proxyAuthButton.getSelection()); } public void widgetDefaultSelected(SelectionEvent e) { // ignore } }); proxyUserNameEditor = new StringFieldEditor("", Messages.AbstractRepositorySettingsPage_User_ID_, //$NON-NLS-1$ StringFieldEditor.UNLIMITED, proxyAuthComp) { @Override protected boolean doCheckState() { return true; } @Override protected void valueChanged() { super.valueChanged(); if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } @Override public int getNumberOfControls() { return 3; } }; proxyPasswordEditor = new RepositoryStringFieldEditor("", Messages.AbstractRepositorySettingsPage_Password_, //$NON-NLS-1$ StringFieldEditor.UNLIMITED, proxyAuthComp) { @Override public int getNumberOfControls() { return 2; } }; ((RepositoryStringFieldEditor) proxyPasswordEditor).getTextControl().setEchoChar('*'); // proxyPasswordEditor.setEnabled(httpAuthButton.getSelection(), // advancedComp); // ((StringFieldEditor) // httpAuthPasswordEditor).setEnabled(httpAuthButton.getSelection(), // advancedComp); // need to increase column number here, because above string editor will use them if declared beforehand ((GridLayout) (proxyAuthComp.getLayout())).numColumns++; saveProxyPasswordButton = new Button(proxyAuthComp, SWT.CHECK); saveProxyPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password); saveProxyPasswordButton.setEnabled(proxyAuthButton.getSelection()); if (repository != null) { saveProxyPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.PROXY)); } else { saveProxyPasswordButton.setSelection(false); } setProxyAuth(oldProxyUsername != null || oldProxyPassword != null); setUseDefaultProxy(repository != null ? repository.isDefaultProxyEnabled() : true); section.setExpanded(!systemProxyButton.getSelection()); }
From source file:org.eclipse.n4js.ui.binaries.IllegalBinaryStateDialog.java
License:Open Source License
/** * Creates a control with some message and with link to the Binaries preference page. * * @param parent// ww w.j av a 2 s .co m * the parent composite. * @param dialog * the container dialog that has to be closed. * @param binary * the binary with the illegal state. * * @return a control with error message and link that can be reused in dialogs. */ public static Control createCustomAreaWithLink(final Composite parent, final Dialog dialog, final Binary binary) { final String binaryLabel = binary.getLabel(); final String prefix = "The requested operation cannot be performed due to invalid '" + binaryLabel + "' settings. Check your '" + binaryLabel + "' configuration and preferences under the corresponding "; final String link = "preference page"; final String suffix = "."; final String text = prefix + link + suffix; final Composite control = new Composite(parent, NONE); control.setLayout(GridLayoutFactory.fillDefaults().create()); final GridData gridData = GridDataFactory.fillDefaults().align(LEFT, TOP).grab(true, true).create(); control.setLayoutData(gridData); final StyleRange style = new StyleRange(); style.underline = true; style.underlineStyle = UNDERLINE_LINK; final StyledText styledText = new StyledText(control, MULTI | READ_ONLY | WRAP); styledText.setWordWrap(true); styledText.setJustify(true); styledText.setText(text); final GridData textGridData = GridDataFactory.fillDefaults().align(FILL, FILL).grab(true, true).create(); textGridData.widthHint = TEXT_WIDTH_HINT; textGridData.heightHint = TEXT_HEIGHT_HINT; styledText.setLayoutData(textGridData); styledText.setEditable(false); styledText.setBackground(UIUtils.getSystemColor(COLOR_WIDGET_BACKGROUND)); final int[] ranges = { text.indexOf(link), link.length() }; final StyleRange[] styles = { style }; styledText.setStyleRanges(ranges, styles); styledText.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent event) { try { final int offset = styledText.getOffsetAtPoint(new Point(event.x, event.y)); final StyleRange actualStyle = offset >= 0 ? styledText.getStyleRangeAtOffset(offset) : null; if (null != actualStyle && actualStyle.underline && UNDERLINE_LINK == actualStyle.underlineStyle) { dialog.close(); final PreferenceDialog preferenceDialog = createPreferenceDialogOn(UIUtils.getShell(), BinariesPreferencePage.ID, FILTER_IDS, null); if (null != preferenceDialog) { preferenceDialog.open(); } } } catch (final IllegalArgumentException e) { // We are not over the actual text. } } }); return control; }
From source file:org.eclipse.ocl.common.ui.internal.preferences.AbstractProjectPreferencePage.java
License:Open Source License
/** * When the project-specific link is activated, install the project-specific property page. *//*ww w.j av a2s .com*/ final void doLinkActivated(Link link) { IPreferencePage page = createClonePage(); page.setTitle(getTitle()); final IPreferenceNode targetNode = new PreferenceNode(pluginId, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
From source file:org.eclipse.oomph.setup.ui.recorder.RecorderManager.java
License:Open Source License
public void record(IEditorPart editor) { this.editor = editor; final boolean wasEnabled = isRecorderEnabled(); setRecorderEnabled(true);// w w w .ja v a 2 s. com // Defer this until the transaction has been processed. reset = new Runnable() { public void run() { RecorderManager.this.editor = null; setRecorderEnabled(wasEnabled); reset = null; } }; PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, null, null, null); dialog.open(); }
From source file:org.eclipse.papyrus.infra.services.validation.commands.SelectAndValidateModelCommand.java
License:Open Source License
/** * {@inheritDoc}//from w ww.jav a2 s. c o m */ @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { String idRootPage = "org.eclipse.emf.validation.ui.rootPage"; String idConstraints = "org.eclipse.emf.validation.constraintsPrefs"; String filter[] = { idRootPage, idConstraints }; PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, idConstraints, filter, null); int result = dialog.open(); if (result == IDialogConstants.OK_ID) { EObject selectedObject = selectedElement; // replace selection by model instead of current selection while (selectedObject.eContainer() != null) { selectedObject = selectedObject.eContainer(); } Resource resource = getResource(); if ((resource != null) && (eclipseResourcesUtil != null)) { eclipseResourcesUtil.deleteMarkers(getResource()); } runValidation(selectedObject); } return null; }
From source file:org.eclipse.papyrus.infra.services.validation.commands.SelectAndValidateSubtreeCommand.java
License:Open Source License
/** * {@inheritDoc}// w w w . java2 s.c o m */ @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { String idRootPage = "org.eclipse.emf.validation.ui.rootPage"; String idConstraints = "org.eclipse.emf.validation.constraintsPrefs"; String filter[] = { idRootPage, idConstraints }; PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, idConstraints, filter, null); int result = dialog.open(); if (result == IDialogConstants.OK_ID) { ValidationTool vt = new ValidationTool(selectedElement); vt.deleteSubMarkers(); runValidation(selectedElement); } return null; }