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 188115 Details for
Bug 332734
tooltips missing in Task Editor
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]
backwards compatible approach using delegate
clipboard.txt (text/plain), 8.43 KB, created by
Steffen Pingel
on 2011-02-02 00:55:53 EST
(
hide
)
Description:
backwards compatible approach using delegate
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2011-02-02 00:55:53 EST
Size:
8.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java,v >retrieving revision 1.7 >diff -u -r1.7 TaskHyperlinkPresenter.java >--- src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java 12 Nov 2010 21:04:30 -0000 1.7 >+++ src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java 2 Feb 2011 05:55:24 -0000 >@@ -12,15 +12,22 @@ > > package org.eclipse.mylyn.tasks.ui; > >+import java.lang.reflect.Method; > import java.util.Iterator; > >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.text.DocumentEvent; >+import org.eclipse.jface.text.IDocument; > import org.eclipse.jface.text.IRegion; > import org.eclipse.jface.text.ITextViewer; > import org.eclipse.jface.text.TextPresentation; > import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter; > import org.eclipse.jface.text.hyperlink.IHyperlink; > import org.eclipse.jface.text.hyperlink.MultipleHyperlinkPresenter; >+import org.eclipse.jface.util.PropertyChangeEvent; >+import org.eclipse.mylyn.commons.core.StatusHandler; > import org.eclipse.mylyn.internal.tasks.core.TaskList; > import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.internal.tasks.ui.editors.Messages; >@@ -28,6 +35,7 @@ > import org.eclipse.mylyn.tasks.core.ITask; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.custom.StyleRange; >+import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.RGB; > > /** >@@ -51,11 +59,21 @@ > > private ITextViewer textViewer; > >+ private String oldToolTip; >+ >+ private boolean restoreToolTip; >+ >+ // TODO e3.7 remove all references to delegate and replace with calls to super methods >+ private final MultipleHyperlinkPresenter delegate; >+ >+ private boolean errorLogged; >+ > /** > * @see DefaultHyperlinkPresenter#DefaultHyperlinkPresenter(IPreferenceStore) > */ > public TaskHyperlinkPresenter(IPreferenceStore store) { > super(store); >+ delegate = new MultipleHyperlinkPresenter(store); > } > > /** >@@ -63,25 +81,26 @@ > */ > public TaskHyperlinkPresenter(RGB color) { > super(color); >+ delegate = new MultipleHyperlinkPresenter(color); > } > > @Override > public void install(ITextViewer textViewer) { > this.textViewer = textViewer; >- super.install(textViewer); >+ delegate.install(textViewer); > } > > @Override > public void uninstall() { > hideHyperlinks(); > this.textViewer = null; >- super.uninstall(); >+ delegate.uninstall(); > } > > @SuppressWarnings("unchecked") > @Override > public void applyTextPresentation(TextPresentation textPresentation) { >- super.applyTextPresentation(textPresentation); >+ delegate.applyTextPresentation(textPresentation); > // decorate hyperlink as strike-through if task is completed, this is now also handled by TaskHyperlinkTextPresentationManager > if (activeRegion != null && currentTask != null && currentTask.isCompleted()) { > Iterator<StyleRange> styleRangeIterator = textPresentation.getAllStyleRangeIterator(); >@@ -95,57 +114,115 @@ > } > } > >+ // TODO e3.7 remove method > @Override > public void showHyperlinks(IHyperlink[] hyperlinks) { >- if (hyperlinks.length > 1) { >- super.showHyperlinks(hyperlinks); >- } else { >- activeRegion = null; >- if (hyperlinks.length > 0 && hyperlinks[0] instanceof TaskHyperlink) { >- TaskHyperlink hyperlink = (TaskHyperlink) hyperlinks[0]; >- >- TaskList taskList = TasksUiPlugin.getTaskList(); >- String repositoryUrl = hyperlink.getRepository().getRepositoryUrl(); >- >- ITask task = taskList.getTask(repositoryUrl, hyperlink.getTaskId()); >- if (task == null) { >- task = taskList.getTaskByKey(repositoryUrl, hyperlink.getTaskId()); >- } >+ showHyperlinks(hyperlinks, false); >+ } >+ >+ // TODO e3.7 add @Override annotation >+ public void showHyperlinks(IHyperlink[] hyperlinks, boolean takesFocusWhenVisible) { >+ activeRegion = null; >+ // show task name in tooltip >+ if (hyperlinks.length == 1 && hyperlinks[0] instanceof TaskHyperlink) { >+ TaskHyperlink hyperlink = (TaskHyperlink) hyperlinks[0]; >+ >+ TaskList taskList = TasksUiPlugin.getTaskList(); >+ String repositoryUrl = hyperlink.getRepository().getRepositoryUrl(); >+ >+ ITask task = taskList.getTask(repositoryUrl, hyperlink.getTaskId()); >+ if (task == null) { >+ task = taskList.getTaskByKey(repositoryUrl, hyperlink.getTaskId()); >+ } > >- if (!hyperlinks[0].equals(currentTaskHyperlink)) { >- currentTaskHyperlink = (TaskHyperlink) hyperlinks[0]; >- currentTask = task; >- activeRegion = hyperlink.getHyperlinkRegion(); >- if (textViewer != null && textViewer.getTextWidget() != null >- && !textViewer.getTextWidget().isDisposed()) { >- if (task == null) { >- String taskLabel = TasksUiInternal.getTaskPrefix(hyperlink.getRepository() >- .getConnectorKind()); >- taskLabel += currentTaskHyperlink.getTaskId(); >- textViewer.getTextWidget().setToolTipText( >- NLS.bind(Messages.TaskHyperlinkPresenter_Not_In_Task_List, taskLabel)); >- } else if (task.getTaskKey() == null) { >- textViewer.getTextWidget().setToolTipText(task.getSummary()); >- } else { >- textViewer.getTextWidget().setToolTipText(task.getTaskKey() + ": " + task.getSummary()); //$NON-NLS-1$ >- } >+ if (!hyperlinks[0].equals(currentTaskHyperlink)) { >+ currentTaskHyperlink = (TaskHyperlink) hyperlinks[0]; >+ currentTask = task; >+ activeRegion = hyperlink.getHyperlinkRegion(); >+ if (textViewer != null && textViewer.getTextWidget() != null >+ && !textViewer.getTextWidget().isDisposed()) { >+ oldToolTip = textViewer.getTextWidget().getToolTipText(); >+ restoreToolTip = true; >+ if (task == null) { >+ String taskLabel = TasksUiInternal.getTaskPrefix(hyperlink.getRepository().getConnectorKind()); >+ taskLabel += currentTaskHyperlink.getTaskId(); >+ textViewer.getTextWidget().setToolTipText( >+ NLS.bind(Messages.TaskHyperlinkPresenter_Not_In_Task_List, taskLabel)); >+ } else if (task.getTaskKey() == null) { >+ textViewer.getTextWidget().setToolTipText(task.getSummary()); >+ } else { >+ textViewer.getTextWidget().setToolTipText(task.getTaskKey() + ": " + task.getSummary()); //$NON-NLS-1$ > } > } > } >- super.showHyperlinks(hyperlinks); >+ } >+ >+ // invoke super implementation >+ >+ try { >+ // Eclipse 3.7 >+ Method method = MultipleHyperlinkPresenter.class.getDeclaredMethod("showHyperlinks", //$NON-NLS-1$ >+ IHyperlink[].class, boolean.class); >+ method.invoke(delegate, hyperlinks, takesFocusWhenVisible); >+ } catch (NoSuchMethodException e) { >+ // Eclipse 3.6 and earlier >+ delegate.showHyperlinks(hyperlinks); >+ } catch (Exception e) { >+ if (!errorLogged) { >+ errorLogged = true; >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, >+ "Unexpected error while displaying hyperlink", e)); //$NON-NLS-1$ >+ } > } > } > > @Override > public void hideHyperlinks() { > if (currentTaskHyperlink != null) { >- if (textViewer != null && textViewer.getTextWidget() != null && !textViewer.getTextWidget().isDisposed()) { >- textViewer.getTextWidget().setToolTipText(null); >+ if (restoreToolTip && textViewer != null && textViewer.getTextWidget() != null >+ && !textViewer.getTextWidget().isDisposed()) { >+ textViewer.getTextWidget().setToolTipText(oldToolTip); >+ restoreToolTip = false; > } > currentTaskHyperlink = null; > currentTask = null; > } >- super.hideHyperlinks(); >+ delegate.hideHyperlinks(); >+ } >+ >+ @Override >+ public boolean canHideHyperlinks() { >+ return delegate.canHideHyperlinks(); >+ } >+ >+ @Override >+ public boolean canShowMultipleHyperlinks() { >+ return delegate.canShowMultipleHyperlinks(); >+ } >+ >+ @Override >+ public void documentAboutToBeChanged(DocumentEvent event) { >+ delegate.documentAboutToBeChanged(event); >+ } >+ >+ @Override >+ public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { >+ delegate.inputDocumentAboutToBeChanged(oldInput, newInput); >+ } >+ >+ @Override >+ public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { >+ delegate.inputDocumentChanged(oldInput, newInput); >+ } >+ >+ @Override >+ public void propertyChange(PropertyChangeEvent event) { >+ delegate.propertyChange(event); >+ } >+ >+ @Override >+ public void setColor(Color color) { >+ delegate.setColor(color); > } > > }
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 332734
:
185674
|
185680
|
185681
|
185790
|
185791
| 188115