下面列出了com.google.common.collect.MapDifference.ValueDifference#org.eclipse.xtext.ui.editor.preferences.PreferenceConstants 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public boolean hasBuildAffectingChanges(Entry<String, ValueDifference<String>> preference) {
String key = preference.getKey();
if (key.startsWith(PREFIX)) {
String keyName = key.substring(key.lastIndexOf(PreferenceConstants.SEPARATOR) + 1);
switch (keyName) {
case OUTPUT_CREATE_DIRECTORY:
case OUTPUT_OVERRIDE:
case OUTPUT_DERIVED:
case OUTPUT_CLEANUP_DERIVED:
case OUTPUT_CLEAN_DIRECTORY:
case OUTPUT_KEEP_LOCAL_HISTORY:
return false;
}
}
return true;
}
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
this.preferenceStoreAccess = preferenceStoreAccess;
// Initialize the default visibilities for the optional issue codes.
setupIssueCodesDefaults(preferenceStoreAccess);
final IPreferenceStore preferenceStore = org.eclipse.jdt.ui.PreferenceConstants.getPreferenceStore();
preferenceStore.addPropertyChangeListener(this);
// Copy the Subword navigation from the JDT plugin.
preferenceStoreAccess.getWritablePreferenceStore().setDefault(
PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
preferenceStore.getBoolean(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));
// Initialize the editor preferences
setupSourceViewerDefaults(preferenceStoreAccess);
setupCodeminingDefaults(preferenceStoreAccess);
// Initialize the generators for the extra languages.
setupExtraLanguageGeneratorDefaults(preferenceStoreAccess);
}
@Override
public void run() {
// Check whether we are in a java code partition and the preference is enabled
final IPreferenceStore store= getPreferenceStore();
if (!store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) {
super.run();
return;
}
final ISourceViewer viewer = getSourceViewer();
final IDocument document = viewer.getDocument();
try {
fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
if (position == -1)
return;
int next = findNextPosition(position);
if (isBlockSelectionModeEnabled()
&& document.getLineOfOffset(next) != document.getLineOfOffset(position)) {
super.run(); // may navigate into virtual white space
} else if (next != BreakIterator.DONE) {
setCaretPosition(next);
getTextWidget().showSelection();
fireSelectionChanged();
}
} catch (BadLocationException x) {
// ignore
}
}
@Override
public void run() {
// Check whether we are in a java code partition and the preference is enabled
final IPreferenceStore store= getPreferenceStore();
if (!store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) {
super.run();
return;
}
final ISourceViewer viewer = getSourceViewer();
final IDocument document = viewer.getDocument();
try {
fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
if (position == -1)
return;
int previous = findPreviousPosition(position);
if (isBlockSelectionModeEnabled()
&& document.getLineOfOffset(previous) != document.getLineOfOffset(position)) {
super.run(); // may navigate into virtual white space
} else if (previous != BreakIterator.DONE) {
setCaretPosition(previous);
getTextWidget().showSelection();
fireSelectionChanged();
}
} catch (BadLocationException x) {
// ignore - getLineOfOffset failed
}
}
@Override
protected final void addField(FieldEditor editor) {
String prefix = null;
if (getPreferencePrefix() != null)
prefix = getPreferencePrefix() + PreferenceConstants.SEPARATOR + editor.getPreferenceName();
else
prefix = editor.getPreferenceName();
editor.setPreferenceName(prefix);
internalEditorsList.add(editor);
super.addField(editor);
}
private void setPreferencePrefix(String preferencePrefix) {
this.preferencePrefix = preferencePrefix;
for (FieldEditor fe : internalEditorsList) {
String oldPreferenceName = fe.getPreferenceName();
if (oldPreferenceName.indexOf(PreferenceConstants.SEPARATOR) >= 0) {
oldPreferenceName = oldPreferenceName.substring(oldPreferenceName
.lastIndexOf(PreferenceConstants.SEPARATOR) + 1);
}
fe.setPreferenceName(getPreferencePrefix() + PreferenceConstants.SEPARATOR + oldPreferenceName);
}
}
public String getKey(final String preferenceName) {
StringConcatenation _builder = new StringConcatenation();
_builder.append(EclipseOutputConfigurationProvider.OUTPUT_PREFERENCE_TAG);
_builder.append(PreferenceConstants.SEPARATOR);
_builder.append(IFileSystemAccess.DEFAULT_OUTPUT);
_builder.append(PreferenceConstants.SEPARATOR);
_builder.append(preferenceName);
return _builder.toString();
}
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
this.preferenceStoreAccess = preferenceStoreAccess;
IPreferenceStore preferenceStore = org.eclipse.jdt.ui.PreferenceConstants.getPreferenceStore();
preferenceStore.addPropertyChangeListener(this);
preferenceStoreAccess.getWritablePreferenceStore().setDefault(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
preferenceStore.getBoolean(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));
}
@Override
public void propertyChange(PropertyChangeEvent event) {
if (preferenceStoreAccess == null) {
return;
}
if (org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION.equalsIgnoreCase(event.getProperty())) {
preferenceStoreAccess.getWritablePreferenceStore().setValue(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
Boolean.valueOf(event.getNewValue().toString()));
}
}
@Override
public void propertyChange(PropertyChangeEvent event) {
if (this.preferenceStoreAccess == null) {
return;
}
// Copy the Subword navigation from the JDT plugin.
if (org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION.equalsIgnoreCase(event.getProperty())) {
this.preferenceStoreAccess.getWritablePreferenceStore().setValue(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
Boolean.valueOf(event.getNewValue().toString()));
}
}
protected String getDefaultOutputDirectoryKey() {
return OUTPUT_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + IFileSystemAccess.DEFAULT_OUTPUT
+ PreferenceConstants.SEPARATOR + OUTPUT_DIRECTORY;
}
protected String getUseOutputPerSourceFolderKey() {
return OUTPUT_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + IFileSystemAccess.DEFAULT_OUTPUT
+ PreferenceConstants.SEPARATOR + USE_OUTPUT_PER_SOURCE_FOLDER;
}
@Override
public void initialize(IPreferenceStoreAccess access) {
access.getWritablePreferenceStore().setDefault(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION, true);
}
private String calculateClientPreferencePrefix(Object object) {
return getPreferenceName() + PreferenceConstants.SEPARATOR + identifier(object);
}
private String getKey(OutputConfiguration outputConfiguration, String preferenceName) {
return OUTPUT_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + outputConfiguration.getName()
+ PreferenceConstants.SEPARATOR + preferenceName;
}
private String getOutputForSourceFolder(IPreferenceStore store ,OutputConfiguration outputConfiguration, String sourceFolder) {
String key = getKey(outputConfiguration, SOURCE_FOLDER_TAG + PreferenceConstants.SEPARATOR + sourceFolder + PreferenceConstants.SEPARATOR + OUTPUT_DIRECTORY);
return Strings.emptyToNull(store.getString(key));
}
private boolean isIgnoreSourceFolder(IPreferenceStore store ,OutputConfiguration outputConfiguration, String sourceFolder) {
String key = getKey(outputConfiguration, SOURCE_FOLDER_TAG + PreferenceConstants.SEPARATOR + sourceFolder + PreferenceConstants.SEPARATOR + IGNORE_SOURCE_FOLDER_TAG);
return store.contains(key)? store.getBoolean(key): false;
}
public static String getKey(OutputConfiguration outputConfiguration, String preferenceName) {
return OUTPUT_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + outputConfiguration.getName()
+ PreferenceConstants.SEPARATOR + preferenceName;
}
public static String getOutputForSourceFolderKey(OutputConfiguration outputConfiguration, String sourceFolder) {
return getKey(outputConfiguration, SOURCE_FOLDER_TAG + PreferenceConstants.SEPARATOR + sourceFolder + PreferenceConstants.SEPARATOR + OUTPUT_DIRECTORY);
}
public static String getIgnoreSourceFolderKey(OutputConfiguration outputConfiguration, String sourceFolder) {
return getKey(outputConfiguration, SOURCE_FOLDER_TAG + PreferenceConstants.SEPARATOR + sourceFolder + PreferenceConstants.SEPARATOR + IGNORE_SOURCE_FOLDER_TAG);
}
/** Create a preference key according to the Xtext option block standards.
*
* @param preferenceContainerID the identifier of the generator's preference container.
* @param preferenceName the name of the preference.
* @return the key.
*/
private static String getXtextKey(String preferenceContainerID, String preferenceName) {
return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID
+ PreferenceConstants.SEPARATOR + preferenceName;
}