org.eclipse.ui.internal.ide.IDEInternalPreferences Java Examples

The following examples show how to use org.eclipse.ui.internal.ide.IDEInternalPreferences. 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: AbstractNewProjectWizard.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: ApplicationWorkbenchWindowAdvisor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 设置在拖动文件到导航视图时的模式为直接复制,见类 {@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);
}
 
Example #3
Source File: ApplicationWorkbenchWindowAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 设置在拖动文件到导航视图时的模式为直接复制,见类 {@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);
}