Java Code Examples for org.eclipse.jface.preference.IPreferenceStore#getBoolean()

The following examples show how to use org.eclipse.jface.preference.IPreferenceStore#getBoolean() . 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: SourceViewerInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void initializeColors() {
	IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
	RGB bgRGB;
	if (store.getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)) {
		bgRGB= getVisibleBackgroundColor(fShell.getDisplay());
	} else {
		bgRGB= PreferenceConverter.getColor(store, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR);
	}
	if (bgRGB != null) {
		fBackgroundColor= new Color(fShell.getDisplay(), bgRGB);
		fIsSystemBackgroundColor= false;
	} else {
		fBackgroundColor= fShell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
		fIsSystemBackgroundColor= true;
	}
}
 
Example 2
Source File: PerspectiveUtil.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public static void switchToModelingPerspective(IWorkbenchWindow window) {
	IPreferenceStore prefs = UIPluginActivator.getDefault()
			.getPreferenceStore();
	boolean hide = prefs.getBoolean(AUTO_SWITCH_PERSPECTIVE);
	IWorkbenchPage page = window.getActivePage();
	if (!hide) {
		IWorkbench workbench = window.getWorkbench();
		IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
		IPerspectiveDescriptor descriptor = registry
				.findPerspectiveWithId(IYakinduSctPerspectives.ID_PERSPECTIVE_SCT_MODELING);
		if ((page != null) && (page.getPerspective() != descriptor)) {
			MessageDialogWithToggle dialog = MessageDialogWithToggle
					.openYesNoQuestion(
							window.getShell(),
							"Confirm Perspective Switch",
							"This kind of editor is associated with the YAKINDU Modeling perspective. Do you want to switch to this perspective now?",
							"Do not offer to switch perspective in the future",
							hide, prefs, AUTO_SWITCH_PERSPECTIVE);
			if (dialog.getReturnCode() == 2)
				page.setPerspective(descriptor);
			hide = dialog.getToggleState();
			prefs.setValue(AUTO_SWITCH_PERSPECTIVE, hide);
			try {
				InstanceScope.INSTANCE.getNode(UIPluginActivator.PLUGIN_ID)
						.flush();
			} catch (BackingStoreException e) {
				e.printStackTrace();
			}
		}
	}
}
 
Example 3
Source File: RenameJavaElementAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void doRun() {
	RenameLinkedMode activeLinkedMode= RenameLinkedMode.getActiveLinkedMode();
	if (activeLinkedMode != null) {
		if (activeLinkedMode.isCaretInLinkedPosition()) {
			activeLinkedMode.startFullDialog();
			return;
		} else {
			activeLinkedMode.cancel();
		}
	}

	try {
		IJavaElement element= getJavaElementFromEditor();
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		boolean lightweight= store.getBoolean(PreferenceConstants.REFACTOR_LIGHTWEIGHT);
		if (element != null && RefactoringAvailabilityTester.isRenameElementAvailable(element)) {
			run(element, lightweight);
			return;
		} else if (lightweight) {
			// fall back to local rename:
			CorrectionCommandHandler handler= new CorrectionCommandHandler(fEditor, LinkedNamesAssistProposal.ASSIST_ID, true);
			if (handler.doExecute()) {
				fEditor.setStatusLineErrorMessage(RefactoringMessages.RenameJavaElementAction_started_rename_in_file);
				return;
			}
		}
	} catch (CoreException e) {
		ExceptionHandler.handle(e, RefactoringMessages.RenameJavaElementAction_name, RefactoringMessages.RenameJavaElementAction_exception);
	}
	MessageDialog.openInformation(getShell(), RefactoringMessages.RenameJavaElementAction_name, RefactoringMessages.RenameJavaElementAction_not_available);
}
 
Example 4
Source File: OpenStatusBarHandler.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {

		IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
		boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status);
		
		ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor;
        configurer.setStatusVisible(!oldValue);
		
		preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, !oldValue);
		ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
		commandService.refreshElements(event.getCommand().getId(), null);
		
		return null;
	}
 
Example 5
Source File: Preferences.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public static boolean is(String key) {
	if (key == null)
		return false;
	IPreferenceStore store = getStore();
	if (store == null)
		return false;
	if (!store.contains(key))
		return false;
	return store.getBoolean(key);
}
 
Example 6
Source File: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 5 votes vote down vote up
protected final ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {

		IPreferenceStore store = getPreferenceStore();
		ISourceViewer viewer = createTypeScriptSourceViewer(parent, verticalRuler, getOverviewRuler(),
				isOverviewRulerVisible(), styles, store);

		// JavaUIHelp.setHelp(this, viewer.getTextWidget(),
		// IJavaHelpContextIds.JAVA_EDITOR);

		TypeScriptSourceViewer TypeScriptSourceViewer = null;
		if (viewer instanceof TypeScriptSourceViewer)
			TypeScriptSourceViewer = (TypeScriptSourceViewer) viewer;

		/*
		 * This is a performance optimization to reduce the computation of the
		 * text presentation triggered by {@link #setVisibleDocument(IDocument)}
		 */
		if (TypeScriptSourceViewer != null && isFoldingEnabled()
				&& (store == null || !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS))) {
			// TypeScriptSourceViewer.prepareDelayedProjection();
		}

		// // do not even install projection support until folding is actually
		// // enabled
		// if (isFoldingEnabled()) {
		// installProjectionSupport(TypeScriptSourceViewer);
		// }

		// fProjectionModelUpdater =
		// JavaScriptPlugin.getDefault().getFoldingStructureProviderRegistry()
		// .getCurrentFoldingProvider();
		// if (fProjectionModelUpdater != null) {
		// fProjectionModelUpdater.install(this, projectionViewer);
		// }
		// ensure source viewer decoration support has been created and
		// configured
		getSourceViewerDecorationSupport(viewer);

		return viewer;
	}
 
Example 7
Source File: ModelEditor.java    From tlaplus with MIT License 5 votes vote down vote up
public void resultsPageIsClosing() {
final IPreferenceStore ips = TLCUIActivator.getDefault().getPreferenceStore();
  	if (ips.getBoolean(IModelEditorPreferenceConstants.I_MODEL_EDITOR_SHOW_ECE_AS_TAB)) {
  		removePage(getPageCount() - 1);
  	}
  	
final int openTabState = getModel().getOpenTabsValue();
updateOpenTabsState(openTabState & ~IModelConfigurationConstants.EDITOR_OPEN_TAB_RESULTS);
  }
 
Example 8
Source File: SpellQA.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public SpellQA(){
	//确定检查类别
	IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
	isHunspell = preferenceStore.getBoolean(QAConstant.QA_PREF_isHunspell);
	ignoreNontrans = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreNontrans);
	ignoreDigitalFirst = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreDigitalFirst);
	ignoreUpperCaseFirst = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreUpperCaseFirst);
	
	qaPreferenceStore = Activator.getDefault().getPreferenceStore();
	tipLevel = qaPreferenceStore.getInt(QAConstant.QA_PREF_spell_TIPLEVEL);
	//UNDO 拼写检查的信息提示太过专业化,详细化提示。比如:qa.spellCheck.HashDictionary.tip1=词典文件缺少表格大小。
}
 
Example 9
Source File: SemanticHighlightings.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Tests whether semantic highlighting is currently enabled.
 *
 * @param store the preference store to consult
 * @return <code>true</code> if semantic highlighting is enabled,
 *         <code>false</code> if it is not
 * @since 3.1
 */
public static boolean isEnabled(IPreferenceStore store) {
	SemanticHighlighting[] highlightings= getSemanticHighlightings();
	boolean enable= false;
	for (int i= 0; i < highlightings.length; i++) {
		String enabledKey= getEnabledPreferenceKey(highlightings[i]);
		if (store.getBoolean(enabledKey)) {
			enable= true;
			break;
		}
	}

	return enable;
}
 
Example 10
Source File: BOSWebServerManager.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private boolean isLazyModeEnabled(IPreferenceStore preferenceStore) {
    return preferenceStore.getBoolean(EnginePreferenceConstants.LAZYLOAD_ENGINE)
            || System.getProperty(EnginePreferenceConstants.LAZYLOAD_ENGINE) != null;
}
 
Example 11
Source File: ContentAssistPreference.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public static boolean fillArgumentsOnMethodCompletion(IPreferenceStore store) {
	return store.getBoolean(FILL_METHOD_ARGUMENTS);
}
 
Example 12
Source File: XPreferencePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public static boolean getHideNumbers() {
    IPreferenceStore store = XBookmarksPlugin.getDefault().getPreferenceStore();
    return store.getBoolean(HIDE_NUMBERS_KEY);
}
 
Example 13
Source File: BOSEngineManager.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private boolean dropBusinessDataDBOnExit() {
    final IPreferenceStore preferenceStore = EnginePlugin.getDefault().getPreferenceStore();
    return preferenceStore.getBoolean(EnginePreferenceConstants.DROP_BUSINESS_DATA_DB_ON_EXIT_PREF);
}
 
Example 14
Source File: LocationAnnotationManager.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
public LocationAnnotationManager(IPreferenceStore preferenceStore) {
  annotationModelHelper = new AnnotationModelHelper();

  fillUpEnabled =
      preferenceStore.getBoolean(EclipsePreferenceConstants.SHOW_SELECTIONFILLUP_ANNOTATIONS);
}
 
Example 15
Source File: EditorAppearanceColorsComponent.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public void loadFromStore(IPreferenceStore store) {
	String colorPrefValue = store.getString(colorKey);
	boolean useSystemDefaultPrefValue = useSystemDefaultKey == null ? false : 
		store.getBoolean(useSystemDefaultKey);
	setValues(colorPrefValue, useSystemDefaultPrefValue);
}
 
Example 16
Source File: TypeScriptDocumentProvider.java    From typescript.java with MIT License 4 votes vote down vote up
private void performSaveActions(IFile file, IDocument document, IProgressMonitor monitor,
		IPreferenceStore preferenceStore) {
	boolean runFormat = preferenceStore.getBoolean(TypeScriptUIPreferenceConstants.EDITOR_SAVE_ACTIONS_FORMAT);
	SubMonitor progress = SubMonitor.convert(monitor, (runFormat ? 10 : 0));
	if (!runFormat) {
		return;
	}

	IUndoManager manager = RefactoringCore.getUndoManager();

	CompositeChange saveActionsChange = new CompositeChange("Save Actions");
	List<Change> undoChanges = new ArrayList<>();
	boolean success = false;
	try {
		manager.aboutToPerformChange(saveActionsChange);

		// Format the file contents
		if (runFormat) {
			TextFileChange change = new TextFileChange("Format", file);
			try {
				IIDETypeScriptProject tsProject = TypeScriptResourceUtil.getTypeScriptProject(file.getProject());
				final IIDETypeScriptFile tsFile = tsProject.openFile(file, document);
				List<CodeEdit> codeEdits = tsFile.format(0, document.getLength()).get();
				change.setEdit(DocumentUtils.toTextEdit(codeEdits, document));
				change.initializeValidationData(new NullProgressMonitor());
				PerformChangeOperation performChangeOperation = new PerformChangeOperation(change);
				ResourcesPlugin.getWorkspace().run(performChangeOperation, progress.newChild(10));
				Change undoChange = performChangeOperation.getUndoChange();
				if (undoChange != null) {
					undoChanges.add(undoChange);
				}
			} catch (Exception e) {
				JSDTTypeScriptUIPlugin.log(e);
			}
		}

		success = true;
	} finally {
		manager.changePerformed(saveActionsChange, success);
	}

	// Add an undo change if possible
	if (!undoChanges.isEmpty()) {
		manager.addUndo(saveActionsChange.getName(), new CompositeChange(saveActionsChange.getName(),
				undoChanges.toArray(new Change[undoChanges.size()])));
	}
}
 
Example 17
Source File: LoggerPreference.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
public static boolean getShowConsole() {
	IPreferenceStore store = getStore();
	return store.getBoolean(LOG_CONSOLE);
}
 
Example 18
Source File: CompilationUnitDocumentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the preference whether handling temporary problems is enabled.
 *
 * @return <code>true</code> if temporary problems are handled
 */
protected boolean isHandlingTemporaryProblems() {
	IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
	return store.getBoolean(HANDLE_TEMPORARY_PROBLEMS);
}
 
Example 19
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the boolean preference for the given key.
 *
 * @param store the preference store
 * @param key the preference key
 * @return <code>true</code> if the key exists in the store and its value is <code>true</code>
 * @since 3.0
 */
private boolean getBoolean(IPreferenceStore store, String key) {
	return key != null && store.getBoolean(key);
}
 
Example 20
Source File: Uml2Service.java    From uml2solidity with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Should the js controller being generated.
 * 
 * @param an
 *            element
 * @return
 */
public static Boolean generateContractCode(NamedElement clazz) {
	IPreferenceStore store = getStore(clazz);
	return store.getBoolean(PreferenceConstants.GENERATE_CONTRACT_FILES);
}