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 148315 Details for
Bug 206403
[Progress] IProgressConstants.ACTION_PROPERTY should be commands based
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 v03
ProgressCommandProperty 03.txt (text/plain), 26.45 KB, created by
Prakash Rangaraj
on 2009-09-29 08:08:47 EDT
(
hide
)
Description:
Patch v03
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2009-09-29 08:08:47 EDT
Size:
26.45 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/progress/CommandHandler.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/progress/CommandHandler.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/progress/CommandHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/progress/CommandHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package org.eclipse.ui.tests.progress; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.IHandler; >+ >+public class CommandHandler extends AbstractHandler implements IHandler { >+ >+ >+ public boolean executed; >+ public Object execute(ExecutionEvent event) { >+ executed = true; >+ return null; >+ } >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java,v >retrieving revision 1.1 >diff -u -r1.1 ProgressContantsTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java 4 Aug 2009 11:08:49 -0000 1.1 >+++ Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java 29 Sep 2009 11:36:14 -0000 >@@ -11,11 +11,17 @@ > > package org.eclipse.ui.tests.progress; > >+import org.eclipse.core.commands.Command; >+import org.eclipse.core.commands.ParameterizedCommand; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.commands.ICommandService; >+import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.internal.progress.JobInfo; > import org.eclipse.ui.internal.progress.ProgressInfoItem; > import org.eclipse.ui.internal.progress.ProgressView; >@@ -36,6 +42,46 @@ > super(testName); > } > >+ public void testCommandProperty() throws Exception { >+ >+ IWorkbenchWindow window = openTestWindow("org.eclipse.ui.resourcePerspective"); >+ ProgressView progressView = (ProgressView) window.getActivePage().showView(IPageLayout.ID_PROGRESS_VIEW); >+ assertNotNull(progressView); >+ processEvents(); >+ >+ DummyJob okJob = new DummyJob("OK Job", Status.OK_STATUS); >+ >+ IWorkbench workbench = PlatformUI.getWorkbench(); >+ ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class); >+ String commandId = "org.eclipse.ui.tests.progressViewCommand"; >+ Command command = commandService.getCommand(commandId); >+ ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, null); >+ okJob.setProperty(IProgressConstants.COMMAND_PROPERTY, parameterizedCommand); >+ okJob.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE); >+ okJob.schedule(); >+ >+ IHandlerService service = (IHandlerService) workbench.getService(IHandlerService.class); >+ CommandHandler handler = new CommandHandler(); >+ service.activateHandler(commandId, handler); >+ >+ okJob.join(); >+ >+ processEvents(); >+ >+ ProgressInfoItem[] progressInfoItems = progressView.getViewer().getProgressInfoItems(); >+ for (int i = 0; i < progressInfoItems.length; i++) { >+ JobInfo[] jobInfos = progressInfoItems[i].getJobInfos(); >+ for (int j = 0; j < jobInfos.length; j++) { >+ Job job = jobInfos[j].getJob(); >+ if (job.equals(okJob)) { >+ progressInfoItems[i].executeTrigger(); >+ } >+ } >+ } >+ >+ assertTrue(handler.executed); >+ } >+ > public void testKeepProperty() throws Exception { > > IWorkbenchWindow window = openTestWindow("org.eclipse.ui.resourcePerspective"); >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/plugin.xml,v >retrieving revision 1.283 >diff -u -r1.283 plugin.xml >--- plugin.xml 2 Sep 2009 17:50:44 -0000 1.283 >+++ plugin.xml 29 Sep 2009 11:36:14 -0000 >@@ -4215,6 +4215,10 @@ > id="org.eclipse.ui.commands.radioState"> > </state> > </command> >+ <command >+ id="org.eclipse.ui.tests.progressViewCommand" >+ name="Progress View Command"> >+ </command> > </extension> > <extension id="rcpSessionApplication" point="org.eclipse.core.runtime.applications"> > <application cardinality="singleton-global" thread="main" visible="true"> >#P org.eclipse.ui.workbench >Index: .settings/.api_filters >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/.settings/.api_filters,v >retrieving revision 1.8 >diff -u -r1.8 .api_filters >--- .settings/.api_filters 4 Mar 2009 19:16:47 -0000 1.8 >+++ .settings/.api_filters 29 Sep 2009 11:36:16 -0000 >@@ -1,16 +1,24 @@ >-<?xml version="1.0" encoding="UTF-8"?> >+<?xml version="1.0" encoding="UTF-8" standalone="no"?> > <component id="org.eclipse.ui.workbench" version="2"> >- <resource path="Eclipse UI/org/eclipse/ui/services/IEvaluationReference.java" type="org.eclipse.ui.services.IEvaluationReference"> >- <filter id="403853384"> >+ <resource path="Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java" type="org.eclipse.ui.branding.IBundleGroupConstants"> >+ <filter id="403767336"> > <message_arguments> >- <message_argument value="org.eclipse.ui.services.IEvaluationReference"/> >+ <message_argument value="org.eclipse.ui.branding.IBundleGroupConstants"/> >+ <message_argument value="BRANDING_BUNDLE_VERSION"/> >+ </message_arguments> >+ </filter> >+ <filter id="403767336"> >+ <message_arguments> >+ <message_argument value="org.eclipse.ui.branding.IBundleGroupConstants"/> >+ <message_argument value="BRANDING_BUNDLE_ID"/> > </message_arguments> > </filter> > </resource> >- <resource path="Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java" type="org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager"> >- <filter id="336744520"> >+ <resource path="Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java" type="org.eclipse.ui.menus.CommandContributionItemParameter"> >+ <filter id="338948223"> > <message_arguments> >- <message_argument value="org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager"/> >+ <message_argument value="org.eclipse.ui.menus.CommandContributionItemParameter"/> >+ <message_argument value="CommandContributionItemParameter(IServiceLocator, String, String, Map, ImageDescriptor, ImageDescriptor, ImageDescriptor, String, String, String, int, String, boolean)"/> > </message_arguments> > </filter> > </resource> >@@ -18,13 +26,13 @@ > <filter id="420630660"> > <message_arguments> > <message_argument value="org.eclipse.ui.part.MultiPageEditorPart"/> >- <message_argument value="getActivePage()"/> >+ <message_argument value="getActiveEditor()"/> > </message_arguments> > </filter> >- <filter id="421679236"> >+ <filter id="420630660"> > <message_arguments> > <message_argument value="org.eclipse.ui.part.MultiPageEditorPart"/> >- <message_argument value="getActiveEditor()"/> >+ <message_argument value="getActivePage()"/> > </message_arguments> > </filter> > <filter id="421679236"> >@@ -33,32 +41,25 @@ > <message_argument value="getActivePage()"/> > </message_arguments> > </filter> >- <filter id="420630660"> >+ <filter id="421679236"> > <message_arguments> > <message_argument value="org.eclipse.ui.part.MultiPageEditorPart"/> > <message_argument value="getActiveEditor()"/> > </message_arguments> > </filter> > </resource> >- <resource path="Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java" type="org.eclipse.ui.branding.IBundleGroupConstants"> >+ <resource path="Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java" type="org.eclipse.ui.progress.IProgressConstants"> > <filter id="403767336"> > <message_arguments> >- <message_argument value="org.eclipse.ui.branding.IBundleGroupConstants"/> >- <message_argument value="BRANDING_BUNDLE_ID"/> >- </message_arguments> >- </filter> >- <filter id="403767336"> >- <message_arguments> >- <message_argument value="org.eclipse.ui.branding.IBundleGroupConstants"/> >- <message_argument value="BRANDING_BUNDLE_VERSION"/> >+ <message_argument value="org.eclipse.ui.progress.IProgressConstants"/> >+ <message_argument value="COMMAND_PROPERTY"/> > </message_arguments> > </filter> > </resource> >- <resource path="Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java" type="org.eclipse.ui.menus.CommandContributionItemParameter"> >- <filter id="338948223"> >+ <resource path="Eclipse UI/org/eclipse/ui/services/IEvaluationReference.java" type="org.eclipse.ui.services.IEvaluationReference"> >+ <filter id="403853384"> > <message_arguments> >- <message_argument value="org.eclipse.ui.menus.CommandContributionItemParameter"/> >- <message_argument value="CommandContributionItemParameter(IServiceLocator, String, String, Map, ImageDescriptor, ImageDescriptor, ImageDescriptor, String, String, String, int, String, boolean)"/> >+ <message_argument value="org.eclipse.ui.services.IEvaluationReference"/> > </message_arguments> > </filter> > </resource> >@@ -69,4 +70,11 @@ > </message_arguments> > </filter> > </resource> >+ <resource path="Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java" type="org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager"> >+ <filter id="336744520"> >+ <message_arguments> >+ <message_argument value="org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager"/> >+ </message_arguments> >+ </filter> >+ </resource> > </component> >Index: Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java,v >retrieving revision 1.48 >diff -u -r1.48 AnimationItem.java >--- Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java 16 Mar 2007 18:00:37 -0000 1.48 >+++ Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java 29 Sep 2009 11:36:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2006 IBM Corporation and others. >+ * Copyright (c) 2003, 2009 IBM Corporation 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 >@@ -169,4 +169,11 @@ > void setAnimationContainer(IAnimationContainer container) { > this.animationContainer = container; > } >+ >+ /** >+ * @return Returns the window. >+ */ >+ public WorkbenchWindow getWindow() { >+ return window; >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java,v >retrieving revision 1.55 >diff -u -r1.55 ProgressAnimationItem.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java 1 Oct 2008 15:36:11 -0000 1.55 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java 29 Sep 2009 11:36:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2008 IBM Corporation and others. >+ * Copyright (c) 2004, 2009 IBM Corporation 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 >@@ -10,7 +10,13 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.progress; > >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.NotEnabledException; >+import org.eclipse.core.commands.NotHandledException; >+import org.eclipse.core.commands.ParameterizedCommand; >+import org.eclipse.core.commands.common.NotDefinedException; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.util.Util; >@@ -35,7 +41,9 @@ > import org.eclipse.swt.widgets.ProgressBar; > import org.eclipse.swt.widgets.ToolBar; > import org.eclipse.swt.widgets.ToolItem; >+import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.internal.WorkbenchImages; > import org.eclipse.ui.progress.IProgressConstants; > import org.eclipse.ui.statushandlers.StatusAdapter; >@@ -109,30 +117,10 @@ > StatusManager.getManager().handle(statusAdapter, > StatusManager.SHOW); > >- JobTreeElement topElement = (JobTreeElement) ji >- .getParent(); >- if (topElement == null) { >- topElement = ji; >- } >- FinishedJobs.getInstance().remove(topElement); >+ removeTopElement(ji); > } > >- IAction action = null; >- Object property = job >- .getProperty(IProgressConstants.ACTION_PROPERTY); >- if (property instanceof IAction) { >- action = (IAction) property; >- } >- if (action != null && action.isEnabled()) { >- action.run(); >- JobTreeElement topElement = (JobTreeElement) ji >- .getParent(); >- if (topElement == null) { >- topElement = ji; >- } >- FinishedJobs.getInstance().remove(topElement); >- return; >- } >+ execute(ji, job); > } > } > } >@@ -141,6 +129,60 @@ > refresh(); > } > >+ /** >+ * @param ji >+ * @param job >+ */ >+ private void execute(JobInfo ji, Job job) { >+ >+ Object prop = job.getProperty(IProgressConstants.ACTION_PROPERTY); >+ if (prop instanceof IAction && ((IAction) prop).isEnabled()) { >+ IAction action = (IAction) prop; >+ action.run(); >+ removeTopElement(ji); >+ } >+ >+ prop = job.getProperty(IProgressConstants.COMMAND_PROPERTY); >+ if (prop instanceof ParameterizedCommand) { >+ ParameterizedCommand command = (ParameterizedCommand) prop; >+ IWorkbenchWindow window = getWindow(); >+ IHandlerService service = (IHandlerService) window >+ .getService(IHandlerService.class); >+ Exception exception = null; >+ try { >+ service.executeCommand(command, null); >+ removeTopElement(ji); >+ } catch (ExecutionException e) { >+ exception = e; >+ } catch (NotDefinedException e) { >+ exception = e; >+ } catch (NotEnabledException e) { >+ exception = e; >+ } catch (NotHandledException e) { >+ exception = e; >+ } >+ >+ if (exception != null) { >+ Status status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, >+ exception.getMessage(), exception); >+ StatusManager.getManager().handle(status, >+ StatusManager.LOG | StatusManager.SHOW); >+ } >+ >+ } >+ } >+ >+ /** >+ * @param ji >+ */ >+ private void removeTopElement(JobInfo ji) { >+ JobTreeElement topElement = (JobTreeElement) ji.getParent(); >+ if (topElement == null) { >+ topElement = ji; >+ } >+ FinishedJobs.getInstance().remove(topElement); >+ } >+ > private IAction getAction(Job job) { > Object property = job.getProperty(IProgressConstants.ACTION_PROPERTY); > if (property instanceof IAction) { >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java,v >retrieving revision 1.54 >diff -u -r1.54 ProgressInfoItem.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java 10 Sep 2009 08:54:34 -0000 1.54 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java 29 Sep 2009 11:36:17 -0000 >@@ -1,7 +1,7 @@ > package org.eclipse.ui.internal.progress; > > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation 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 >@@ -16,8 +16,14 @@ > import java.util.Date; > import java.util.Iterator; > import java.util.List; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.NotEnabledException; >+import org.eclipse.core.commands.NotHandledException; >+import org.eclipse.core.commands.ParameterizedCommand; >+import org.eclipse.core.commands.common.NotDefinedException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.dialogs.Dialog; >@@ -49,9 +55,12 @@ > import org.eclipse.swt.widgets.ProgressBar; > import org.eclipse.swt.widgets.ToolBar; > import org.eclipse.swt.widgets.ToolItem; >+import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.internal.WorkbenchImages; > import org.eclipse.ui.progress.IProgressConstants; >+import org.eclipse.ui.statushandlers.StatusManager; > > /** > * ProgressInfoItem is the item used to show jobs. >@@ -93,7 +102,7 @@ > > private static final String TEXT_KEY = "Text"; //$NON-NLS-1$ > >- private static final String ACTION_KEY = "Action";//$NON-NLS-1$ >+ private static final String TRIGGER_KEY = "Trigger";//$NON-NLS-1$ > > interface IndexListener { > /** >@@ -124,6 +133,8 @@ > > private ResourceManager resourceManager; > >+ private Link link; >+ > static { > JFaceResources > .getImageRegistry() >@@ -231,7 +242,6 @@ > actionButton.setEnabled(false); > cancelOrRemove(); > } >- > }); > actionBar.addListener(SWT.Traverse, new Listener() { > /* >@@ -728,7 +738,6 @@ > */ > void setLinkText(Job linkJob, String taskString, int index) { > >- Link link; > if (index >= taskEntries.size()) {// Is it new? > link = new Link(this, SWT.NONE); > >@@ -756,8 +765,6 @@ > > link.setLayoutData(linkData); > >- final Link finalLink = link; >- > link.addSelectionListener(new SelectionAdapter() { > /* > * (non-Javadoc) >@@ -765,18 +772,7 @@ > * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) > */ > public void widgetSelected(SelectionEvent e) { >- >- IAction action = (IAction) finalLink.getData(ACTION_KEY); >- action.run(); >- >- updateAction(action, finalLink); >- >- Object text = finalLink.getData(TEXT_KEY); >- if (text == null) >- return; >- >- // Refresh the text as enablement might have changed >- updateText((String) text, finalLink); >+ executeTrigger(); > } > }); > >@@ -788,11 +784,11 @@ > */ > public void handleEvent(Event event) { > >- Object text = finalLink.getData(TEXT_KEY); >+ Object text = link.getData(TEXT_KEY); > if (text == null) > return; > >- updateText((String) text, finalLink); >+ updateText((String) text, link); > > } > }); >@@ -805,28 +801,87 @@ > link.setData(TEXT_KEY, taskString); > > // check for action property >- Object property = linkJob >+ Object actionProperty = linkJob > .getProperty(IProgressConstants.ACTION_PROPERTY); >- updateAction(property, link); >+ Object commandProperty = linkJob >+ .getProperty(IProgressConstants.COMMAND_PROPERTY); >+ >+ if (actionProperty != null && commandProperty != null) { >+ // if both are specified, then use neither >+ updateTrigger(null, link); >+ } else { >+ Object property = actionProperty != null ? actionProperty >+ : commandProperty; >+ updateTrigger(property, link); >+ } > > updateText(taskString, link); > > } > >+ public void executeTrigger() { >+ >+ Object data = link.getData(TRIGGER_KEY); >+ if (data instanceof IAction) { >+ IAction action = (IAction) data; >+ if (action.isEnabled()) >+ action.run(); >+ updateTrigger(action, link); >+ } else if (data instanceof ParameterizedCommand) { >+ IWorkbench workbench = PlatformUI >+ .getWorkbench(); >+ IHandlerService handlerService = (IHandlerService) workbench >+ .getService( >+ IHandlerService.class); >+ IStatus status = Status.OK_STATUS; >+ try { >+ handlerService >+ .executeCommand((ParameterizedCommand) data, null); >+ } catch (ExecutionException e) { >+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e >+ .getMessage(), e); >+ } catch (NotDefinedException e) { >+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e >+ .getMessage(), e); >+ } catch (NotEnabledException e) { >+ status = new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID, e >+ .getMessage(), e); >+ } catch (NotHandledException e) { >+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e >+ .getMessage(), e); >+ } >+ >+ if (!status.isOK()) { >+ StatusManager.getManager().handle(status, >+ StatusManager.LOG | StatusManager.SHOW); >+ } >+ } >+ >+ Object text = link.getData(TEXT_KEY); >+ if (text == null) >+ return; >+ >+ // Refresh the text as enablement might have changed >+ updateText((String) text, link); >+ } >+ > /** >- * Update the action key if action is enabled or remove it if not >+ * Update the trigger key if either action is available and enabled or >+ * command is available > * >- * @param action >+ * @param trigger > * {@link Object} or <code>null</code> > * @param link > */ >- private void updateAction(Object action, Link link) { >+ private void updateTrigger(Object trigger, Link link) { > >- if (action != null && action instanceof IAction >- && ((IAction) action).isEnabled()) >- link.setData(ACTION_KEY, action); >- else >- link.setData(ACTION_KEY, null); >+ if (trigger instanceof IAction && ((IAction) trigger).isEnabled()) { >+ link.setData(TRIGGER_KEY, trigger); >+ } else if (trigger instanceof ParameterizedCommand) { >+ link.setData(TRIGGER_KEY, trigger); >+ } else { >+ link.setData(TRIGGER_KEY, null); >+ } > > } > >@@ -840,7 +895,7 @@ > taskString = Dialog.shortenText(taskString, link); > > // Put in a hyperlink if there is an action >- link.setText(link.getData(ACTION_KEY) == null ? taskString : NLS.bind( >+ link.setText(link.getData(TRIGGER_KEY) == null ? taskString : NLS.bind( > "<a>{0}</a>", taskString));//$NON-NLS-1$ > } > >Index: Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java,v >retrieving revision 1.11 >diff -u -r1.11 IProgressConstants.java >--- Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java 8 May 2006 20:55:31 -0000 1.11 >+++ Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java 29 Sep 2009 11:36:17 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * Copyright (c) 2004, 2009 IBM Corporation 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 >@@ -63,25 +63,47 @@ > public static final QualifiedName KEEPONE_PROPERTY = new QualifiedName( > PROPERTY_PREFIX, "keepone"); //$NON-NLS-1$ > >- /** >- * This property is used to associate an <code>IAction</code> with a Job. >- * If the Job is shown in the UI, the action might be represented as a button or >- * hyper link to allow the user to trigger a job specific action, like showing >- * the Job's results. >- * <p> >- * The progress UI will track the enabled state of the action and its tooltip text. >- * </p> >- * <p> >- * If the action implements <code>ActionFactory.IWorkbenchAction</code>, its >- * <code>dispose</code> method will be called as soon as the Job is finally >- * removed from the set of kept jobs. >- * </p> >- * @see org.eclipse.jface.action.IAction >- * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction >- **/ >+ /** >+ * This property is used to associate an <code>IAction</code> with a Job. If >+ * the Job is shown in the UI, the action might be represented as a button >+ * or hyper link to allow the user to trigger a job specific action, like >+ * showing the Job's results. >+ * <p> >+ * The progress UI will track the enabled state of the action and its >+ * tooltip text. >+ * </p> >+ * <p> >+ * If the action implements <code>ActionFactory.IWorkbenchAction</code>, its >+ * <code>dispose</code> method will be called as soon as the Job is finally >+ * removed from the set of kept jobs. >+ * </p> >+ * <p> >+ * Note: Only one of <code>ACTION_PROPERTY</code> or >+ * <code>COMMAND_PROPERTY</code> should be used >+ * </p> >+ * >+ * @see org.eclipse.jface.action.IAction >+ * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction >+ **/ > public static final QualifiedName ACTION_PROPERTY = new QualifiedName( > PROPERTY_PREFIX, "action"); //$NON-NLS-1$ > >+ /** >+ * This property is used to associate a <code>ParameterizedCommand</code> >+ * with a Job. If the Job is shown in the UI, the command might be >+ * represented as a button or hyper link to allow the user to trigger a job >+ * specific action, like showing the Job's results. >+ * <p> >+ * Note: Only one of <code>ACTION_PROPERTY</code> or >+ * <code>COMMAND_PROPERTY</code> should be used >+ * </p> >+ * >+ * @see org.eclipse.core.commands.ParameterizedCommand >+ * @since 3.6 >+ **/ >+ public static final QualifiedName COMMAND_PROPERTY = new QualifiedName( >+ PROPERTY_PREFIX, "command"); //$NON-NLS-1$ >+ > /** > * This property is used to associate an <code>ImageDescriptor</code> with a Job. > * If the Job is shown in the UI, this descriptor is used to create an icon that
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 206403
:
146431
|
147924
| 148315