Java Code Examples for org.eclipse.jface.preference.PreferenceDialog#open()

The following examples show how to use org.eclipse.jface.preference.PreferenceDialog#open() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProducePDFHandler.java    From tlaplus with MIT License 6 votes vote down vote up
private void handleJobException(final Exception e) {
	TLA2TeXActivator.getDefault().logError("Error while producing pdf file: " + e.getMessage(), e);

	final Runnable r = () -> {
		final Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
		final int response = MessageDialog.open(MessageDialog.ERROR, s, "PDF Production Problem",
				"The following error was encountered while attempting to generate the PDF - perhaps you "
					+ "have not set a full path to pdflatex in the preferences?\n\n" + e.getMessage(),
				SWT.NONE, "Open Preferences", "Ok");
		
		if (response == 0) {
			final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(s, 
					"toolbox.tool.tla2tex.preference.TLA2TeXPreferencePage",
					new String[] { "toolbox.tool.tla2tex.preference.TLA2TeXPreferencePage" }, null);
			dialog.open();
		}
	};
	
	UIHelper.runUIAsync(r);
}
 
Example 2
Source File: ShowFilteredPreferencePageHandler.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public final Object execute(final ExecutionEvent event)
{
	final String preferencePageId = event.getParameter(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID);
	final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);

	final Shell shell;
	if (activeWorkbenchWindow == null)
	{
		shell = null;
	}
	else
	{
		shell = activeWorkbenchWindow.getShell();
	}

	final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, preferencePageId,
			new String[] { preferencePageId }, null);
	dialog.open();

	return null;
}
 
Example 3
Source File: OpenThemePreferencesHandler.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException
{
	UIJob job = new UIJob("Open Theme Preferences") //$NON-NLS-1$
	{

		@Override
		public IStatus runInUIThread(IProgressMonitor monitor)
		{
			final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(UIUtils.getActiveShell(),
					ThemePreferencePage.ID, null, null);
			dialog.open();
			return Status.OK_STATUS;
		}
	};
	job.setPriority(Job.INTERACTIVE);
	job.setRule(PopupSchedulingRule.INSTANCE);
	job.schedule();
	return null;
}
 
Example 4
Source File: SDKStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handle(IStatus status) {
	boolean define = MessageDialog
			.openQuestion(AbstractStatusHandler.getShell(),
					Messages.SDKStatusHandler_Title,
					Messages.SDKStatusHandler_Message);
	if (define) {
		PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
				getShell(), WPPreferencePage.PAGE_ID, null, null);
		dialog.open();
	}
}
 
Example 5
Source File: MissingSDKStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handle(IStatus status) {
	boolean define = MessageDialog.openQuestion(AbstractStatusHandler.getShell(), "Missing Android SDK",
			"Location of the Android SDK must be defined. Define Now?");
	if(define){
		PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), AndroidPreferencePage.PAGE_ID, 
				null, null);
		dialog.open();
	}
}
 
Example 6
Source File: BluemixUtil.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
public static void displayConfigureServerDialog() {
    String msg = BluemixUtil.productizeString("The %BM_PRODUCT% Server connection is not configured correctly. Open the %BM_PRODUCT% preferences?"); // $NLX-BluemixUtil.TheIBMBluemixServerconnectionisnotco-1$
    if(MessageDialog.openQuestion(null, "Server Configuration", msg)) { // $NLX-BluemixUtil.ServerConfiguration-1$ 
        PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PreferencePage.BLUEMIX_PREF_PAGE, null, null);
        dialog.open();
    }
}
 
Example 7
Source File: OpenRuntimePrefsAction.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    PreferenceDialog dlg = new PreferenceDialog(Display.getDefault().getActiveShell(), PlatformUI.getWorkbench()
            .getPreferenceManager());
    dlg.setSelectedNode(RunContainerPreferencePage.ID);
    dlg.open();

}
 
Example 8
Source File: SurroundWithTemplateMenuAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void run() {
	PreferenceDialog preferenceDialog= PreferencesUtil.createPreferenceDialogOn(getShell(), JAVA_TEMPLATE_PREFERENCE_PAGE_ID, new String[] { JAVA_TEMPLATE_PREFERENCE_PAGE_ID, CODE_TEMPLATE_PREFERENCE_PAGE_ID }, null);
	preferenceDialog.getTreeViewer().expandAll();
	preferenceDialog.open();
}
 
Example 9
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void typePageLinkActivated() {
	IJavaProject project= getJavaProject();
	if (project != null) {
		PreferenceDialog dialog= PreferencesUtil.createPropertyDialogOn(getShell(), project.getProject(), CodeTemplatePreferencePage.PROP_ID, null, null);
		dialog.open();
	} else {
		String title= NewWizardMessages.NewTypeWizardPage_configure_templates_title;
		String message= NewWizardMessages.NewTypeWizardPage_configure_templates_message;
		MessageDialog.openInformation(getShell(), title, message);
	}
}
 
Example 10
Source File: PreferencesPageHandler.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the perferences page 
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	PreferenceDialog pd = PreferencesUtil.createPreferenceDialogOn(null,
							"hu.elte.txtuml.export.papyrus.preferences1", null, null);
	
	pd.open();
	return null;
}
 
Example 11
Source File: OpenExternalLibraryPreferencePageHandler.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	Shell shell = HandlerUtil.getActiveShell(event);
	PreferenceDialog dialog = createPreferenceDialogOn(shell, ExternalLibraryPreferencePage.ID, FILTER_IDS, null);
	if (null != dialog) {
		dialog.open();
	}
	return null;
}
 
Example 12
Source File: AbstractProjectPropertiesAction.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public void run(IAction action) {
  Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

  if (resource != null && resource.getType() == IResource.PROJECT) {
    PreferenceDialog page = PreferencesUtil.createPropertyDialogOn(shell,
        resource, propertiesPageID, null, null);
    if (page != null) {
      page.open();
      return;
    }
  }

  CorePluginLog.logError("Could not create project properties dialog for resource "
      + resource.toString());
}
 
Example 13
Source File: ConfigureProjectSdkMarkerResolution.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public void run(final IMarker marker) {
  PreferenceDialog page = PreferencesUtil.createPropertyDialogOn(
      CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
      marker.getResource().getProject(), projectPropertyPageID,
      new String[] {projectPropertyPageID}, null);

  page.open();
}
 
Example 14
Source File: PythonBreakpointPropertiesRulerAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
    PreferenceDialog dialog = createDialog();
    dialog.getShell().setText("Breakpoint Properties");
    if (dialog != null) {
        dialog.open();
    }
}
 
Example 15
Source File: OpenPreferencesAction.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the preferences dialog.
 */
private void openPreferences() {
  Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
      shell, pageId, null, null);
  dialog.open();

  // not sure if I have to do any cleanup. If so, the we probably want to:
  // dialog.blockOnOpen(true), then do the cleanup
}
 
Example 16
Source File: OpenSarosPreferencesHandler.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  PreferenceDialog pref =
      PreferencesUtil.createPreferenceDialogOn(null, "saros.preferences", null, null);
  if (pref != null) pref.open();

  return null;
}
 
Example 17
Source File: MemoryError.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
private void openPreferences() {
	close();
	PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
			null, "preferencepages.config", null, null);
	dialog.open();
}
 
Example 18
Source File: AdvancedSettingsAction.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void run(IAction action) {
	String[] displayIds = { "com.aptana.theme.preferencePage" };
  PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(window.getShell(), "com.aptana.theme.preferencePage", displayIds, null);
   dialog.open();
}
 
Example 19
Source File: Builder.java    From cppcheclipse with Apache License 2.0 4 votes vote down vote up
/**
 * (re-)initialize checker if necessary (first use or different project)
 * 
 * @param currentProject
 * @throws CoreException
 */
private void initChecker(IProject currentProject) throws CoreException {
	if (!currentProject.equals(project)) {
		runChecker();
		try {
			// separate try for empty path exception (common exception
			// which needs special handling)
			try {
				checker = new Checker(console, CppcheclipsePlugin
						.getProjectPreferenceStore(currentProject),
						CppcheclipsePlugin
								.getWorkspacePreferenceStore(),
						currentProject, new ToolchainSettings(currentProject), problemReporter);
				project = currentProject;
			} catch (EmptyPathException e1) {
				Runnable runnable = new Runnable() {
					public void run() {
						Shell shell = PlatformUI.getWorkbench()
								.getActiveWorkbenchWindow().getShell();
						if (MessageDialog.openQuestion(shell,
								Messages.Builder_PathEmptyTitle,
								Messages.Builder_PathEmptyMessage)) {
							PreferenceDialog dialog = PreferencesUtil
									.createPreferenceDialogOn(
											shell,
											BinaryPathPreferencePage.PAGE_ID,
											null, null);
							dialog.open();
						}
					}
				};
				Display.getDefault().asyncExec(runnable);
				throw e1;
			}
		} catch (Exception e2) {
			// all exceptions in initialization lead to non-recoverable
			// errors, therefore throw them as CoreExceptions
			IStatus status = new Status(IStatus.ERROR,
					CppcheclipsePlugin.getId(),
					"Could not initialize cppcheck for project "+ currentProject.getName(), e2); //$NON-NLS-1$
			throw new CoreException(status);
		}
	}
}
 
Example 20
Source File: PyUnitPrefsPage2.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public static void showPage() {
    String id = "org.python.pydev.prefs.pyunitPage";
    PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(null, id, null, null);
    prefDialog.open();
}