org.eclipse.jface.preference.PreferenceDialog Java Examples

The following examples show how to use org.eclipse.jface.preference.PreferenceDialog. 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: LoadDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    Button manageButton = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.TraceControl_ManageButtonText, false);
    manageButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferenceDialog dialog =
                    PreferencesUtil.createPreferenceDialogOn(parent.getShell(),
                            ControlRemoteProfilesPreferencePage.ID,
                            new String[] { ControlRemoteProfilesPreferencePage.ID },
                            null);
            dialog.open();
            if (fLocalComposite != null) {
                fFolderViewer.setInput(LTTngProfileViewer.getViewerInput());
                enableLocalButtons();
            }
        }
    });
    Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    button.setEnabled(false);
}
 
Example #2
Source File: SWTUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method allows us to open the preference dialog on the specific page, in this case the perspective page
 * 
 * @param id
 *            the id of pref page to show
 * @param page
 *            the actual page to show Copied from org.eclipse.debug.internal.ui.SWTUtil
 */
public static void showPreferencePage(String id, IPreferencePage page)
{
	final IPreferenceNode targetNode = new PreferenceNode(id, page);
	PreferenceManager manager = new PreferenceManager();
	manager.addToRoot(targetNode);
	final PreferenceDialog dialog = new PreferenceDialog(UIUtils.getActiveShell(), manager);
	BusyIndicator.showWhile(getStandardDisplay(), new Runnable()
	{
		public void run()
		{
			dialog.create();
			dialog.setMessage(targetNode.getLabelText());
			dialog.open();
		}
	});
}
 
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: 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 #5
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 #6
Source File: MessageArea.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected void createControls() {
	group = new Group(this, SWT.NONE);
	group.setLayout(new GridLayout(3, false));
	imageLabel = new Label(group, SWT.NONE);
	GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(imageLabel);
	textLabel = new Link(group, SWT.WRAP);
	textLabel.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (DOWNLOAD_LINK.equals(e.text)) {
				Program.launch(DOWNLOAD_LINK);
			} else {
				PreferenceDialog dialog = createPreferencePageDialog();
				dialog.open();
			}
		}
	});
	GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(textLabel);
	button = new Button(group, SWT.FLAT);
	button.setText("Download");
	GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(button);
}
 
Example #7
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 #8
Source File: RLSStreamConnectionProvider.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
private static void showSetupRustNotification() {
	Display.getDefault().asyncExec(() -> {
		if (hasCancelledSetup) {
			return;
		}
		setHasCancelledSetup(true);
		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		int dialogResponse = MessageDialog.open(MessageDialog.CONFIRM, shell,
				Messages.RLSStreamConnectionProvider_rustSupportNotFound,
				Messages.RLSStreamConnectionProvider_requirementsNotFound, SWT.NONE,
				Messages.RLSStreamConnectionProvider_OpenPreferences, IDialogConstants.CANCEL_LABEL); // $NON-NLS-4$
		if (dialogResponse == 0) {
			PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell,
					CorrosionPreferencePage.PAGE_ID, new String[] { CorrosionPreferencePage.PAGE_ID }, null);
			preferenceDialog.setBlockOnOpen(true);
			preferenceDialog.open();
			setHasCancelledSetup(false);
		}
	});
}
 
Example #9
Source File: AddRepositoryDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createConfigViewer(Composite container, FormToolkit toolkit) {
	UI.formLabel(container, toolkit, M.ServerUrl);
	configViewer = new ConfigViewer(container);
	configViewer.setInput(CloudConfigurations.get());
	Hyperlink editConfig = UI.formLink(container, toolkit, M.Edit);
	editConfig.setForeground(Colors.linkBlue());
	editConfig.addHyperlinkListener(new HyperlinkAdapter() {
		@Override
		public void linkActivated(HyperlinkEvent e) {
			PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, CloudPreferencePage.ID,
					null, null);
			dialog.setBlockOnOpen(true);
			dialog.open();
			configViewer.setInput(CloudConfigurations.get());
			configViewer.select(CloudConfigurations.getDefault());
		}
	});
}
 
Example #10
Source File: E4PreferencesHandler.java    From e4Preferences with Eclipse Public License 1.0 6 votes vote down vote up
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Optional PreferenceManager pm, MApplication appli)
{
	// Manage the possible null pm (case of pure E4 application. With E3 it
	// will be initialized by org.eclipse.ui.internal.WorkbenchPlugin
	// see line 1536
	if (pm == null)
	{
		pm = new E4PrefManager();
		E4PreferenceRegistry registry = new E4PreferenceRegistry();
		IEclipseContext appliContext = appli.getContext();
		registry.populatePrefManagerWithE4Extensions(pm, appliContext);
		appliContext.set(PreferenceManager.class, pm);
	}
	
	// Can display the standard dialog.
	PreferenceDialog dialog = new PreferenceDialog(shell, pm);
	dialog.create();
	dialog.getTreeViewer().setComparator(new ViewerComparator());
	dialog.getTreeViewer().expandAll();
	dialog.open();
}
 
Example #11
Source File: Preferences.java    From Rel with Apache License 2.0 5 votes vote down vote up
public Preferences(Shell parent) {
PreferenceManager preferenceManager = new PreferenceManager();

PreferenceNode general = new PreferenceNode("General", new PreferencePageGeneral());
preferenceManager.addToRoot(general);

PreferenceNode cmd = new PreferenceNode("Command line", new PreferencePageCmd());
preferenceManager.addToRoot(cmd);

PreferenceNode display = new PreferenceNode("Display", new PreferencePageDisplay());
preferenceManager.addToRoot(display);

preferenceDialog = new PreferenceDialog(parent, preferenceManager);
preferenceDialog.setPreferenceStore(preferences);
}
 
Example #12
Source File: EngineStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object handleStatus(IStatus status, Object source)
		throws CoreException {
	HybridMobileStatus  hs = (HybridMobileStatus) status;
	
	final boolean open = MessageDialog.openQuestion(AbstractStatusHandler.getShell(), "Missing or incomplete Hybrid Mobile Engine", 
			NLS.bind("{0} \n\nWould you like to modify Hybrid Mobile Engine preferences to correct this issue?",hs.getMessage() ));
	
	if(open){
		PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getShell(), hs.getProject(), 
				EnginePropertyPage.PAGE_ID, new String[]{EnginePropertyPage.PAGE_ID}, null);
		return (dialog != null && dialog.open() == Window.OK)? Boolean.TRUE: Boolean.FALSE; 
	}
	return Boolean.FALSE;
}
 
Example #13
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 #14
Source File: CppStylePropertyPage.java    From CppStyle with MIT License 5 votes vote down vote up
/**
 * Show a single preference pages
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
	final IPreferenceNode targetNode = new PreferenceNode(id, 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();
		}
	});
}
 
Example #15
Source File: BrowserMenuPopulator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Find a browser to open url
 */
private void findBrowser() {
  MessageDialog md = new MessageDialog(SWTUtilities.getShell(), "No browsers found", null, null, MessageDialog.ERROR,
      new String[] { "Ok" }, 0) {

    @Override
    protected Control createMessageArea(Composite parent) {
      super.createMessageArea(parent);
      Link link = new Link(parent, SWT.NONE);

      link.setText("There are no browsers defined, please add one (Right-click on URL -> "
          + "Open with -> Add a Browser, or <a href=\"#\">Window -> Preferences -> General -> Web Browser</a>).");
      link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          PreferenceDialog dialog = PreferencesUtil
              .createPreferenceDialogOn(Display.getCurrent().getActiveShell(),
                  "org.eclipse.ui.browser.preferencePage", new String[] { "org.eclipse.ui.browser.preferencePage" },
                  null);

          if (dialog != null) {
            dialog.open();
          }
        }
      });
      return parent;
    }
  };
  md.open();
}
 
Example #16
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 #17
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 #18
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 #19
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 #20
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 #21
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 #22
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 #23
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 #24
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 #25
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 #26
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 #27
Source File: FieldEditorOverlayPage.java    From cppcheclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Show a single preference pages
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
	final IPreferenceNode targetNode = new PreferenceNode(id, 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();
		}
	});
}
 
Example #28
Source File: GraphvizConfigurationDialog.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createMessageArea(Composite composite) {
	// prevent creation of messageLabel by super implementation
	String linkText = message;
	message = null;
	super.createMessageArea(composite);
	message = linkText;

	Link messageLink = new Link(composite, SWT.WRAP);
	messageLink.setText(message);
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
			.grab(true, false).applyTo(messageLink);
	messageLink.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			Shell shell = PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getShell();
			PreferenceDialog pref = PreferencesUtil
					.createPreferenceDialogOn(shell,
							"org.eclipse.gef.dot.internal.ui.GraphvizPreferencePage", //$NON-NLS-1$
							null, null);
			if (pref != null) {
				close();
				pref.open();
			}
		}
	});
	return composite;
}
 
Example #29
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 #30
Source File: LocalAppEngineServerWizardFragment.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void widgetDisposed(DisposeEvent event) {
  if (openPreferenceDialog) {
    // switch to Cloud SDK preferences panel
    event.display.asyncExec(() -> {
      PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
          null, CloudSdkPreferenceArea.PAGE_ID, null, null);
      dialog.open();
   });   
  }
}