當前位置: 首頁>>代碼示例>>Java>>正文


Java PreferencesUtil類代碼示例

本文整理匯總了Java中org.eclipse.ui.dialogs.PreferencesUtil的典型用法代碼示例。如果您正苦於以下問題:Java PreferencesUtil類的具體用法?Java PreferencesUtil怎麽用?Java PreferencesUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PreferencesUtil類屬於org.eclipse.ui.dialogs包,在下文中一共展示了PreferencesUtil類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:20,代碼來源:OpenThemePreferencesHandler.java

示例2: createControls

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
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 = PreferencesUtil.createPreferenceDialogOn(getShell(), PREF_PAGE_ID,
						new String[] { DISPLAY_ID }, null);
				dialog.setSelectedNode("DISPLAY_ID");
				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);
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:25,代碼來源:MessageArea.java

示例3: doaction

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
protected void doaction(Actions anAction) {
	LiveTraceEditorInput source = (LiveTraceEditorInput) getEditorInput();
	switch (anAction) {
	case CLEAR:
		source.clearAll();
		break;
	case STOP:
   		source.stop();
   	    getAction(Actions.STOP).setEnabled(false);
   	    getAction(Actions.RESTART).setEnabled(true);
		break;
	case RESTART:
   		source.restart();
   		getAction(Actions.STOP).setEnabled(true);
   		getAction(Actions.RESTART).setEnabled(false);
		break;
	case CONFIG:
		//TODO: create our own preference page...
		PreferencesUtil.createPreferenceDialogOn(null, "com.novell.core.dstraceviewer.liveTrace.tracePrefs", null, null).open();
		//TODO: how to get the preferences when they are changed
		break;
	default:
		break;
	}
}
 
開發者ID:scauwe,項目名稱:IDM-Enh-Trace,代碼行數:26,代碼來源:LiveTraceEditor.java

示例4: editPreferencesAfterDoxygenInvocationFailed

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
/**
 * Asks the user if he wants to edit doxygen configuration after a failed
 * doxygen invocation.
 *
 * @return	@c true if doxygen configuration has been edited, @c false otherwise
 */
public static boolean editPreferencesAfterDoxygenInvocationFailed() {
    Shell shell = plugin.getWorkbench().getActiveWorkbenchWindow().getShell();

    // Asks the user if he wants to edit the preferences to solve the problem.
    boolean editionWanted = MessageDialog.openQuestion(shell, "Doxygen Not Found",
            "Eclox was not able to run doxygen. Doxygen is either missing or eclox is not properly configured to use it.\n\nWould you like to edit preferences now ?");
    if (!editionWanted) {
        return false;
    }

    // Allows the user to edit the preferences and eventually launch doxygen again.
    String[] filter = { eclox.core.ui.PreferencePage.ID };
    int edited = PreferencesUtil.createPreferenceDialogOn(shell, eclox.core.ui.PreferencePage.ID, filter, null)
            .open();

    return edited == Window.OK;
}
 
開發者ID:anb0s,項目名稱:eclox,代碼行數:24,代碼來源:Plugin.java

示例5: run

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
    public void run(IAction action) {
        List<String> typesToFilter = getTypesToFilter(selection2);

        String preferencePageId = "DataHierarchy.globalPrefPage";
        String types = DataHierarchyPlugin.getDefault().getPreferenceStore().getString(
                IPrefConstants.PREF_ACTIVE_FILTERS_LIST);
        PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, preferencePageId,
                null, typesToFilter);
        int open = dialog.open();
        if (open != Window.OK) {
            return;
        }
        String newTypes = DataHierarchyPlugin.getDefault().getPreferenceStore().getString(
                IPrefConstants.PREF_ACTIVE_FILTERS_LIST);
        if (types.equals(newTypes)) {
            return;
        }
        part.updateFilter(newTypes);
//        SearchAgainAction search = new SearchAgainAction();
//        search.init(part);
//        search.run(action);
    }
 
開發者ID:iloveeclipse,項目名稱:datahierarchy,代碼行數:24,代碼來源:AddToFilterAction.java

示例6: run

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
public void run() {
	if (link == null) {
		return;
	}
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {
			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (window != null) {
				 Shell shell = window.getShell();
                    shell.setMinimized(false);
                    shell.forceActive();
                    PreferenceDialog prefsDialog = PreferencesUtil.createPreferenceDialogOn(shell, link, null, additionalData);
                  	 prefsDialog.open();
			}
		}
	});
}
 
開發者ID:RichardBirenheide,項目名稱:brainfuck,代碼行數:20,代碼來源:ActiveHelpOpenPreferencePageAction.java

示例7: execute

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:22,代碼來源:ShowFilteredPreferencePageHandler.java

示例8: createUI_50_SetupExternalWebbrowser

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
private void createUI_50_SetupExternalWebbrowser(final Composite parent, final Composite container) {

		/*
		 * Link: Setup browser
		 */
		final Link linkSetupBrowser = new Link(container, SWT.WRAP);
		GridDataFactory.fillDefaults()//
				.align(SWT.FILL, SWT.END)
				.applyTo(linkSetupBrowser);

		linkSetupBrowser.setText(Messages.Search_View_Link_SetupExternalBrowser);
		linkSetupBrowser.setEnabled(true);
		linkSetupBrowser.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(final SelectionEvent e) {
				PreferencesUtil.createPreferenceDialogOn(//
						parent.getShell(),
						PrefPageWebBrowser.ID,
						null,
						null).open();
			}
		});
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:24,代碼來源:SearchView.java

示例9: run

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
public void run() {

	// set the currently displayed map provider so that this mp will be selected in the pref page
	final IPreferenceStore prefStore = TourbookPlugin.getDefault().getPreferenceStore();

	prefStore.setValue(//
			IMappingPreferences.MAP_FACTORY_LAST_SELECTED_MAP_PROVIDER,
			_tourMapView.getMap().getMapProvider().getId());

	PreferencesUtil.createPreferenceDialogOn(
			Display.getCurrent().getActiveShell(),
			PrefPageMapProviders.PREF_PAGE_MAP_PROVIDER_ID,
			null,
			null).open();
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:17,代碼來源:ActionManageMapProviders.java

示例10: execute

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
public final Object execute(final ExecutionEvent event) {
	final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);

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

	final PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, MergeEditorPreferencePage.PAGE_ID, null, null);
	if (prefDialog != null)
		prefDialog.open();

	return null;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:18,代碼來源:TableEditorPreferencePageHandler.java

示例11: execute

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
public final Object execute(final ExecutionEvent event) {
	final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);

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

	final PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, DaysEditorPreferencePage.PAGE_ID, null, null);
	if (prefDialog != null)
		prefDialog.open();

	return null;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:18,代碼來源:DaysEditorPreferencePageHandler.java

示例12: init

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING));
	fActionGroup.fillActionBars(site.getActionBars());
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) {
		@Override
		public void run() {
			String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$
			String[] displayedPages= { pageId,
					"org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$
					"org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$
			};
			PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open();
		}
	});
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:19,代碼來源:JavaSearchResultPage.java

示例13: apply

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
@Override
public void apply(IDocument document) {
	Map<Object, Object> data= null;
	if (fReferencedType != null) {
		IJavaElement elem= fReferencedType.getJavaElement();
		if (elem != null) {
			IPackageFragmentRoot root= (IPackageFragmentRoot) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
			if (root != null) {
				try {
					IClasspathEntry entry= root.getRawClasspathEntry();
					if (entry != null) {
						data= new HashMap<Object, Object>(1);
						data.put(BuildPathsPropertyPage.DATA_REVEAL_ENTRY, entry);
						if (entry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) {
							data.put(BuildPathsPropertyPage.DATA_REVEAL_ATTRIBUTE_KEY, CPListElement.ACCESSRULES);
						}
					}
				} catch (JavaModelException e) {
					// ignore
				}
			}
		}
	}
	PreferencesUtil.createPropertyDialogOn(JavaPlugin.getActiveWorkbenchShell(), fProject, BuildPathsPropertyPage.PROP_ID, null, data).open();
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:26,代碼來源:ReorgCorrectionsSubProcessor.java

示例14: createHeader

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
private void createHeader(Composite contents) {
	String text= PreferencesMessages.PropertiesFileEditorPreferencePage_link;
	Link link= new Link(contents, SWT.NONE);
	link.setText(text);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null);
			else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, "selectFont:org.eclipse.jdt.ui.PropertiesFileEditor.textfont"); //$NON-NLS-1$
		}
	});

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= 150; // only expand further if anyone else requires it
	link.setLayoutData(gridData);

	addFiller(contents);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:21,代碼來源:PropertiesFileEditorPreferencePage.java

示例15: createHeader

import org.eclipse.ui.dialogs.PreferencesUtil; //導入依賴的package包/類
private void createHeader(Composite contents) {
	final Shell shell= contents.getShell();
	String text= PreferencesMessages.JavaEditorPreferencePage_link;
	Link link= new Link(contents, SWT.NONE);
	link.setText(text);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, null);
			else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, "selectFont:org.eclipse.jdt.ui.editors.textfont"); //$NON-NLS-1$
		}
	});

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= 150; // only expand further if anyone else requires it
	link.setLayoutData(gridData);

	addFiller(contents);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:22,代碼來源:JavaEditorAppearanceConfigurationBlock.java


注:本文中的org.eclipse.ui.dialogs.PreferencesUtil類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。