use of org.eclipse.linuxtools.changelog.core.IEditorChangeLogContrib in project linuxtools by eclipse.
the class ChangeLogDocumentSetupParticipant method setup.
@Override
public void setup(IDocument document) {
IExtensionPoint editorExtensions = null;
IEditorChangeLogContrib editorContrib = null;
// get editor which is stored in preference.
IPreferenceStore store = ChangelogPlugin.getDefault().getPreferenceStore();
String pref_Editor = store.getString(// $NON-NLS-1$
"IChangeLogConstants.DEFAULT_EDITOR");
editorExtensions = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.linuxtools.changelog.core", // $NON-NLS-1$ //$NON-NLS-2$
"editorContribution");
if (editorExtensions != null) {
IConfigurationElement[] elements = editorExtensions.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
if (// $NON-NLS-1$
elements[i].getName().equals("editor") && (elements[i].getAttribute("name").equals(pref_Editor))) {
try {
// If editor has a special setup routine, use it.
IConfigurationElement bob = elements[i];
editorContrib = (IEditorChangeLogContrib) bob.createExecutableExtension(// $NON-NLS-1$
"class");
editorContrib.setup(document);
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
}
}
}
}
}
use of org.eclipse.linuxtools.changelog.core.IEditorChangeLogContrib in project linuxtools by eclipse.
the class ChangeLogEditor method getConfig.
/**
* Gets appropriate style editor from user pref.
*
* @return configuration for the Changelog editor
*/
private SourceViewerConfiguration getConfig() {
IExtensionPoint editorExtensions = null;
IEditorChangeLogContrib editorContrib = null;
// get editor which is stored in preference.
IPreferenceStore store = ChangelogPlugin.getDefault().getPreferenceStore();
// $NON-NLS-1$
String pref_Editor = store.getString("IChangeLogConstants.DEFAULT_EDITOR");
editorExtensions = // $NON-NLS-1$
Platform.getExtensionRegistry().getExtensionPoint(// $NON-NLS-1$
"org.eclipse.linuxtools.changelog.core", // $NON-NLS-1$
"editorContribution");
if (editorExtensions != null) {
IConfigurationElement[] elements = editorExtensions.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
if (// $NON-NLS-1$
elements[i].getName().equals("editor") && (elements[i].getAttribute("name").equals(pref_Editor))) {
try {
IConfigurationElement bob = elements[i];
// $NON-NLS-1$
editorContrib = (IEditorChangeLogContrib) bob.createExecutableExtension("class");
return (SourceViewerConfiguration) editorContrib;
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
}
}
}
}
return null;
}
Aggregations