本文整理汇总了Java中org.eclipse.ui.internal.ide.IDEInternalPreferences类的典型用法代码示例。如果您正苦于以下问题:Java IDEInternalPreferences类的具体用法?Java IDEInternalPreferences怎么用?Java IDEInternalPreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDEInternalPreferences类属于org.eclipse.ui.internal.ide包,在下文中一共展示了IDEInternalPreferences类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: formShowInSystemExplorerCommand
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
/**
* Prepare command for launching system explorer to show a path
*
* @param path
* the path to show
* @return the command that shows the path
*/
private String formShowInSystemExplorerCommand(File path) throws IOException {
String command = IDEWorkbenchPlugin.getDefault().getPreferenceStore()
.getString(IDEInternalPreferences.WORKBENCH_SYSTEM_EXPLORER);
command = Util.replaceAll(command, VARIABLE_RESOURCE, quotePath(path.getCanonicalPath()));
command = Util.replaceAll(command, VARIABLE_RESOURCE_URI, path.getCanonicalFile().toURI().toString());
File parent = path.getParentFile();
if (parent != null) {
command = Util.replaceAll(command, VARIABLE_FOLDER, quotePath(parent.getCanonicalPath()));
}
return command;
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:20,代码来源:ShowInSystemExplorer.java
示例2: confirmPerspectiveSwitch
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
/**
* Prompts the user for whether to switch perspectives.
*
* @param window
* The workbench window in which to switch perspectives; must not
* be <code>null</code>
* @param finalPersp
* The perspective to switch to; must not be <code>null</code>.
*
* @return <code>true</code> if it's OK to switch, <code>false</code>
* otherwise
*/
private static boolean confirmPerspectiveSwitch(IWorkbenchWindow window, IPerspectiveDescriptor finalPersp) {
IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
String pspm = store.getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
if (!IDEInternalPreferences.PSPM_PROMPT.equals(pspm)) {
// Return whether or not we should always switch
return IDEInternalPreferences.PSPM_ALWAYS.equals(pspm);
}
String desc = finalPersp.getDescription();
String message;
if (desc == null || desc.length() == 0)
message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessage, finalPersp.getLabel());
else
message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessageWithDesc,
new String[] { finalPersp.getLabel(), desc });
MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(window.getShell(),
ResourceMessages.NewProject_perspSwitchTitle, message,
null /* use the default message for the toggle */,
false /* toggle is initially unchecked */, store, IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
int result = dialog.getReturnCode();
// If we are not going to prompt anymore propogate the choice.
if (dialog.getToggleState()) {
String preferenceValue;
if (result == IDialogConstants.YES_ID) {
// Doesn't matter if it is replace or new window
// as we are going to use the open perspective setting
preferenceValue = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE;
} else {
preferenceValue = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE;
}
// update PROJECT_OPEN_NEW_PERSPECTIVE to correspond
PrefUtil.getAPIPreferenceStore().setValue(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE, preferenceValue);
}
return result == IDialogConstants.YES_ID;
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:50,代码来源:AbstractNewProjectWizard.java
示例3: refreshFromLocal
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
private void refreshFromLocal()
{
String[] commandLineArgs = Platform.getCommandLineArgs();
IPreferenceStore store =
IDEWorkbenchPlugin.getDefault().getPreferenceStore();
boolean refresh =
store.getBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP);
if (!refresh)
{
return;
}
// Do not refresh if it was already done by core on startup.
for (int i = 0; i < commandLineArgs.length; i++)
{
if (commandLineArgs[i].equalsIgnoreCase("-refresh"))
{
//$NON-NLS-1$
return;
}
}
final IContainer root = ResourcesPlugin.getWorkspace().getRoot();
Job job = new WorkspaceJob(IDEWorkbenchMessages.Workspace_refreshing)
{
public IStatus runInWorkspace(IProgressMonitor monitor)
throws CoreException
{
root.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return Status.OK_STATUS;
}
};
job.setRule(root);
job.schedule();
}
开发者ID:debrief,项目名称:limpet,代码行数:36,代码来源:ApplicationWorkbenchAdvisor.java
示例4: setDragModle
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
/**
* 设置在拖动文件到导航视图时的模式为直接复制,见类 {@link CopyFilesAndFoldersOperation} 的方法 CopyFilesAndFoldersOperation
* robert 09-26
*/
private void setDragModle(){
IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore();
store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE,
IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY);
store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE,
IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY);
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:12,代码来源:ApplicationWorkbenchWindowAdvisor.java
示例5: performResourceCopy
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
/**
* Performs a resource copy
*/
private IStatus performResourceCopy(final CommonDropAdapter dropAdapter, final Shell shell,
final IResource[] sources) {
final MultiStatus problems =
new MultiStatus(PlatformUI.PLUGIN_ID, 1, WorkbenchNavigatorMessages.DropAdapter_problemsMoving, null);
mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(),
dropAdapter.getCurrentOperation()));
final IContainer target = getActualTarget(ResourceManager.getResource(dropAdapter.getCurrentTarget()));
boolean shouldLinkAutomatically = false;
if (target.isVirtual()) {
shouldLinkAutomatically = true;
for (int i = 0; i < sources.length; i++) {
if (sources[i].getType() != IResource.FILE && sources[i].getLocation() != null) {
// If the source is a folder, but the location is null (a
// broken link, for example),
// we still generate a link automatically (the best option).
shouldLinkAutomatically = false;
break;
}
}
}
final CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
// if the target is a virtual folder and all sources are files, then
// automatically create links
if (shouldLinkAutomatically) {
operation.setCreateLinks(true);
operation.copyResources(sources, target);
} else {
boolean allSourceAreLinksOrVirtualFolders = true;
for (int i = 0; i < sources.length; i++) {
if (!sources[i].isVirtual() && !sources[i].isLinked()) {
allSourceAreLinksOrVirtualFolders = false;
break;
}
}
// if all sources are either links or groups, copy then normally,
// don't show the dialog
if (!allSourceAreLinksOrVirtualFolders) {
final IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
final String dndPreference = store.getString(
target.isVirtual() ? IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE
: IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE);
if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) {
final ImportTypeDialog dialog =
new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target);
dialog.setResource(target);
if (dialog.open() == Window.OK) {
if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS)
operation.setVirtualFolders(true);
if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK)
operation.setCreateLinks(true);
if (dialog.getVariable() != null)
operation.setRelativeVariable(dialog.getVariable());
operation.copyResources(sources, target);
} else
return problems;
} else
operation.copyResources(sources, target);
} else
operation.copyResources(sources, target);
}
return problems;
}
开发者ID:gama-platform,项目名称:gama,代码行数:71,代码来源:NavigatorResourceDropAssistant.java
示例6: computeTitle
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
private String computeTitle()
{
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
IWorkbenchPage currentPage = configurer.getWindow().getActivePage();
IEditorPart activeEditor = null;
if (currentPage != null)
{
activeEditor = lastActiveEditor;
}
String title = null;
IProduct product = Platform.getProduct();
if (product != null)
{
title = product.getName();
}
if (title == null)
{
title = ""; //$NON-NLS-1$
}
if (currentPage != null)
{
if (activeEditor != null)
{
lastEditorTitle = activeEditor.getTitleToolTip();
title =
NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle,
lastEditorTitle, title);
}
IPerspectiveDescriptor persp = currentPage.getPerspective();
String label = ""; //$NON-NLS-1$
if (persp != null)
{
label = persp.getLabel();
}
IAdaptable input = currentPage.getInput();
if (input != null && !input.equals(wbAdvisor.getDefaultPageInput()))
{
label = currentPage.getLabel();
}
if (label != null && !label.equals(""))
{ //$NON-NLS-1$
title =
NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, label,
title);
}
}
String workspaceLocation = wbAdvisor.getWorkspaceLocation();
if (workspaceLocation != null)
{
title =
NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, title,
workspaceLocation);
}
// Bug 284447: Prepend workspace name to the title
String workspaceName =
IDEWorkbenchPlugin.getDefault().getPreferenceStore().getString(
IDEInternalPreferences.WORKSPACE_NAME);
if (workspaceName != null && workspaceName.length() > 0)
{
title =
NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle,
workspaceName, title);
}
return title;
}
开发者ID:debrief,项目名称:limpet,代码行数:71,代码来源:ApplicationWorkbenchWindowAdvisor.java
示例7: openWelcomeEditors
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
private void openWelcomeEditors(IWorkbenchWindow window)
{
if (IDEWorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
IDEInternalPreferences.WELCOME_DIALOG))
{
// show the welcome page for the product the first time the
// workbench opens
IProduct product = Platform.getProduct();
if (product == null)
{
return;
}
AboutInfo productInfo = new AboutInfo(product);
URL url = productInfo.getWelcomePageURL();
if (url == null)
{
return;
}
IDEWorkbenchPlugin.getDefault().getPreferenceStore().setValue(
IDEInternalPreferences.WELCOME_DIALOG, false);
openWelcomeEditor(window, new WelcomeEditorInput(productInfo), null);
}
else
{
// Show the welcome page for any newly installed features
List<AboutInfo> welcomeFeatures = new ArrayList<AboutInfo>();
for (Iterator<Entry<String, AboutInfo>> it =
wbAdvisor.getNewlyAddedBundleGroups().entrySet().iterator(); it
.hasNext();)
{
Entry<String, AboutInfo> entry = it.next();
AboutInfo info = (AboutInfo) entry.getValue();
if (info != null && info.getWelcomePageURL() != null)
{
welcomeFeatures.add(info);
// activate the feature plug-in so it can run some install
// code
String pi = info.getBrandingBundleId();
if (pi != null)
{
// Start the bundle if there is one
Bundle bundle = Platform.getBundle(pi);
if (bundle != null)
{
try
{
bundle.start(Bundle.START_TRANSIENT);
}
catch (BundleException exception)
{
StatusManager.getManager().handle(
new Status(IStatus.ERROR, IDEApplication.PLUGIN_ID,
"Failed to load feature", exception)); //$NON-NLS-1$
}
}
}
}
}
int wCount = getWorkbench().getWorkbenchWindowCount();
for (int i = 0; i < welcomeFeatures.size(); i++)
{
AboutInfo newInfo = (AboutInfo) welcomeFeatures.get(i);
String id = newInfo.getWelcomePerspectiveId();
// Other editors were already opened in postWindowRestore(..)
if (id == null || i >= wCount)
{
openWelcomeEditor(window, new WelcomeEditorInput(newInfo), id);
}
}
}
}
开发者ID:debrief,项目名称:limpet,代码行数:76,代码来源:ApplicationWorkbenchWindowAdvisor.java
示例8: confirmPerspectiveSwitch
import org.eclipse.ui.internal.ide.IDEInternalPreferences; //导入依赖的package包/类
/**
* Prompts the user for whether to switch perspectives.
*
* @param window
* The workbench window in which to switch perspectives; must not
* be <code>null</code>
* @param finalPersp
* The perspective to switch to; must not be <code>null</code>.
*
* @return <code>true</code> if it's OK to switch, <code>false</code>
* otherwise
*/
private static boolean confirmPerspectiveSwitch(IWorkbenchWindow window,
IPerspectiveDescriptor finalPersp) {
IPreferenceStore store = IDEWorkbenchPlugin.getDefault()
.getPreferenceStore();
String pspm = store
.getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
if (!IDEInternalPreferences.PSPM_PROMPT.equals(pspm)) {
// Return whether or not we should always switch
return IDEInternalPreferences.PSPM_ALWAYS.equals(pspm);
}
String desc = finalPersp.getDescription();
String message;
if (desc == null || desc.length() == 0)
message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessage,
finalPersp.getLabel());
else
message = NLS.bind(
ResourceMessages.NewProject_perspSwitchMessageWithDesc,
new String[] { finalPersp.getLabel(), desc });
MessageDialogWithToggle dialog = MessageDialogWithToggle
.openYesNoQuestion(window.getShell(),
ResourceMessages.NewProject_perspSwitchTitle, message,
null /* use the default message for the toggle */,
false /* toggle is initially unchecked */, store,
IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
int result = dialog.getReturnCode();
// If we are not going to prompt anymore propogate the choice.
if (dialog.getToggleState()) {
String preferenceValue;
if (result == IDialogConstants.YES_ID) {
// Doesn't matter if it is replace or new window
// as we are going to use the open perspective setting
preferenceValue = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE;
} else {
preferenceValue = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE;
}
// update PROJECT_OPEN_NEW_PERSPECTIVE to correspond
PrefUtil.getAPIPreferenceStore().setValue(
IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE,
preferenceValue);
}
return result == IDialogConstants.YES_ID;
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:59,代码来源:EnsembleBasicNewProjectResourceWizard.java
注:本文中的org.eclipse.ui.internal.ide.IDEInternalPreferences类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论