Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 103890 Details for
Bug 234212
[wikitext] Mylyn should have an extension point for contributing viewers and editors for lightweight markup (eg: Textile)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch from bug 234210
clipboard.txt (text/plain), 18.66 KB, created by
Steffen Pingel
on 2008-06-06 02:23:58 EDT
(
hide
)
Description:
patch from bug 234210
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2008-06-06 02:23:58 EDT
Size:
18.66 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.sandbox.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/plugin.xml,v >retrieving revision 1.81 >diff -u -r1.81 plugin.xml >--- plugin.xml 20 May 2008 23:18:10 -0000 1.81 >+++ plugin.xml 6 Jun 2008 06:22:53 -0000 >@@ -1,6 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> > <plugin> >+ <extension-point id="taskEditorExtensions" name="Task Editor Extension" schema="schema/taskEditorExtensions.exsd"/> > > <extension point="org.eclipse.ui.views"> > <category name="Mylyn Sandbox" id="org.eclipse.mylyn.sandbox"/> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.209 >diff -u -r1.209 MANIFEST.MF >--- META-INF/MANIFEST.MF 30 May 2008 05:35:27 -0000 1.209 >+++ META-INF/MANIFEST.MF 6 Jun 2008 06:22:53 -0000 >@@ -34,6 +34,7 @@ > org.eclipse.mylyn.internal.sandbox.ui;x-internal:=true, > org.eclipse.mylyn.internal.sandbox.ui.actions;x-internal:=true, > org.eclipse.mylyn.internal.sandbox.ui.commands;x-internal:=true, >+ org.eclipse.mylyn.internal.sandbox.ui.editors;x-internal:=true, > org.eclipse.mylyn.internal.sandbox.ui.highlighters;x-internal:=true, > org.eclipse.mylyn.internal.sandbox.ui.planner;x-internal:=true, > org.eclipse.mylyn.internal.sandbox.ui.views;x-internal:=true >Index: schema/taskEditorExtensions.exsd >=================================================================== >RCS file: schema/taskEditorExtensions.exsd >diff -N schema/taskEditorExtensions.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/taskEditorExtensions.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,142 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.mylyn.sandbox.ui" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appinfo> >+ <meta.schema plugin="org.eclipse.mylyn.sandbox.ui" id="taskEditorExtensions" name="Task Editor Extensions"/> >+ </appinfo> >+ <documentation> >+ An extension to the Mylyn task editor that can provide viewing and editing controls that are markup-aware. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appinfo> >+ <meta.element internal="true" /> >+ </appinfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="taskEditorExtension" minOccurs="0" maxOccurs="unbounded"/> >+ <element ref="repositoryAssociation" minOccurs="0" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appinfo> >+ <meta.attribute translatable="true"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="taskEditorExtension"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ the fully qualified class name of the class that extends org.eclipse.mylyn.tasks.ui.editors.TaskEditorExtension >+ </documentation> >+ <appinfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.mylyn.tasks.ui.editors.TaskEditorExtension:"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ a unique identifier identifying the extension >+ </documentation> >+ <appinfo> >+ <meta.attribute kind="identifier"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string" use="required"> >+ <annotation> >+ <documentation> >+ A human-readable name for the extension that is presented to the Eclipse user in the UI. Should be translated. Used in the UI to identify the type of extension, so the name should indicate what the extension is for, and it should be short so that it can be displayed on one line (for example as an option in a combo box.) Example: "TracWiki", or "Textile". >+ </documentation> >+ <appinfo> >+ <meta.attribute translatable="true"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="repositoryAssociation"> >+ <complexType> >+ <attribute name="repository" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="taskEditorExtension" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="since"/> >+ </appinfo> >+ <documentation> >+ 3.1 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="examples"/> >+ </appinfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="apiinfo"/> >+ </appinfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="implementation"/> >+ </appinfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema> >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,80 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui.editors; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.IExtensionPoint; >+import org.eclipse.core.runtime.IExtensionRegistry; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.mylyn.commons.core.StatusHandler; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+ >+/** >+ * @author David Green >+ */ >+public class TaskEditorExtensionReader { >+ >+ public static final String ATTR_ID = "id"; >+ >+ public static final String ATTR_NAME = "name"; >+ >+ public static final String EXTENSION_TASK_EDITOR_EXTENSIONS = "org.eclipse.mylyn.tasks.ui.taskEditorExtensions"; >+ >+ private static final String REPOSITORY_ASSOCIATION = "repositoryAssociation"; >+ >+ private static final String TASK_EDITOR_EXTENSION = "taskEditorExtension"; >+ >+ public static void initExtensions() { >+ IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ >+ IExtensionPoint editorExtensionPoint = registry.getExtensionPoint(EXTENSION_TASK_EDITOR_EXTENSIONS); >+ IExtension[] editorExtensions = editorExtensionPoint.getExtensions(); >+ for (IExtension extension : editorExtensions) { >+ IConfigurationElement[] elements = extension.getConfigurationElements(); >+ for (IConfigurationElement element : elements) { >+ if (element.getName().equals(TASK_EDITOR_EXTENSION)) { >+ readEditorExtension(element); >+ } else if (element.getName().equals(REPOSITORY_ASSOCIATION)) { >+ readEditorExtensionAssociation(element); >+ } >+ } >+ } >+ } >+ >+ private static void readEditorExtension(IConfigurationElement element) { >+ try { >+ String id = element.getAttribute(ATTR_ID); >+ String name = element.getAttribute(ATTR_NAME); >+ AbstractTaskEditorExtension extension = (AbstractTaskEditorExtension) element.createExecutableExtension("class"); >+ TaskEditorExtensions.addTaskEditorExtension(id, name, extension); >+ } catch (CoreException e) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load taskEditorExtension", >+ e)); >+ } catch (Exception e) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load taskEditorExtension", >+ e)); >+ } >+ } >+ >+ private static void readEditorExtensionAssociation(IConfigurationElement element) { >+ try { >+ String repository = element.getAttribute("repository"); >+ String taskEditorExtension = element.getAttribute("taskEditorExtension"); >+ TaskEditorExtensions.addRepositoryAssociation(repository, taskEditorExtension); >+ } catch (Exception e) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load taskEditorExtension", >+ e)); >+ } >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/AbstractTaskEditorExtension.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/editors/AbstractTaskEditorExtension.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/editors/AbstractTaskEditorExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/AbstractTaskEditorExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui.editors; >+ >+import org.eclipse.jface.text.source.SourceViewer; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.contexts.IContextService; >+ >+/** >+ * An extension that provides task editor capabilities beyond the default, oriented towards providing markup-aware >+ * editing and viewing >+ * >+ * @author David Green >+ */ >+public abstract class AbstractTaskEditorExtension { >+ >+ /** >+ * Create a source viewer that can be used to view content in the task editor. The source viewer should be >+ * configured with a source viewer configuration prior to returning. >+ * >+ * @param taskRepository >+ * the task repository for which the viewer is created >+ * @param parent >+ * the control parent of the source viewer >+ * @param style >+ * the styles to use >+ */ >+ public abstract SourceViewer createViewer(TaskRepository taskRepository, Composite parent, int style); >+ >+ /** >+ * Create a source viewer that can be used to edit content in the task editor. The source viewer should be >+ * configured with a source viewer configuration prior to returning. >+ * >+ * @param taskRepository >+ * the task repository for which the viewer is created >+ * @param parent >+ * the control parent of the source viewer >+ * @param style >+ * the styles to use >+ */ >+ public abstract SourceViewer createEditor(TaskRepository taskRepository, Composite parent, int style); >+ >+ /** >+ * Get the editor context id, to be passed to the {@link IContextService} when the editor is in focus. >+ */ >+ public abstract String getEditorContextId(); >+} >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,161 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui.editors; >+ >+import java.util.HashMap; >+import java.util.Map; >+import java.util.SortedSet; >+import java.util.TreeSet; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.mylyn.commons.core.StatusHandler; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+ >+/** >+ * @author David Green >+ */ >+public class TaskEditorExtensions { >+ >+ public static final String REPOSITORY_PROPERTY_EDITOR_EXTENSION = "editorExtension"; >+ >+ private static Map<String, RegisteredTaskEditorExtension> extensionsById = new HashMap<String, RegisteredTaskEditorExtension>(); >+ >+ private static Map<String, String> associationByConnectorKind = new HashMap<String, String>(); >+ >+ private static boolean initialized; >+ >+ public static SortedSet<RegisteredTaskEditorExtension> getTaskEditorExtensions() { >+ return new TreeSet<RegisteredTaskEditorExtension>(extensionsById.values()); >+ } >+ >+ public static void addTaskEditorExtension(String id, String name, AbstractTaskEditorExtension extension) { >+ Assert.isNotNull(id); >+ RegisteredTaskEditorExtension previous = extensionsById.put(id, new RegisteredTaskEditorExtension(extension, >+ id, name)); >+ if (previous != null) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Duplicate taskEditorExtension id=" >+ + id, null)); >+ } >+ } >+ >+ public static void addRepositoryAssociation(String connectorKind, String extensionId) { >+ if (connectorKind == null || extensionId == null) { >+ throw new IllegalArgumentException(); >+ } >+ String previous = associationByConnectorKind.put(connectorKind, extensionId); >+ if (previous != null) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, String.format( >+ "Duplicate association for repository %s: %s replaces %s", connectorKind, extensionId, previous), >+ null)); >+ } >+ } >+ >+ /** >+ * get a task editor extension for a specific repository >+ * >+ * @param taskRepository >+ * @return the extension, or null if there is none >+ * >+ * @see #getDefaultTaskEditorExtension(TaskRepository) >+ */ >+ public static AbstractTaskEditorExtension getTaskEditorExtension(TaskRepository taskRepository) { >+ init(); >+ String extensionId = getTaskEditorExtensionId(taskRepository); >+ if (extensionId != null) { >+ RegisteredTaskEditorExtension taskEditorExtension = extensionsById.get(extensionId); >+ return taskEditorExtension == null ? null : taskEditorExtension.getExtension(); >+ } >+ return null; >+ } >+ >+ public static String getTaskEditorExtensionId(TaskRepository taskRepository) { >+ init(); >+ String id = taskRepository.getProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION); >+ if (id == null) { >+ id = getDefaultTaskEditorExtensionId(taskRepository); >+ } >+ return id; >+ } >+ >+ public static void setTaskEditorExtensionId(TaskRepository repository, String editorExtensionId) { >+ repository.setProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION, editorExtensionId); >+ } >+ >+ public static String getDefaultTaskEditorExtensionId(TaskRepository taskRepository) { >+ init(); >+ return associationByConnectorKind.get(taskRepository.getConnectorKind()); >+ } >+ >+ /** >+ * get a default task editor extension for a specific repository >+ * >+ * @param taskRepository >+ * @return the extension, or null if there is none >+ * >+ * @see #getTaskEditorExtension(TaskRepository) >+ */ >+ public static AbstractTaskEditorExtension getDefaultTaskEditorExtension(TaskRepository taskRepository) { >+ init(); >+ String extensionId = getDefaultTaskEditorExtensionId(taskRepository); >+ if (extensionId != null) { >+ RegisteredTaskEditorExtension taskEditorExtension = extensionsById.get(extensionId); >+ return taskEditorExtension == null ? null : taskEditorExtension.getExtension(); >+ } >+ return null; >+ } >+ >+ private static void init() { >+ if (!initialized) { >+ initialized = true; >+ TaskEditorExtensionReader.initExtensions(); >+ } >+ } >+ >+ public static class RegisteredTaskEditorExtension implements Comparable<RegisteredTaskEditorExtension> { >+ >+ private final String id; >+ >+ private final String name; >+ >+ private final AbstractTaskEditorExtension extension; >+ >+ private RegisteredTaskEditorExtension(AbstractTaskEditorExtension extension, String id, String name) { >+ this.extension = extension; >+ this.id = id; >+ this.name = name; >+ } >+ >+ public String getId() { >+ return id; >+ } >+ >+ public String getName() { >+ return name; >+ } >+ >+ public AbstractTaskEditorExtension getExtension() { >+ return extension; >+ } >+ >+ public int compareTo(RegisteredTaskEditorExtension o) { >+ if (o == this) { >+ return 0; >+ } >+ int i = name.compareTo(o.name); >+ if (i == 0) { >+ i = id.compareTo(o.id); >+ } >+ return i; >+ } >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 234212
: 103890