Java Code Examples for org.eclipse.jdt.ui.PreferenceConstants#getPreferenceStore()

The following examples show how to use org.eclipse.jdt.ui.PreferenceConstants#getPreferenceStore() . 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: XtendPreferenceStoreAccess.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@SuppressWarnings("all")
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
	IProject project = getProject(context);
	if (project == null) return getPreferenceStore();
	IPreferenceStore store = super.getContextPreferenceStore(context);
	ProjectScope projectScope = new ProjectScope(project);
	FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(projectScope, JavaCore.PLUGIN_ID);
	jdtStore.setSearchContexts(new IScopeContext[] {
			projectScope,
			new InstanceScope(),
			new ConfigurationScope()
	});
	return new ChainedPreferenceStore(new IPreferenceStore[] {
		store,
		jdtStore,
		PreferenceConstants.getPreferenceStore()
	});
}
 
Example 2
Source File: AppearanceAwareLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void initMasks() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	fTextFlagMask= -1;
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE)) {
		fTextFlagMask ^= JavaElementLabels.M_APP_RETURNTYPE;
	}
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_METHOD_TYPEPARAMETERS)) {
		fTextFlagMask ^= JavaElementLabels.M_APP_TYPE_PARAMETERS;
	}
	if (!(store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)
			|| store.getBoolean(PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES))) {
		fTextFlagMask ^= JavaElementLabels.P_COMPRESSED;
	}
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_CATEGORY)) {
		fTextFlagMask ^= JavaElementLabels.ALL_CATEGORY;
	}

	fImageFlagMask= -1;
}
 
Example 3
Source File: BuildPathsBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private List<CPListElement> getDefaultClassPath(IJavaProject jproj) {
	List<CPListElement> list= new ArrayList<CPListElement>();
	IResource srcFolder;
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	String sourceFolderName= store.getString(PreferenceConstants.SRCBIN_SRCNAME);
	if (store.getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ) && sourceFolderName.length() > 0) {
		srcFolder= jproj.getProject().getFolder(sourceFolderName);
	} else {
		srcFolder= jproj.getProject();
	}

	list.add(new CPListElement(jproj, IClasspathEntry.CPE_SOURCE, srcFolder.getFullPath(), srcFolder));

	IClasspathEntry[] jreEntries= PreferenceConstants.getDefaultJRELibrary();
	list.addAll(getCPListElements(jreEntries, null));
	return list;
}
 
Example 4
Source File: JavaNavigatorContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void init(ICommonContentExtensionSite commonContentExtensionSite) {
	IExtensionStateModel stateModel = commonContentExtensionSite
			.getExtensionStateModel();
	IMemento memento = commonContentExtensionSite.getMemento();

	fStateModel = stateModel;
	restoreState(memento);
	fLayoutPropertyListener = new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			if (Values.IS_LAYOUT_FLAT.equals(event.getProperty())) {
				if (event.getNewValue() != null) {
					boolean newValue = ((Boolean) event.getNewValue())
							.booleanValue() ? true : false;
					setIsFlatLayout(newValue);
				}
			}

		}
	};
	fStateModel.addPropertyChangeListener(fLayoutPropertyListener);

	IPreferenceStore store = PreferenceConstants.getPreferenceStore();
	boolean showCUChildren = store
			.getBoolean(PreferenceConstants.SHOW_CU_CHILDREN);
	setProvideMembers(showCUChildren);
}
 
Example 5
Source File: MyPreferenceConstants.java    From jdt-codemining with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the JDT-UI preference store.
 *
 * @return the JDT-UI preference store
 */
public static IPreferenceStore getPreferenceStore() {
	IPreferenceStore store = PreferenceConstants.getPreferenceStore();
	if (!initialized) {
		MyPreferenceConstants.initializeDefaultValues(store);
		initialized = true;
	}
	return store;
}
 
Example 6
Source File: XtendPreferenceStoreAccess.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("all")
@Override
public IPreferenceStore getPreferenceStore() {
	IPreferenceStore store = super.getPreferenceStore();
	FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(new InstanceScope(), JavaCore.PLUGIN_ID);
	jdtStore.setSearchContexts(new IScopeContext[] {
			new InstanceScope(),
			new ConfigurationScope()
	});
	return new ChainedPreferenceStore(new IPreferenceStore[] {
		store,
		jdtStore,
		PreferenceConstants.getPreferenceStore()
	});
}
 
Example 7
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This method should only be called inside this class
 * and from test cases.
 * @return the created content provider
 */
public PackageExplorerContentProvider createContentProvider() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	boolean showCUChildren= store.getBoolean(PreferenceConstants.SHOW_CU_CHILDREN);
	if (getRootMode() == PROJECTS_AS_ROOTS)
		return new PackageExplorerContentProvider(showCUChildren);
	else
		return new WorkingSetAwareContentProvider(showCUChildren, fWorkingSetModel);
}
 
Example 8
Source File: CompletionProposalComputerRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void updateUninstalledComputerCount() {
	IPreferenceStore preferenceStore= PreferenceConstants.getPreferenceStore();
	fIsFirstTimeCheckForUninstalledComputers= !preferenceStore.contains(NUM_COMPUTERS_PREF_KEY);
	int lastNumberOfComputers= preferenceStore.getInt(NUM_COMPUTERS_PREF_KEY);
	int currNumber= fDescriptors.size();
	fHasUninstalledComputers= lastNumberOfComputers > currNumber;
	preferenceStore.putValue(NUM_COMPUTERS_PREF_KEY, Integer.toString(currNumber));
	JavaPlugin.flushInstanceScope();
}
 
Example 9
Source File: BuildPathsBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static IPath getDefaultOutputLocation(IJavaProject jproj) {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	if (store.getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ)) {
		String outputLocationName= store.getString(PreferenceConstants.SRCBIN_BINNAME);
		return jproj.getProject().getFullPath().append(outputLocationName);
	} else {
		return jproj.getProject().getFullPath();
	}
}
 
Example 10
Source File: JavaUIPreferenceInitializer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
	IPreferenceStore store = PreferenceConstants.getPreferenceStore();

	EditorsUI.useAnnotationsPreferencePage(store);
	EditorsUI.useQuickDiffPreferencePage(store);
	PreferenceConstants.initializeDefaultValues(store);
}
 
Example 11
Source File: JavadocOptionsManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void updateDialogSettings(IDialogSettings dialogSettings, IJavaProject[] checkedProjects) {
	IDialogSettings settings= dialogSettings.addNewSection(SECTION_JAVADOC);

	settings.put(JAVADOC_COMMAND_HISTORY, flatStringList(fJavadocCommandHistory));
	if (fJavadocCommandHistory.length > 0) {
		IPreferenceStore store= PreferenceConstants.getPreferenceStore();
		store.setValue(PreferenceConstants.JAVADOC_COMMAND, fJavadocCommandHistory[0]);
	}


	settings.put(FROMSTANDARD, fFromStandard);

	settings.put(DOCLETNAME, fDocletname);
	settings.put(DOCLETPATH, fDocletpath);

	settings.put(VISIBILITY, fAccess);

	settings.put(USE, fUse);
	settings.put(AUTHOR, fAuthor);
	settings.put(VERSION, fVersion);
	settings.put(NODEPRECATED, fNodeprecated);
	settings.put(NODEPRECATEDLIST, fNoDeprecatedlist);
	settings.put(SPLITINDEX, fSplitindex);
	settings.put(NOINDEX, fNoindex);
	settings.put(NOTREE, fNotree);
	settings.put(NONAVBAR, fNonavbar);
	settings.put(OPENINBROWSER, fOpenInBrowser);
	settings.put(SOURCE, fSource);

	if (fAntpath.length() != 0)
		settings.put(ANTPATH, fAntpath);
	if (fDestination.length() != 0)
		settings.put(DESTINATION, fDestination);
	if (fAdditionalParams.length() != 0)
		settings.put(EXTRAOPTIONS, fAdditionalParams);
	if (fVMParams.length() != 0)
		settings.put(VMOPTIONS, fVMParams);
	if (fOverview.length() != 0)
		settings.put(OVERVIEW, fOverview);
	if (fStylesheet.length() != 0)
		settings.put(STYLESHEETFILE, fStylesheet);
	if (fTitle.length() != 0)
		settings.put(TITLE, fTitle);

	if (checkedProjects.length == 1) {
		updateRecentSettings(checkedProjects[0]);
	}
	getRecentSettings().store(settings);
}
 
Example 12
Source File: JavaElementLabelComposer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isPackageNameCompressionEnabled() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	return store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES);
}
 
Example 13
Source File: JavaElementLabelComposer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private String getPkgNamePatternForPackagesView() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES))
		return ""; //$NON-NLS-1$
	return store.getString(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW);
}
 
Example 14
Source File: JavaElementLabelComposer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isPackageNameAbbreviationEnabled() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	return store.getBoolean(PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES);
}
 
Example 15
Source File: JavaElementLabelComposer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private String getPkgNameAbbreviationPatternForPackagesView() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES))
		return ""; //$NON-NLS-1$
	return store.getString(PreferenceConstants.APPEARANCE_PKG_NAME_ABBREVIATION_PATTERN_FOR_PKG_VIEW);
}
 
Example 16
Source File: PreferenceInitializer.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected IPreferenceStore getJDTPreferenceStore() {
    return PreferenceConstants.getPreferenceStore();
}