|
From: <caw...@us...> - 2007-09-12 17:44:20
|
Revision: 3149
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3149&view=rev
Author: cawilliams
Date: 2007-09-12 10:44:18 -0700 (Wed, 12 Sep 2007)
Log Message:
-----------
start removing the Ruby Resources View
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyViewerFilter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilesOnlyFilterAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilterActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java
Modified: trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-09-12 17:44:18 UTC (rev 3149)
@@ -18,7 +18,6 @@
org.rubypeople.rdt.internal.ui.packageview,
org.rubypeople.rdt.internal.ui.preferences,
org.rubypeople.rdt.internal.ui.preferences.formatter,
- org.rubypeople.rdt.internal.ui.resourcesview,
org.rubypeople.rdt.internal.ui.rubyeditor,
org.rubypeople.rdt.internal.ui.search,
org.rubypeople.rdt.internal.ui.text,
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-09-12 17:44:18 UTC (rev 3149)
@@ -135,7 +135,7 @@
<newWizardShortcut id="org.eclipse.ui.wizards.new.folder"/>
<newWizardShortcut id="org.eclipse.ui.wizards.new.file"/>
<viewShortcut id="org.eclipse.ui.views.ContentOutline"/>
- <viewShortcut id="org.rubypeople.rdt.ui.ViewRubyResources"/>
+ <viewShortcut id="org.rubypeople.rdt.ui.PackageExplorer"/>
<viewShortcut id="org.eclipse.ui.console.ConsoleView"/>
<viewShortcut id="org.eclipse.ui.views.ProblemView"/>
<viewShortcut id="org.eclipse.ui.views.TaskList"/>
@@ -186,7 +186,7 @@
<perspectiveShortcut
id="org.rubypeople.rdt.ui.RubyBrowsingPerspective">
</perspectiveShortcut>
- <showInPart id="org.rubypeople.rdt.ui.ViewRubyResources"/>
+ <showInPart id="org.rubypeople.rdt.ui.PackageExplorer"/>
</perspectiveExtension>
<perspectiveExtension
targetID="org.rubypeople.rdt.ui.RubyBrowsingPerspective">
@@ -385,13 +385,6 @@
id="org.rubypeople.rdt.ui.PackageExplorer">
</view>
<view
- name="%ViewRubyResources.name"
- icon="icons/full/ctool16/ruby.gif"
- category="org.rubypeople.rdt.ui.ruby"
- class="org.rubypeople.rdt.internal.ui.resourcesview.RubyResourcesView"
- id="org.rubypeople.rdt.ui.ViewRubyResources">
- </view>
- <view
name="RI"
icon="icons/full/elcl16/help.gif"
category="org.rubypeople.rdt.ui.ruby"
@@ -967,7 +960,7 @@
id="org.eclipse.search.SearchResultView">
</part>
<part
- id="org.rubypeople.rdt.ui.ViewRubyResources">
+ id="org.rubypeople.rdt.ui.PackageExplorer">
</part>
<part
id="org.rubypeople.rdt.ui.TypeHierarchy">
@@ -1210,7 +1203,7 @@
<actionSetPartAssociation
targetID="org.rubypeople.rdt.ui.SearchActionSet">
<part
- id="org.rubypeople.rdt.ui.ViewRubyResources">
+ id="org.rubypeople.rdt.ui.PackageExplorer">
</part>
<part
id="org.rubypeople.rdt.ui.TypeHierarchy">
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyViewerFilter.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyViewerFilter.java 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyViewerFilter.java 2007-09-12 17:44:18 UTC (rev 3149)
@@ -1,59 +0,0 @@
-/*
- * Author: Adam Williams, Markus Barchfeld
- *
- * Copyright (c) 2004 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. RDT
- * is subject to the "Common Public License (CPL) v 1.0". You may not use RDT
- * except in compliance with the License. For further information see
- * org.rubypeople.rdt/rdt.license.
- */
-package org.rubypeople.rdt.internal.ui;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.ui.IPropertyListener;
-import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.internal.ui.resourcesview.RubyResourcesView;
-
-/**
- * The filter can be switched on and off using
- * rubyResourcesView.isRubyFilesOnlyFilterActivated
- */
-public class RubyViewerFilter extends ViewerFilter {
-
- private final RubyResourcesView rubyResourcesView;
-
- private IPropertyListener propertyListener = new IPropertyListener() {
-
- public void propertyChanged(Object source, int property) {
- if (property == RubyFileMatcher.PROP_MATCH_CRITERIA) {
- rubyResourcesView.getViewer().refresh();
- }
- }
- };
-
- public RubyViewerFilter(RubyResourcesView rubyResourcesView) {
- this.rubyResourcesView = rubyResourcesView;
- RubyPlugin.getDefault().getRubyFileMatcher().addPropertyChangeListener(propertyListener);
- }
-
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- // FIXME Filter files more dynamically using plugin.xml!
- if (!rubyResourcesView.isRubyFilesOnlyFilterActivated()) { return true; }
- if (element instanceof IFolder) { return true; }
- if (element instanceof IFile) {
- IFile file = (IFile) element;
- return RubyPlugin.getDefault().getRubyFileMatcher().hasRubyEditorAssociation(file);
- }
-
- // the rest e.g. projects
- IAdaptable adaptable = (IAdaptable) element;
- IRubyElement rubyElement = (IRubyElement) adaptable.getAdapter(IRubyElement.class);
- return rubyElement != null;
- }
-
-}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilesOnlyFilterAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilesOnlyFilterAction.java 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilesOnlyFilterAction.java 2007-09-12 17:44:18 UTC (rev 3149)
@@ -1,37 +0,0 @@
-/*
- * Author: Markus Barchfeld
- *
- * Copyright (c) 2004 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. RDT
- * is subject to the "Common Public License (CPL) v 1.0". You may not use RDT
- * except in compliance with the License. For further information see
- * org.rubypeople.rdt/rdt.license.
- */
-
-package org.rubypeople.rdt.internal.ui.resourcesview;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.views.navigator.IResourceNavigator;
-import org.eclipse.ui.views.navigator.ResourceNavigatorAction;
-import org.rubypeople.rdt.internal.ui.RubyUIMessages;
-
-public class RubyFilesOnlyFilterAction extends ResourceNavigatorAction {
-
-
- public RubyFilesOnlyFilterAction(IResourceNavigator navigator, boolean sortByType) {
- super(navigator, RubyUIMessages.ToggleMenuRubyFilesOnly);
- this.setToolTipText(RubyUIMessages.ToggleMenuRubyFilesOnly_Tooltip);
- this.setChecked(((RubyResourcesView) this.getNavigator()).isRubyFilesOnlyFilterActivated()) ;
-
- }
-
- public void run() {
- ((RubyResourcesView) this.getNavigator()).setRubyFilesOnlyFilterActivated(this.isChecked());
- Viewer viewer = getViewer();
- viewer.getControl().setRedraw(false);
- viewer.refresh();
- viewer.getControl().setRedraw(true);
- }
-
-}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilterActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilterActionGroup.java 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyFilterActionGroup.java 2007-09-12 17:44:18 UTC (rev 3149)
@@ -1,40 +0,0 @@
-/*
- * Author: Adam Williams, Markus Barchfeld
- *
- * Copyright (c) 2004 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. RDT
- * is subject to the "Common Public License (CPL) v 1.0". You may not use RDT
- * except in compliance with the License. For further information see
- * org.rubypeople.rdt/rdt.license.
- */
-package org.rubypeople.rdt.internal.ui.resourcesview;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.views.navigator.MainActionGroup;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-
-public class RubyFilterActionGroup extends MainActionGroup {
-
- private RubyFilesOnlyFilterAction rubyFilesOnlyAction;
-
- public RubyFilterActionGroup(ResourceNavigator navigator) {
- super(navigator);
- }
-
- protected void makeActions() {
- super.makeActions();
- rubyFilesOnlyAction = new RubyFilesOnlyFilterAction(navigator, false);
- }
-
- public void fillActionBars(IActionBars actionBars) {
- super.fillActionBars(actionBars);
- IMenuManager menu = actionBars.getMenuManager();
- menu.add(rubyFilesOnlyAction);
- }
-
- public RubyFilesOnlyFilterAction getRubyFilesOnlyAction() {
- return rubyFilesOnlyAction;
- }
-}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java 2007-09-12 17:44:18 UTC (rev 3149)
@@ -1,196 +0,0 @@
-/*
- * Author: Markus Barchfeld
- *
- * Copyright (c) 2004 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. RDT
- * is subject to the "Common Public License (CPL) v 1.0". You may not use RDT
- * except in compliance with the License. For further information see
- * org.rubypeople.rdt/rdt.license.
- */
-
-package org.rubypeople.rdt.internal.ui.resourcesview;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.IShowInTarget;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.internal.ui.RubyPlugin;
-import org.rubypeople.rdt.internal.ui.RubyViewerFilter;
-import org.rubypeople.rdt.internal.ui.rubyeditor.ExternalRubyFileEditorInput;
-import org.rubypeople.rdt.internal.ui.rubyeditor.IRubyScriptEditorInput;
-import org.rubypeople.rdt.internal.ui.viewsupport.AppearanceAwareLabelProvider;
-import org.rubypeople.rdt.internal.ui.viewsupport.DecoratingRubyLabelProvider;
-import org.rubypeople.rdt.ui.RubyUI;
-
-public class RubyResourcesView extends ResourceNavigator implements IShowInTarget {
-
- private static String IS_RUBY_FILES_ONLY_MEMENTO_KEY = "isRubyFilesOnlyFilterActivated";
- private boolean isRubyFilesOnlyFilterActivated = false; // default value if
- // there is no
- // memento
-
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- RubyViewerFilter filter = new RubyViewerFilter(this);
- this.getViewer().addFilter(filter);
- }
-
- protected void makeActions() {
- setActionGroup(new RubyFilterActionGroup(this));
- }
-
- protected void restoreRubyFilesOnlyFilterActivated(IMemento memento) {
- Integer isRubyFilesOnlyFilterActivatedMemento = memento.getInteger(RubyResourcesView.IS_RUBY_FILES_ONLY_MEMENTO_KEY);
- if (isRubyFilesOnlyFilterActivatedMemento != null) {
- this.isRubyFilesOnlyFilterActivated = isRubyFilesOnlyFilterActivatedMemento.intValue() == 1;
- }
- }
-
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento.putInteger(RubyResourcesView.IS_RUBY_FILES_ONLY_MEMENTO_KEY, isRubyFilesOnlyFilterActivated ? 1 : 0);
- }
-
- public boolean isRubyFilesOnlyFilterActivated() {
- return isRubyFilesOnlyFilterActivated;
- }
-
- public void setRubyFilesOnlyFilterActivated(boolean isRubyFilesOnlyFilterActivated) {
- this.isRubyFilesOnlyFilterActivated = isRubyFilesOnlyFilterActivated;
- }
-
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- if (memento != null) {
- this.restoreRubyFilesOnlyFilterActivated(memento);
- }
- }
- protected void editorActivated(IEditorPart editor) {
- if (!isLinkingEnabled()) {
- return;
- }
-
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFileEditorInput fileInput = (IFileEditorInput) input;
- IFile file = fileInput.getFile();
- // Quick Fix: if Editor is RubyExternal, then file is null
- // TODO: Check if RubyExternalEditor's input should be IFileEditorInput at all
- if (file == null) {
- return ;
- }
- }
- super.editorActivated(editor) ;
- }
-
- public static RubyResourcesView openInActivePerspective() {
- try {
- return (RubyResourcesView)RubyPlugin.getActivePage().showView(RubyUI.ID_RUBY_RESOURCE_VIEW);
- } catch(PartInitException pe) {
- return null;
- }
- }
-
- public boolean tryToReveal(Object element) {
- if (revealElementOrParent(element))
- return true;
- return false;
- }
-
- private boolean revealElementOrParent(Object element) {
- if (revealAndVerify(element))
- return true;
- element= getVisibleParent(element);
- if (element != null) {
- if (revealAndVerify(element))
- return true;
- if (element instanceof IRubyElement) {
- IResource resource= ((IRubyElement)element).getResource();
- if (resource != null) {
- if (revealAndVerify(resource))
- return true;
- }
- }
- }
- return false;
- }
-
- private boolean revealAndVerify(Object element) {
- if (element == null)
- return false;
- selectReveal(new StructuredSelection(element));
- return ! getSite().getSelectionProvider().getSelection().isEmpty();
- }
-
- private Object getVisibleParent(Object object) {
- if (object == null)
- return null;
- if (!(object instanceof IRubyElement))
- return object;
- IRubyElement element2= (IRubyElement) object;
- switch (element2.getElementType()) {
- case IRubyElement.IMPORT_DECLARATION:
- case IRubyElement.IMPORT_CONTAINER:
- case IRubyElement.TYPE:
- case IRubyElement.METHOD:
- case IRubyElement.FIELD:
- // select parent script
- element2= (IRubyElement)element2.getOpenable();
- break;
- case IRubyElement.RUBY_MODEL:
- element2= null;
- break;
- }
- return element2;
- }
-
- public boolean show(ShowInContext context) {
- ISelection selection= context.getSelection();
- if (selection instanceof IStructuredSelection) {
- // fix for 64634 Navigate/Show in/Package Explorer doesn't work
- IStructuredSelection structuredSelection= ((IStructuredSelection) selection);
- if (structuredSelection.size() == 1 && tryToReveal(structuredSelection.getFirstElement()))
- return true;
- }
-
- Object input= context.getInput();
- if (input instanceof IEditorInput) {
- Object elementOfInput= getElementOfInput((IEditorInput)context.getInput());
- return elementOfInput != null && tryToReveal(elementOfInput);
- }
-
- return false;
- }
-
- @Override
- protected void initLabelProvider(TreeViewer viewer) {
- viewer.setLabelProvider(new DecoratingRubyLabelProvider(new AppearanceAwareLabelProvider()));
- }
-
- /**
- * Returns the element contained in the EditorInput
- */
- Object getElementOfInput(IEditorInput input) {
- if (input instanceof IRubyScriptEditorInput)
- return ((IRubyScriptEditorInput)input).getRubyScript();
- else if (input instanceof IFileEditorInput)
- return ((IFileEditorInput)input).getFile();
- else if (input instanceof ExternalRubyFileEditorInput)
- return ((ExternalRubyFileEditorInput)input).getStorage();
- return null;
- }
-}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java 2007-09-12 17:42:38 UTC (rev 3148)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java 2007-09-12 17:44:18 UTC (rev 3149)
@@ -21,7 +21,7 @@
import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.actions.SelectionConverter;
-import org.rubypeople.rdt.internal.ui.resourcesview.RubyResourcesView;
+import org.rubypeople.rdt.internal.ui.packageview.PackageExplorerPart;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
/**
* This action reveals the currently selected Ruby element in the
@@ -120,7 +120,7 @@
if (openable instanceof IRubyElement)
element= (IRubyElement)openable;
- RubyResourcesView view= RubyResourcesView.openInActivePerspective();
+ PackageExplorerPart view= PackageExplorerPart.openInActivePerspective();
view.tryToReveal(element);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|