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 131092 Details for
Bug 175134
"Add to Java Search" needs to be easier to find
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Inital stab at fix
patch.txt (text/plain), 16.94 KB, created by
Dani Megert
on 2009-04-07 03:15:49 EDT
(
hide
)
Description:
Inital stab at fix
Filename:
MIME Type:
Creator:
Dani Megert
Created:
2009-04-07 03:15:49 EDT
Size:
16.94 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchActionGroup.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchActionGroup.java,v >retrieving revision 1.5 >diff -u -r1.5 JavaSearchActionGroup.java >--- src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchActionGroup.java 16 Jan 2008 17:08:29 -0000 1.5 >+++ src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchActionGroup.java 7 Apr 2009 07:14:53 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 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,42 +10,20 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.ui.views.plugins; > >-import java.lang.reflect.InvocationTargetException; >-import java.util.ArrayList; > import java.util.Iterator; > import org.eclipse.core.runtime.IAdaptable; >-import org.eclipse.jface.action.*; >-import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.action.IMenuManager; >+import org.eclipse.jface.action.Separator; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.internal.core.PDECore; > import org.eclipse.pde.internal.core.SearchablePluginsManager; >-import org.eclipse.pde.internal.ui.PDEPlugin; >-import org.eclipse.pde.internal.ui.PDEUIMessages; >-import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.actions.ActionContext; > import org.eclipse.ui.actions.ActionGroup; > > public class JavaSearchActionGroup extends ActionGroup { > >- class JavaSearchAction extends Action { >- >- private boolean add; >- >- public JavaSearchAction(boolean add) { >- this.add = add; >- if (add) >- setText(PDEUIMessages.PluginsView_addToJavaSearch); >- else >- setText(PDEUIMessages.PluginsView_removeFromJavaSearch); >- } >- >- public void run() { >- handleJavaSearch(add); >- } >- } >- > public void fillContextMenu(IMenuManager menu) { > ActionContext context = getContext(); > ISelection selection = context.getSelection(); >@@ -55,11 +33,11 @@ > boolean addSeparator = false; > > if (canDoJavaSearchOperation(sSelection, true)) { >- menu.add(new JavaSearchAction(true)); >+ menu.add(new AddToJavaSearchAction(sSelection)); > addSeparator = true; > } > if (canDoJavaSearchOperation(sSelection, false)) { >- menu.add(new JavaSearchAction(false)); >+ menu.add(new RemoveFromJavaSearchAction(sSelection)); > addSeparator = true; > } > if (addSeparator) { >@@ -85,7 +63,7 @@ > return nhits > 0; > } > >- private IPluginModelBase getModel(Object object) { >+ IPluginModelBase getModel(Object object) { > IPluginModelBase model = null; > if (object instanceof IAdaptable) { > model = (IPluginModelBase) ((IAdaptable) object).getAdapter(IPluginModelBase.class); >@@ -95,30 +73,4 @@ > return model; > } > >- private void handleJavaSearch(final boolean add) { >- IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); >- if (selection.size() == 0) >- return; >- >- ArrayList result = new ArrayList(); >- SearchablePluginsManager manager = PDECore.getDefault().getSearchablePluginsManager(); >- for (Iterator iter = selection.iterator(); iter.hasNext();) { >- IPluginModelBase model = getModel(iter.next()); >- if (model != null && model.getUnderlyingResource() == null && manager.isInJavaSearch(model.getPluginBase().getId()) != add) { >- result.add(model); >- } >- } >- if (result.size() == 0) >- return; >- final IPluginModelBase[] array = (IPluginModelBase[]) result.toArray(new IPluginModelBase[result.size()]); >- >- IRunnableWithProgress op = new JavaSearchOperation(array, add); >- try { >- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(op); >- } catch (InterruptedException e) { >- } catch (InvocationTargetException e) { >- PDEPlugin.logException(e); >- } >- } >- > } >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/plugin.properties,v >retrieving revision 1.226 >diff -u -r1.226 plugin.properties >--- plugin.properties 2 Apr 2009 22:25:06 -0000 1.226 >+++ plugin.properties 7 Apr 2009 07:14:53 -0000 >@@ -125,6 +125,10 @@ > UpdateClasspathAction.label= &Update Classpath... > UpdateClasspathAction.description=Updates classpath with the settings specified in the manifest files > >+AddToJavaSearchAction.label=&Add to Java Search >+ >+RemoveFromJavaSearchAction.label=Remove &from Java Search >+ > OpenDependenciesAction.label= Ope&n Dependencies > > launcher.shortcut.label= Eclipse Application >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/plugin.xml,v >retrieving revision 1.462 >diff -u -r1.462 plugin.xml >--- plugin.xml 2 Apr 2009 22:25:06 -0000 1.462 >+++ plugin.xml 7 Apr 2009 07:14:53 -0000 >@@ -502,7 +502,7 @@ > description="%pluginsearch.action.desc" > id="org.eclipse.pde.ui.openPluginArtifact" > name="%pluginsearch.action.name"> >- </command> >+ </command> > <command > description="%addpluginstojavasearch.action.desc" > id="org.eclipse.pde.ui.addAllPluginsToJavaSearch" >@@ -747,32 +747,31 @@ > name="group0"> > </separator> > </menu> >- <visibility> >- <not> >- <or> >- <objectState >- name="projectNature" >- value="org.eclipse.pde.PluginNature"/> >- <objectState >- name="projectNature" >- value="org.eclipse.pde.FeatureNature"/> >- <objectState >- name="projectNature" >- value="org.eclipse.pde.UpdateSiteNature"/> >- <objectState >- name="open" >- value="false"/> >- </or> >- </not> >- </visibility> > > <action >+ label="%RemoveFromJavaSearchAction.label" >+ helpContextId="org.eclipse.pde.doc.user.remove_from_java_search" >+ class="org.eclipse.pde.internal.ui.views.plugins.RemoveFromJavaSearchAction" >+ menubarPath="org.eclipse.pde.ui.project.tools/group2" >+ enablesFor="*" >+ id="org.eclipse.pde.ui.RemoveFromJavaSearchAction"> >+ </action> >+ <action >+ label="%AddToJavaSearchAction.label" >+ helpContextId="org.eclipse.pde.doc.user.add_to_java_search" >+ class="org.eclipse.pde.internal.ui.views.plugins.AddToJavaSearchAction" >+ menubarPath="org.eclipse.pde.ui.project.tools/group2" >+ enablesFor="*" >+ id="org.eclipse.pde.ui.AddToJavaSearchAction"> >+ </action> >+ <action > label="%new.convert.name" > class="org.eclipse.pde.internal.ui.wizards.tools.ConvertProjectsAction" > menubarPath="org.eclipse.ui.projectConfigure/additions" > enablesFor="+" > id="org.eclipse.pde.ui.ConvertedProjectWizard"> > </action> >+ > </objectContribution> > <objectContribution > adaptable="false" >@@ -815,14 +814,6 @@ > value="org.eclipse.pde.PluginNature"> > </filter> > <action >- label="%OpenDependenciesAction.label" >- helpContextId="org.eclipse.pde.doc.user.open_dependencies" >- class="org.eclipse.pde.internal.ui.views.dependencies.OpenDependenciesAction" >- menubarPath="org.eclipse.pde.ui.project.tools/group2" >- enablesFor="+" >- id="org.eclipse.pde.ui.OpenDependenciesAction3"> >- </action> >- <action > label="%UpdateClasspathAction.label" > helpContextId="org.eclipse.pde.doc.user.update_classpath" > class="org.eclipse.pde.internal.ui.wizards.tools.UpdateClasspathAction" >@@ -830,6 +821,14 @@ > enablesFor="*" > id="org.eclipse.pde.ui.UpdateClasspathAction3"> > </action> >+ <action >+ label="%OpenDependenciesAction.label" >+ helpContextId="org.eclipse.pde.doc.user.open_dependencies" >+ class="org.eclipse.pde.internal.ui.views.dependencies.OpenDependenciesAction" >+ menubarPath="org.eclipse.pde.ui.project.tools/group2" >+ enablesFor="+" >+ id="org.eclipse.pde.ui.OpenDependenciesAction3"> >+ </action> > <action > label="%Internationalize.label" > class="org.eclipse.pde.internal.ui.nls.InternationalizeAction" >@@ -1092,10 +1091,10 @@ > <objectClass > name="org.eclipse.core.resources.IProject"> > </objectClass> >- <objectState >- name="persistentProperty" >- value="org.eclipse.pde.core.imported = binary"> >- </objectState> >+ <objectState >+ name="persistentProperty" >+ value="org.eclipse.pde.core.imported = binary"> >+ </objectState> > </and> > </enablement> > </decorator> >Index: src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchAction.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchAction.java >diff -N src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/views/plugins/JavaSearchAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,101 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.views.plugins; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.ArrayList; >+import java.util.Iterator; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.SearchablePluginsManager; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.ui.*; >+ >+abstract class JavaSearchAction extends Action implements IWorkbenchWindowActionDelegate { >+ >+ private boolean fIsToAdd; >+ private IStructuredSelection fSelection; >+ >+ protected JavaSearchAction(boolean add, IStructuredSelection selection) { >+ fIsToAdd = add; >+ fSelection = selection; >+ } >+ >+ public void run() { >+ if (fSelection.size() == 0) >+ return; >+ >+ ArrayList result = new ArrayList(); >+ SearchablePluginsManager manager = PDECore.getDefault().getSearchablePluginsManager(); >+ for (Iterator iter = fSelection.iterator(); iter.hasNext();) { >+ IPluginModelBase model = getModel(iter.next()); >+ if (model != null && model.getUnderlyingResource() == null && manager.isInJavaSearch(model.getPluginBase().getId()) != fIsToAdd) { >+ result.add(model); >+ } >+ } >+ if (result.size() == 0) >+ return; >+ final IPluginModelBase[] array = (IPluginModelBase[]) result.toArray(new IPluginModelBase[result.size()]); >+ >+ IRunnableWithProgress op = new JavaSearchOperation(array, fIsToAdd); >+ try { >+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(op); >+ } catch (InterruptedException e) { >+ } catch (InvocationTargetException e) { >+ PDEPlugin.logException(e); >+ } >+ } >+ >+ IPluginModelBase getModel(Object object) { >+ IPluginModelBase model = null; >+ if (object instanceof IAdaptable) { >+ model = (IPluginModelBase) ((IAdaptable) object).getAdapter(IPluginModelBase.class); >+ } else if (object instanceof IPluginModelBase) { >+ model = (IPluginModelBase) object; >+ } >+ return model; >+ } >+ >+ /* >+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() >+ */ >+ public void dispose() { >+ fSelection = null; >+ } >+ >+ /* >+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) >+ */ >+ public void init(IWorkbenchWindow window) { >+ } >+ >+ /* >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ public void run(IAction action) { >+ run(); >+ } >+ >+ /* >+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >+ */ >+ public void selectionChanged(IAction action, ISelection selection) { >+ if (selection instanceof IStructuredSelection) >+ fSelection = (IStructuredSelection) selection; >+ } >+ >+} >\ No newline at end of file >Index: src/org/eclipse/pde/internal/ui/views/plugins/AddToJavaSearchAction.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/views/plugins/AddToJavaSearchAction.java >diff -N src/org/eclipse/pde/internal/ui/views/plugins/AddToJavaSearchAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/views/plugins/AddToJavaSearchAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.views.plugins; >+ >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+ >+ >+/** >+ * Action which adds the selected elements from Java search. >+ * >+ * @since 3.5 >+ */ >+public class AddToJavaSearchAction extends JavaSearchAction { >+ >+ public AddToJavaSearchAction() { >+ super(true, null); >+ setText(PDEUIMessages.PluginsView_addToJavaSearch); >+ } >+ >+ public AddToJavaSearchAction(IStructuredSelection selection) { >+ super(true, selection); >+ setText(PDEUIMessages.PluginsView_addToJavaSearch); >+ } >+ >+} >Index: src/org/eclipse/pde/internal/ui/views/plugins/RemoveFromJavaSearchAction.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/views/plugins/RemoveFromJavaSearchAction.java >diff -N src/org/eclipse/pde/internal/ui/views/plugins/RemoveFromJavaSearchAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/views/plugins/RemoveFromJavaSearchAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.views.plugins; >+ >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+ >+ >+/** >+ * Action which removes the selected elements from Java search. >+ * >+ * @since 3.5 >+ */ >+public class RemoveFromJavaSearchAction extends JavaSearchAction { >+ >+ public RemoveFromJavaSearchAction() { >+ super(false, null); >+ setText(PDEUIMessages.PluginsView_removeFromJavaSearch); >+ } >+ >+ public RemoveFromJavaSearchAction(IStructuredSelection selection) { >+ super(false, selection); >+ } >+ >+}
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 175134
:
131092
|
148129
|
148312
|
148361