From 2390ae9b30d49be61b338c1f23f79663d403b36d Mon Sep 17 00:00:00 2001 From: incastrix Date: Wed, 23 Dec 2009 17:42:01 +0000 Subject: [PATCH 1/1] Refactory: remove unused classes, imports, fields and methods. --- .../phpdt/ui/actions/CustomFiltersActionGroup.java | 76 ++++++++++---------- .../phpdt/ui/actions/GenerateActionGroup.java | 8 +- .../phpdt/ui/actions/MemberFilterActionGroup.java | 30 ++++---- .../phpdt/ui/actions/OpenEditorActionGroup.java | 20 +++--- 4 files changed, 67 insertions(+), 67 deletions(-) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java index e1e546e..74abea1 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/CustomFiltersActionGroup.java @@ -23,7 +23,7 @@ import java.util.Stack; import java.util.StringTokenizer; import java.util.TreeSet; -import net.sourceforge.phpdt.core.IJavaModel; +//import net.sourceforge.phpdt.core.IJavaModel; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import net.sourceforge.phpdt.internal.ui.filters.CustomFiltersDialog; import net.sourceforge.phpdt.internal.ui.filters.FilterDescriptor; @@ -44,8 +44,8 @@ import org.eclipse.jface.preference.IPreferenceStore; //incastrix //import org.eclipse.jface.text.Assert; import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; +//import org.eclipse.jface.viewers.IContentProvider; +//import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jface.window.Window; @@ -56,7 +56,7 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IMemento; -import org.eclipse.ui.IViewPart; +//import org.eclipse.ui.IViewPart; import org.eclipse.ui.actions.ActionGroup; /** @@ -234,9 +234,9 @@ public class CustomFiltersActionGroup extends ActionGroup { * @param viewer * the viewer to be filtered */ - public CustomFiltersActionGroup(IViewPart part, StructuredViewer viewer) { - this(part.getViewSite().getId(), viewer); - } +// public CustomFiltersActionGroup(IViewPart part, StructuredViewer viewer) { +// this(part.getViewSite().getId(), viewer); +// } /** * Creates a new CustomFiltersActionGroup. @@ -268,43 +268,43 @@ public class CustomFiltersActionGroup extends ActionGroup { fillViewMenu(actionBars.getMenuManager()); } - public String[] removeFiltersFor(Object parent, Object element, - IContentProvider contentProvider) { - String[] enabledFilters = getEnabledFilterIds(); - Set newFilters = new HashSet(); - for (int i = 0; i < enabledFilters.length; i++) { - String filterName = enabledFilters[i]; - ViewerFilter filter = (ViewerFilter) fInstalledBuiltInFilters - .get(filterName); - if (filter == null) - newFilters.add(filterName); - else if (isSelected(parent, element, contentProvider, filter)) - newFilters.add(filterName); - } - if (newFilters.size() == enabledFilters.length) - return new String[0]; - return (String[]) newFilters.toArray(new String[newFilters.size()]); - } +// public String[] removeFiltersFor(Object parent, Object element, +// IContentProvider contentProvider) { +// String[] enabledFilters = getEnabledFilterIds(); +// Set newFilters = new HashSet(); +// for (int i = 0; i < enabledFilters.length; i++) { +// String filterName = enabledFilters[i]; +// ViewerFilter filter = (ViewerFilter) fInstalledBuiltInFilters +// .get(filterName); +// if (filter == null) +// newFilters.add(filterName); +// else if (isSelected(parent, element, contentProvider, filter)) +// newFilters.add(filterName); +// } +// if (newFilters.size() == enabledFilters.length) +// return new String[0]; +// return (String[]) newFilters.toArray(new String[newFilters.size()]); +// } public void setFilters(String[] newFilters) { setEnabledFilterIds(newFilters); updateViewerFilters(true); } - private boolean isSelected(Object parent, Object element, - IContentProvider contentProvider, ViewerFilter filter) { - if (contentProvider instanceof ITreeContentProvider) { - // the element and all its parents have to be selected - ITreeContentProvider provider = (ITreeContentProvider) contentProvider; - while (element != null && !(element instanceof IJavaModel)) { - if (!filter.select(fViewer, parent, element)) - return false; - element = provider.getParent(element); - } - return true; - } - return filter.select(fViewer, parent, element); - } +// private boolean isSelected(Object parent, Object element, +// IContentProvider contentProvider, ViewerFilter filter) { +// if (contentProvider instanceof ITreeContentProvider) { +// // the element and all its parents have to be selected +// ITreeContentProvider provider = (ITreeContentProvider) contentProvider; +// while (element != null && !(element instanceof IJavaModel)) { +// if (!filter.select(fViewer, parent, element)) +// return false; +// element = provider.getParent(element); +// } +// return true; +// } +// return filter.select(fViewer, parent, element); +// } /** * Sets the enable state of the given filter. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java index 67aec73..b228189 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/GenerateActionGroup.java @@ -30,7 +30,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IViewPart; +//import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.actions.AddBookmarkAction; @@ -158,9 +158,9 @@ public class GenerateActionGroup extends ActionGroup { * @param part * the view part that owns this action group */ - public GenerateActionGroup(IViewPart part) { - this(part.getSite()); - } +// public GenerateActionGroup(IViewPart part) { +// this(part.getSite()); +// } private GenerateActionGroup(IWorkbenchSite site) { fSite = site; diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/MemberFilterActionGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/MemberFilterActionGroup.java index 83fe0e6..14eae9f 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/MemberFilterActionGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/MemberFilterActionGroup.java @@ -18,7 +18,7 @@ import net.sourceforge.phpdt.internal.ui.viewsupport.MemberFilterAction; //import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.WebUI; -import org.eclipse.jface.action.IMenuManager; +//import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.preference.IPreferenceStore; //incastrix @@ -301,20 +301,20 @@ public class MemberFilterActionGroup extends ActionGroup { * the menu manager to which the actions are added * @since 2.1 */ - public void contributeToViewMenu(IMenuManager menu) { - if (!fInViewMenu) - return; - final String filters = "filters"; //$NON-NLS-1$ - if (menu.find(filters) != null) { - menu.prependToGroup(filters, fFilterActions[0]); // fields - menu.prependToGroup(filters, fFilterActions[1]); // static - menu.prependToGroup(filters, fFilterActions[2]); // public - } else { - menu.add(fFilterActions[0]); // fields - menu.add(fFilterActions[1]); // static - menu.add(fFilterActions[2]); // public - } - } +// public void contributeToViewMenu(IMenuManager menu) { +// if (!fInViewMenu) +// return; +// final String filters = "filters"; //$NON-NLS-1$ +// if (menu.find(filters) != null) { +// menu.prependToGroup(filters, fFilterActions[0]); // fields +// menu.prependToGroup(filters, fFilterActions[1]); // static +// menu.prependToGroup(filters, fFilterActions[2]); // public +// } else { +// menu.add(fFilterActions[0]); // fields +// menu.add(fFilterActions[1]); // static +// menu.add(fFilterActions[2]); // public +// } +// } /* * (non-Javadoc) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/OpenEditorActionGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/OpenEditorActionGroup.java index a1474ea..0d41704 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/OpenEditorActionGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/ui/actions/OpenEditorActionGroup.java @@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IViewPart; +//import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.actions.OpenWithMenu; @@ -56,12 +56,12 @@ public class OpenEditorActionGroup extends ActionGroup { * @param part * the view part that owns this action group */ - public OpenEditorActionGroup(IViewPart part) { - fSite = part.getSite(); - fOpen = new PHPOpenDeclarationAction(fSite); - fOpen.setActionDefinitionId(PHPEditorActionDefinitionIds.OPEN_EDITOR); - initialize(fSite.getSelectionProvider()); - } +// public OpenEditorActionGroup(IViewPart part) { +// fSite = part.getSite(); +// fOpen = new PHPOpenDeclarationAction(fSite); +// fOpen.setActionDefinitionId(PHPEditorActionDefinitionIds.OPEN_EDITOR); +// initialize(fSite.getSelectionProvider()); +// } /** * Note: This constructor is for internal use only. Clients should not call @@ -82,9 +82,9 @@ public class OpenEditorActionGroup extends ActionGroup { * @return the open action. Returns null if the group doesn't * provide any open action */ - public IAction getOpenAction() { - return fOpen; - } +// public IAction getOpenAction() { +// return fOpen; +// } private void initialize(ISelectionProvider provider) { ISelection selection = provider.getSelection(); -- 1.7.1