use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class GotoAnnotationAction method isNavigationTarget.
/**
* Returns whether the given annotation is configured as a target for the
* "Go to Next/Previous Annotation" actions
*
* @param annotation
* the annotation
* @return <code>true</code> if this is a target, <code>false</code>
* otherwise
* @see Eclipse 3.0
*/
protected boolean isNavigationTarget(Annotation annotation) {
Preferences preferences = EditorsUI.getPluginPreferences();
AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
// See bug 41689
// String key= forward ? preference.getIsGoToNextNavigationTargetKey()
// : preference.getIsGoToPreviousNavigationTargetKey();
String key = preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
return (key != null && preferences.getBoolean(key));
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class CSSLinkConverter method addFunc.
/**
*/
public static String addFunc(String value) {
if (!value.trim().toLowerCase().startsWith(URL_BEGIN)) {
// pa_TODO css pref
Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
String quote = preferences.getString(CSSCorePreferenceNames.FORMAT_QUOTE);
value = CSSUtil.stripQuotes(value);
quote = CSSUtil.detectQuote(value, quote);
String str = URL_BEGIN;
if (preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER)
str = str.toUpperCase();
StringBuffer buf = new StringBuffer(str);
buf.append(quote);
buf.append(value);
buf.append(quote);
buf.append(URL_END);
return buf.toString();
}
return value;
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class NewHTMLWizard method performFinish.
public boolean performFinish() {
boolean performedOK = false;
// save user options for next use
fNewFileTemplatesPage.saveLastSavedPreferences();
// no file extension specified so add default extension
String fileName = fNewFilePage.getFileName();
if (fileName.lastIndexOf('.') == -1) {
String newFileName = fNewFilePage.addDefaultExtension(fileName);
fNewFilePage.setFileName(newFileName);
}
// create a new empty file
IFile file = fNewFilePage.createNewFile();
// sure to check
if (file != null) {
if (!file.isLinked()) {
// put template contents into file
String templateString = fNewFileTemplatesPage.getTemplateString();
if (templateString != null) {
templateString = applyLineDelimiter(file, templateString);
// determine the encoding for the new file
Preferences preference = HTMLCorePlugin.getDefault().getPluginPreferences();
String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
OutputStreamWriter outputStreamWriter = null;
if (charSet == null || charSet.trim().equals("")) {
// $NON-NLS-1$
// just use default encoding
outputStreamWriter = new OutputStreamWriter(outputStream);
} else {
outputStreamWriter = new OutputStreamWriter(outputStream, charSet);
}
outputStreamWriter.write(templateString);
outputStreamWriter.flush();
outputStreamWriter.close();
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
file.setContents(inputStream, true, false, null);
inputStream.close();
} catch (Exception e) {
// $NON-NLS-1$
Logger.log(Logger.WARNING_DEBUG, "Could not create contents for new HTML file", e);
}
}
}
// open the file in editor
openEditor(file);
// everything's fine
performedOK = true;
}
return performedOK;
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class CodedResourcePlugin method initializeDefaultPluginPreferences.
protected void initializeDefaultPluginPreferences() {
Preferences prefs = getPluginPreferences();
prefs.setDefault(CommonEncodingPreferenceNames.USE_3BYTE_BOM_WITH_UTF8, false);
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class JSPNodeActionManager method updateCase.
protected void updateCase() {
if (fModel != null) {
String modelContentTypeId = fModel.getContentTypeIdentifier();
if (modelContentTypeId != null) {
if (modelContentTypeId.equals(ContentTypeIdForJSP.ContentTypeID_JSP)) {
// $NON-NLS-1$
Preferences prefs = HTMLCorePlugin.getDefault().getPluginPreferences();
fTagCase = prefs.getInt(HTMLCorePreferenceNames.TAG_NAME_CASE);
fAttrCase = prefs.getInt(HTMLCorePreferenceNames.ATTR_NAME_CASE);
}
}
}
}
Aggregations