Java Code Examples for org.eclipse.ui.dialogs.PreferencesUtil#createPreferenceDialogOn()

The following examples show how to use org.eclipse.ui.dialogs.PreferencesUtil#createPreferenceDialogOn() . 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: GoUIPlugin.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
protected void checkPrefPageIdIsValid(String prefId) {
	Shell shell = WorkbenchUtils.getActiveWorkbenchShell();
	PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, prefId, null, null);
	assertNotNull(prefDialog); // Don't create, just eagerly check that it exits, that the ID is correct
	ISelection selection = prefDialog.getTreeViewer().getSelection();
	if(selection instanceof IStructuredSelection) {
		IStructuredSelection ss = (IStructuredSelection) selection;
		if(ss.getFirstElement() instanceof IPreferenceNode) {
			IPreferenceNode prefNode = (IPreferenceNode) ss.getFirstElement();
			if(prefNode.getId().equals(prefId)) {
				return; // Id exists
			}
		}
	}
	assertFail();
}
 
Example 3
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 4
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 5
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 6
Source File: GlobalActions.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
	if (workbenchWindow == null) {
		// action has been dispose
		return;
	}
	PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, null, null, null);
	dialog.getShell().setSize(1240, 700); // This enlarges the preference page
	dialog.open();
}
 
Example 7
Source File: WorkbenchUtils.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static void openPreferencePage(Shell shell, String prefPageId) {
	PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, prefPageId, null, null);
	
	if(prefDialog != null) {
		prefDialog.open();
	} else {
		String message = "Preference page not found: `" + prefPageId + "`.";
		UIOperationsStatusHandler.handleInternalError(shell, message, null);
	}
}
 
Example 8
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 9
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 10
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 11
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 12
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 13
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 14
Source File: TemplatesView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void createPartControl(final Composite parent) {
	PreferenceDialog dialog =
		PreferencesUtil.createPreferenceDialogOn(parent.getShell(), "msi.gama.lang.gaml.Gaml.templates",
			new String[] {}, null);
	PreferencePage selectedPage = (PreferencePage) dialog.getSelectedPage();
	selectedPage.createControl(parent);
}
 
Example 15
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();
}
 
Example 16
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 17
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 18
Source File: MessageArea.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public PreferenceDialog createPreferencePageDialog() {
	PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), PREF_PAGE_ID,
			new String[] { DISPLAY_ID }, null);
	dialog.setSelectedNode("DISPLAY_ID");
	return dialog;
}
 
Example 19
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();
}