protected void warnAboutTypeCommentDeprecation() { String key= IUIConstants.DIALOGSTORE_TYPECOMMENT_DEPRECATED; if (OptionalMessageDialog.isDialogEnabled(key)) { TemplateStore templates= JavaPlugin.getDefault().getTemplateStore(); boolean isOldWorkspace= templates.findTemplate("filecomment") != null && templates.findTemplate("typecomment") != null; //$NON-NLS-1$ //$NON-NLS-2$ if (!isOldWorkspace) { OptionalMessageDialog.setDialogEnabled(key, false); } String title= NewWizardMessages.NewElementWizard_typecomment_deprecated_title; String message= NewWizardMessages.NewElementWizard_typecomment_deprecated_message; OptionalMessageDialog.open(key, getShell(), title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); } }
/** * Opens the dialog but only if the user hasn't choosen to hide it. * Returns <code>NOT_SHOWN</code> if the dialog was not shown. */ public static int open(String id, Shell parent, String title, Image titleImage, String message, int dialogType, String[] buttonLabels, int defaultButtonIndex) { if (!isDialogEnabled(id)) return OptionalMessageDialog.NOT_SHOWN; MessageDialog dialog= new OptionalMessageDialog(id, parent, title, titleImage, message, dialogType, buttonLabels, defaultButtonIndex); return dialog.open(); }
protected Control createCustomArea(Composite parent) { Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); fHideDialogCheckBox= new Button(composite, SWT.CHECK | SWT.LEFT); fHideDialogCheckBox.setText(CHECKBOX_TEXT); fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setDialogEnabled(fId, !((Button)e.widget).getSelection()); } }); applyDialogFont(fHideDialogCheckBox); return fHideDialogCheckBox; }
if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell= JavaPlugin.getActiveWorkbenchShell(); String title= JavaTextMessages.ContentAssistProcessor_all_disabled_title; int returnValue= dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) {
private void showSlowCleanUpDialog(final StringBuilder cleanUpNames) { if (OptionalMessageDialog.isDialogEnabled(SlowCleanUpWarningDialog.ID)) { Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); new SlowCleanUpWarningDialog(shell, FixMessages.CleanUpPostSaveListener_SlowCleanUpDialog_title, cleanUpNames.toString()).open(); } }
/** * Sets whether the optional dialog is enabled and should be shown. */ public static void setDialogEnabled(String key, boolean isEnabled) { IDialogSettings settings= getDialogSettings(); settings.put(key, !isEnabled); }
@Override protected Control createContents(Composite parent) { Control contents= super.createContents(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.SORT_MEMBERS_DIALOG); return contents; }
@Override public boolean close() { fDialogSettings.put(DIALOG_SETTINGS_SORT_ALL, fSortAllRadio.isSelected()); return super.close(); }
protected final void unhideAllDialogs() { OptionalMessageDialog.clearAllRememberedStates(); MessageDialog.openInformation(getShell(), PreferencesMessages.JavaBasePreferencePage_do_not_hide_dialog_title, PreferencesMessages.JavaBasePreferencePage_do_not_hide_dialog_message); }
super.createCustomArea(parent);
if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell= JavaPlugin.getActiveWorkbenchShell(); String title= JavaTextMessages.ContentAssistProcessor_all_disabled_title; int returnValue= dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) {
private void showSlowCleanUpDialog(final StringBuffer cleanUpNames) { if (OptionalMessageDialog.isDialogEnabled(SlowCleanUpWarningDialog.ID)) { Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); new SlowCleanUpWarningDialog(shell, FixMessages.CleanUpPostSaveListener_SlowCleanUpDialog_title, cleanUpNames.toString()).open(); } }
/** * Answers whether the optional dialog is enabled and should be shown. */ public static boolean isDialogEnabled(String key) { IDialogSettings settings= getDialogSettings(); return !settings.getBoolean(key); }
protected Control createContents(Composite parent) { Control contents= super.createContents(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.SORT_MEMBERS_DIALOG); return contents; }
@Override public boolean close() { fDialogSettings.put(DIALOG_SETTINGS_SORT_ALL, fSortAllRadio.isSelected()); return super.close(); }
protected final void unhideAllDialogs() { OptionalMessageDialog.clearAllRememberedStates(); MessageDialog.openInformation(getShell(), PreferencesMessages.JavaBasePreferencePage_do_not_hide_dialog_title, PreferencesMessages.JavaBasePreferencePage_do_not_hide_dialog_message); }
protected void warnAboutTypeCommentDeprecation() { String key= IUIConstants.DIALOGSTORE_TYPECOMMENT_DEPRECATED; if (OptionalMessageDialog.isDialogEnabled(key)) { TemplateStore templates= JavaPlugin.getDefault().getTemplateStore(); boolean isOldWorkspace= templates.findTemplate("filecomment") != null && templates.findTemplate("typecomment") != null; //$NON-NLS-1$ //$NON-NLS-2$ if (!isOldWorkspace) { OptionalMessageDialog.setDialogEnabled(key, false); } String title= NewWizardMessages.NewElementWizard_typecomment_deprecated_title; String message= NewWizardMessages.NewElementWizard_typecomment_deprecated_message; OptionalMessageDialog.open(key, getShell(), title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); } }
@Override protected Control createCustomArea(Composite parent) { Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); fHideDialogCheckBox= new Button(composite, SWT.CHECK | SWT.LEFT); fHideDialogCheckBox.setText(fCheckBoxText); fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setDialogEnabled(fId, !((Button)e.widget).getSelection()); } }); applyDialogFont(fHideDialogCheckBox); return fHideDialogCheckBox; }
/** * Opens the dialog but only if the user hasn't chosen to hide it. * * @return the index of the pressed button or {@link SWT#DEFAULT} if the dialog got dismissed * without pressing a button (e.g. via Esc) or {{@link #NOT_SHOWN} if the dialog was not * shown */ public static int open(String id, Shell parent, String title, Image titleImage, String message, int dialogType, String[] buttonLabels, int defaultButtonIndex, String checkboxText) { if (!isDialogEnabled(id)) return OptionalMessageDialog.NOT_SHOWN; MessageDialog dialog= new OptionalMessageDialog(id, parent, title, titleImage, message, dialogType, buttonLabels, defaultButtonIndex, checkboxText); return dialog.open(); }