You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: <caw...@us...> - 2007-07-06 20:07:07
|
Revision: 2722
http://svn.sourceforge.net/rubyeclipse/?rev=2722&view=rev
Author: cawilliams
Date: 2007-07-06 13:07:03 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-07-06 20:01:23 UTC (rev 2721)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-07-06 20:07:03 UTC (rev 2722)
@@ -218,4 +218,83 @@
ISourceFolder otherpack= (ISourceFolder) member.getAncestor(IRubyElement.SOURCE_FOLDER);
return (pack != null && pack.equals(otherpack));
}
+
+ /**
+ * Finds a method in a type and all its super types. The super class hierarchy is searched first, then the super interfaces.
+ * This searches for a method with the same name and signature. Parameter types are only
+ * compared by the simple name, no resolving for the fully qualified type name is done.
+ * Constructors are only compared by parameters, not the name.
+ * NOTE: For finding overridden methods or for finding the declaring method, use {@link MethodOverrideTester}
+ * @param hierarchy The hierarchy containing the type
+ * @param type The type to start the search from
+ * @param name The name of the method to find
+ * @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
+ * @param isConstructor If the method is a constructor
+ * @return The first found method or <code>null</code>, if nothing found
+ */
+ public static IMethod findMethodInHierarchy(ITypeHierarchy hierarchy, IType type, String name, String[] paramTypes, boolean isConstructor) throws RubyModelException {
+ // FIXME We shouldn't be taking iin parameter types at all. All we care about in Ruby is the method name. (we might care a little bit about arity of method, but not for overriding).
+ IMethod method= findMethod(name, paramTypes, isConstructor, type);
+ if (method != null) {
+ return method;
+ }
+ IType superClass= hierarchy.getSuperclass(type);
+ if (superClass != null) {
+ IMethod res= findMethodInHierarchy(hierarchy, superClass, name, paramTypes, isConstructor);
+ if (res != null) {
+ return res;
+ }
+ }
+ if (!isConstructor) {
+ IType[] superInterfaces= hierarchy.getSuperInterfaces(type);
+ for (int i= 0; i < superInterfaces.length; i++) {
+ IMethod res= findMethodInHierarchy(hierarchy, superInterfaces[i], name, paramTypes, false);
+ if (res != null) {
+ return res;
+ }
+ }
+ }
+ return method;
+ }
+
+ /**
+ * Finds a method in a type.
+ * This searches for a method with the same name and signature. Parameter types are only
+ * compared by the simple name, no resolving for the fully qualified type name is done.
+ * Constructors are only compared by parameters, not the name.
+ * @param name The name of the method to find
+ * @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
+ * @param isConstructor If the method is a constructor
+ * @return The first found method or <code>null</code>, if nothing found
+ */
+ public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IType type) throws RubyModelException {
+ IMethod[] methods= type.getMethods();
+ for (int i= 0; i < methods.length; i++) {
+ if (isSameMethodSignature(name, paramTypes, isConstructor, methods[i])) {
+ return methods[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Tests if a method equals to the given signature.
+ * Parameter types are only compared by the simple name, no resolving for
+ * the fully qualified type name is done. Constructors are only compared by
+ * parameters, not the name.
+ * @param name Name of the method
+ * @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
+ * @param isConstructor Specifies if the method is a constructor
+ * @return Returns <code>true</code> if the method has the given name and parameter types and constructor state.
+ */
+ public static boolean isSameMethodSignature(String name, String[] paramTypes, boolean isConstructor, IMethod curr) throws RubyModelException {
+ if (isConstructor || name.equals(curr.getElementName())) {
+ if (isConstructor == curr.isConstructor()) {
+// if (paramTypes.length == curr.getNumberOfParameters()) {
+ return true;
+// }
+ }
+ }
+ return false;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 20:01:26
|
Revision: 2721
http://svn.sourceforge.net/rubyeclipse/?rev=2721&view=rev
Author: cawilliams
Date: 2007-07-06 13:01:23 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
more groundwork for the quick Outline and Type Hierarchy
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/AbstractInformationControl.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/AbstractHierarchyViewerSorter.java
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/AbstractInformationControl.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/AbstractInformationControl.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/AbstractInformationControl.java 2007-07-06 20:01:23 UTC (rev 2721)
@@ -0,0 +1,797 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.rubypeople.rdt.internal.ui.text;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlExtension;
+import org.eclipse.jface.text.IInformationControlExtension2;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IKeyBindingService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ActionHandler;
+import org.eclipse.ui.commands.HandlerSubmission;
+import org.eclipse.ui.commands.ICommand;
+import org.eclipse.ui.commands.ICommandManager;
+import org.eclipse.ui.commands.IKeySequenceBinding;
+import org.eclipse.ui.commands.Priority;
+import org.eclipse.ui.contexts.IWorkbenchContextSupport;
+import org.eclipse.ui.keys.KeySequence;
+import org.rubypeople.rdt.core.IParent;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.OpenActionUtil;
+import org.rubypeople.rdt.internal.ui.util.StringMatcher;
+import org.rubypeople.rdt.ui.actions.CustomFiltersActionGroup;
+
+/**
+ * Abstract class for Show hierarchy in light-weight controls.
+ *
+ * @since 2.1
+ */
+public abstract class AbstractInformationControl extends PopupDialog implements IInformationControl, IInformationControlExtension, IInformationControlExtension2, DisposeListener {
+
+ /**
+ * The NamePatternFilter selects the elements which
+ * match the given string patterns.
+ *
+ * @since 2.0
+ */
+ protected class NamePatternFilter extends ViewerFilter {
+
+ public NamePatternFilter() {
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on ViewerFilter.
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ StringMatcher matcher= getMatcher();
+ if (matcher == null || !(viewer instanceof TreeViewer))
+ return true;
+ TreeViewer treeViewer= (TreeViewer) viewer;
+
+ String matchName= ((ILabelProvider) treeViewer.getLabelProvider()).getText(element);
+ if (matchName != null && matcher.match(matchName))
+ return true;
+
+ return hasUnfilteredChild(treeViewer, element);
+ }
+
+ private boolean hasUnfilteredChild(TreeViewer viewer, Object element) {
+ if (element instanceof IParent) {
+ Object[] children= ((ITreeContentProvider) viewer.getContentProvider()).getChildren(element);
+ for (int i= 0; i < children.length; i++)
+ if (select(viewer, element, children[i]))
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /** The control's text widget */
+ private Text fFilterText;
+ /** The control's tree widget */
+ private TreeViewer fTreeViewer;
+ /** The current string matcher */
+ protected StringMatcher fStringMatcher;
+ private ICommand fInvokingCommand;
+ private KeySequence[] fInvokingCommandKeySequences;
+
+ /**
+ * Fields that support the dialog menu
+ * @since 3.0
+ * @since 3.2 - now appended to framework menu
+ */
+ private Composite fViewMenuButtonComposite;
+
+ private CustomFiltersActionGroup fCustomFiltersActionGroup;
+
+ private IKeyBindingService fKeyBindingService;
+ private String[] fKeyBindingScopes;
+ private IAction fShowViewMenuAction;
+ private HandlerSubmission fShowViewMenuHandlerSubmission;
+
+ /**
+ * Field for tree style since it must be remembered by the instance.
+ *
+ * @since 3.2
+ */
+ private int fTreeStyle;
+
+ /**
+ * Creates a tree information control with the given shell as parent. The given
+ * styles are applied to the shell and the tree widget.
+ *
+ * @param parent the parent shell
+ * @param shellStyle the additional styles for the shell
+ * @param treeStyle the additional styles for the tree widget
+ * @param invokingCommandId the id of the command that invoked this control or <code>null</code>
+ * @param showStatusField <code>true</code> iff the control has a status field at the bottom
+ */
+ public AbstractInformationControl(Shell parent, int shellStyle, int treeStyle, String invokingCommandId, boolean showStatusField) {
+ super(parent, shellStyle, true, true, true, true, null, null);
+ if (invokingCommandId != null) {
+ ICommandManager commandManager= PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
+ fInvokingCommand= commandManager.getCommand(invokingCommandId);
+ if (fInvokingCommand != null && !fInvokingCommand.isDefined())
+ fInvokingCommand= null;
+ else
+ // Pre-fetch key sequence - do not change because scope will change later.
+ getInvokingCommandKeySequences();
+ }
+ fTreeStyle= treeStyle;
+ // Title and status text must be set to get the title label created, so force empty values here.
+ if (hasHeader())
+ setTitleText(""); //$NON-NLS-1$
+ setInfoText(""); // //$NON-NLS-1$
+
+ // Create all controls early to preserve the life cycle of the original implementation.
+ create();
+
+ // Status field text can only be computed after widgets are created.
+ setInfoText(getStatusFieldText());
+ }
+
+ /**
+ * Create the main content for this information control.
+ *
+ * @param parent The parent composite
+ * @return The control representing the main content.
+ * @since 3.2
+ */
+ protected Control createDialogArea(Composite parent) {
+ fTreeViewer= createTreeViewer(parent, fTreeStyle);
+
+ fCustomFiltersActionGroup= new CustomFiltersActionGroup(getId(), fTreeViewer);
+
+ final Tree tree= fTreeViewer.getTree();
+ tree.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if (e.character == 0x1B) // ESC
+ dispose();
+ }
+ public void keyReleased(KeyEvent e) {
+ // do nothing
+ }
+ });
+
+ tree.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ gotoSelectedElement();
+ }
+ });
+
+ tree.addMouseMoveListener(new MouseMoveListener() {
+ TreeItem fLastItem= null;
+ public void mouseMove(MouseEvent e) {
+ if (tree.equals(e.getSource())) {
+ Object o= tree.getItem(new Point(e.x, e.y));
+ if (o instanceof TreeItem) {
+ if (!o.equals(fLastItem)) {
+ fLastItem= (TreeItem)o;
+ tree.setSelection(new TreeItem[] { fLastItem });
+ } else if (e.y < tree.getItemHeight() / 4) {
+ // Scroll up
+ Point p= tree.toDisplay(e.x, e.y);
+ Item item= fTreeViewer.scrollUp(p.x, p.y);
+ if (item instanceof TreeItem) {
+ fLastItem= (TreeItem)item;
+ tree.setSelection(new TreeItem[] { fLastItem });
+ }
+ } else if (e.y > tree.getBounds().height - tree.getItemHeight() / 4) {
+ // Scroll down
+ Point p= tree.toDisplay(e.x, e.y);
+ Item item= fTreeViewer.scrollDown(p.x, p.y);
+ if (item instanceof TreeItem) {
+ fLastItem= (TreeItem)item;
+ tree.setSelection(new TreeItem[] { fLastItem });
+ }
+ }
+ }
+ }
+ }
+ });
+
+ tree.addMouseListener(new MouseAdapter() {
+ public void mouseUp(MouseEvent e) {
+
+ if (tree.getSelectionCount() < 1)
+ return;
+
+ if (e.button != 1)
+ return;
+
+ if (tree.equals(e.getSource())) {
+ Object o= tree.getItem(new Point(e.x, e.y));
+ TreeItem selection= tree.getSelection()[0];
+ if (selection.equals(o))
+ gotoSelectedElement();
+ }
+ }
+ });
+
+ installFilter();
+
+ addDisposeListener(this);
+ return fTreeViewer.getControl();
+ }
+
+ /**
+ * Creates a tree information control with the given shell as parent. The given
+ * styles are applied to the shell and the tree widget.
+ *
+ * @param parent the parent shell
+ * @param shellStyle the additional styles for the shell
+ * @param treeStyle the additional styles for the tree widget
+ */
+ public AbstractInformationControl(Shell parent, int shellStyle, int treeStyle) {
+ this(parent, shellStyle, treeStyle, null, false);
+ }
+
+ protected abstract TreeViewer createTreeViewer(Composite parent, int style);
+
+ /**
+ * Returns the name of the dialog settings section.
+ *
+ * @return the name of the dialog settings section
+ */
+ protected abstract String getId();
+
+ protected TreeViewer getTreeViewer() {
+ return fTreeViewer;
+ }
+
+ /**
+ * Returns <code>true</code> if the control has a header, <code>false</code> otherwise.
+ * <p>
+ * The default is to return <code>false</code>.
+ * </p>
+ *
+ * @return <code>true</code> if the control has a header
+ */
+ protected boolean hasHeader() {
+ // default is to have no header
+ return false;
+ }
+
+ protected Text getFilterText() {
+ return fFilterText;
+ }
+
+ protected Text createFilterText(Composite parent) {
+ fFilterText= new Text(parent, SWT.NONE);
+
+ GridData data= new GridData(GridData.FILL_HORIZONTAL);
+ GC gc= new GC(parent);
+ gc.setFont(parent.getFont());
+ FontMetrics fontMetrics= gc.getFontMetrics();
+ gc.dispose();
+
+ data.heightHint= Dialog.convertHeightInCharsToPixels(fontMetrics, 1);
+ data.horizontalAlignment= GridData.FILL;
+ data.verticalAlignment= GridData.CENTER;
+ fFilterText.setLayoutData(data);
+
+ fFilterText.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == 0x0D) // return
+ gotoSelectedElement();
+ if (e.keyCode == SWT.ARROW_DOWN)
+ fTreeViewer.getTree().setFocus();
+ if (e.keyCode == SWT.ARROW_UP)
+ fTreeViewer.getTree().setFocus();
+ if (e.character == 0x1B) // ESC
+ dispose();
+ }
+ public void keyReleased(KeyEvent e) {
+ // do nothing
+ }
+ });
+
+ return fFilterText;
+ }
+
+ protected void createHorizontalSeparator(Composite parent) {
+ Label separator= new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.LINE_DOT);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ protected void updateStatusFieldText() {
+ setInfoText(getStatusFieldText());
+ }
+
+ /**
+ * Handles click in status field.
+ * <p>
+ * Default does nothing.
+ * </p>
+ */
+ protected void handleStatusFieldClicked() {
+ }
+
+ protected String getStatusFieldText() {
+ return ""; //$NON-NLS-1$
+ }
+
+ private void installFilter() {
+ fFilterText.setText(""); //$NON-NLS-1$
+
+ fFilterText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String text= ((Text) e.widget).getText();
+ int length= text.length();
+ if (length > 0 && text.charAt(length -1 ) != '*') {
+ text= text + '*';
+ }
+ setMatcherString(text, true);
+ }
+ });
+ }
+
+ /**
+ * The string matcher has been modified. The default implementation
+ * refreshes the view and selects the first matched element
+ */
+ protected void stringMatcherUpdated() {
+ // refresh viewer to re-filter
+ fTreeViewer.getControl().setRedraw(false);
+ fTreeViewer.refresh();
+ fTreeViewer.expandAll();
+ selectFirstMatch();
+ fTreeViewer.getControl().setRedraw(true);
+ }
+
+ /**
+ * Sets the patterns to filter out for the receiver.
+ * <p>
+ * The following characters have special meaning:
+ * ? => any character
+ * * => any string
+ * </p>
+ *
+ * @param pattern the pattern
+ * @param update <code>true</code> if the viewer should be updated
+ */
+ protected void setMatcherString(String pattern, boolean update) {
+ if (pattern.length() == 0) {
+ fStringMatcher= null;
+ } else {
+ boolean ignoreCase= pattern.toLowerCase().equals(pattern);
+ fStringMatcher= new StringMatcher(pattern, ignoreCase, false);
+ }
+
+ if (update)
+ stringMatcherUpdated();
+ }
+
+ protected StringMatcher getMatcher() {
+ return fStringMatcher;
+ }
+
+ /**
+ * Implementers can modify
+ *
+ * @return the selected element
+ */
+ protected Object getSelectedElement() {
+ if (fTreeViewer == null)
+ return null;
+
+ return ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement();
+ }
+
+ private void gotoSelectedElement() {
+ Object selectedElement= getSelectedElement();
+ if (selectedElement != null) {
+ try {
+ dispose();
+ OpenActionUtil.open(selectedElement, true);
+ } catch (CoreException ex) {
+ RubyPlugin.log(ex);
+ }
+ }
+ }
+
+ /**
+ * Selects the first element in the tree which
+ * matches the current filter pattern.
+ */
+ protected void selectFirstMatch() {
+ Tree tree= fTreeViewer.getTree();
+ Object element= findElement(tree.getItems());
+ if (element != null)
+ fTreeViewer.setSelection(new StructuredSelection(element), true);
+ else
+ fTreeViewer.setSelection(StructuredSelection.EMPTY);
+ }
+
+ private IRubyElement findElement(TreeItem[] items) {
+ ILabelProvider labelProvider= (ILabelProvider)fTreeViewer.getLabelProvider();
+ for (int i= 0; i < items.length; i++) {
+ IRubyElement element= (IRubyElement)items[i].getData();
+ if (fStringMatcher == null)
+ return element;
+
+ if (element != null) {
+ String label= labelProvider.getText(element);
+ if (fStringMatcher.match(label))
+ return element;
+ }
+
+ element= findElement(items[i].getItems());
+ if (element != null)
+ return element;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setInformation(String information) {
+ // this method is ignored, see IInformationControlExtension2
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract void setInput(Object information);
+
+ /**
+ * Fills the view menu.
+ * Clients can extend or override.
+ *
+ * @param viewMenu the menu manager that manages the menu
+ * @since 3.0
+ */
+ protected void fillViewMenu(IMenuManager viewMenu) {
+ fCustomFiltersActionGroup.fillViewMenu(viewMenu);
+ }
+
+ /*
+ * Overridden to call the old framework method.
+ *
+ * @see org.eclipse.jface.dialogs.PopupDialog#fillDialogMenu(IMenuManager)
+ * @since 3.2
+ */
+ protected void fillDialogMenu(IMenuManager dialogMenu) {
+ super.fillDialogMenu(dialogMenu);
+ fillViewMenu(dialogMenu);
+ }
+
+ protected void inputChanged(Object newInput, Object newSelection) {
+ fFilterText.setText(""); //$NON-NLS-1$
+ fTreeViewer.setInput(newInput);
+ if (newSelection != null) {
+ fTreeViewer.setSelection(new StructuredSelection(newSelection));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setVisible(boolean visible) {
+ if (visible) {
+ addHandlerAndKeyBindingSupport();
+ open();
+ } else {
+ removeHandlerAndKeyBindingSupport();
+ saveDialogBounds(getShell());
+ getShell().setVisible(false);
+ removeHandlerAndKeyBindingSupport();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void dispose() {
+ close();
+ }
+
+ /**
+ * {@inheritDoc}
+ * @param event can be null
+ * <p>
+ * Subclasses may extend.
+ * </p>
+ */
+ public void widgetDisposed(DisposeEvent event) {
+ removeHandlerAndKeyBindingSupport();
+ fTreeViewer= null;
+ fFilterText= null;
+ fKeyBindingService= null;
+ }
+
+ /**
+ * Adds handler and key binding support.
+ *
+ * @since 3.2
+ */
+ protected void addHandlerAndKeyBindingSupport() {
+ // Remember current scope and then set window context.
+ if (fKeyBindingScopes == null && fKeyBindingService != null) {
+ fKeyBindingScopes= fKeyBindingService.getScopes();
+ fKeyBindingService.setScopes(new String[] { IWorkbenchContextSupport.CONTEXT_ID_WINDOW });
+ }
+
+ // Register action with command support
+ if (fShowViewMenuHandlerSubmission == null) {
+ fShowViewMenuHandlerSubmission= new HandlerSubmission(null, getShell(), null, fShowViewMenuAction.getActionDefinitionId(), new ActionHandler(fShowViewMenuAction), Priority.MEDIUM);
+ PlatformUI.getWorkbench().getCommandSupport().addHandlerSubmission(fShowViewMenuHandlerSubmission);
+ }
+ }
+
+ /**
+ * Removes handler and key binding support.
+ *
+ * @since 3.2
+ */
+ protected void removeHandlerAndKeyBindingSupport() {
+ // Remove handler submission
+ if (fShowViewMenuHandlerSubmission != null)
+ PlatformUI.getWorkbench().getCommandSupport().removeHandlerSubmission(fShowViewMenuHandlerSubmission);
+
+ // Restore editor's key binding scope
+ if (fKeyBindingService != null && fKeyBindingScopes != null) {
+ fKeyBindingService.setScopes(fKeyBindingScopes);
+ fKeyBindingScopes= null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasContents() {
+ return fTreeViewer != null && fTreeViewer.getInput() != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSizeConstraints(int maxWidth, int maxHeight) {
+ // ignore
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Point computeSizeHint() {
+ // return the shell's size - note that it already has the persisted size if persisting
+ // is enabled.
+ return getShell().getSize();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setLocation(Point location) {
+ /*
+ * If the location is persisted, it gets managed by PopupDialog - fine. Otherwise, the location is
+ * computed in Window#getInitialLocation, which will center it in the parent shell / main
+ * monitor, which is wrong for two reasons:
+ * - we want to center over the editor / subject control, not the parent shell
+ * - the center is computed via the initalSize, which may be also wrong since the size may
+ * have been updated since via min/max sizing of AbstractInformationControlManager.
+ * In that case, override the location with the one computed by the manager. Note that
+ * the call to constrainShellSize in PopupDialog.open will still ensure that the shell is
+ * entirely visible.
+ */
+ if (!getPersistBounds() || getDialogSettings() == null)
+ getShell().setLocation(location);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSize(int width, int height) {
+ getShell().setSize(width, height);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addDisposeListener(DisposeListener listener) {
+ getShell().addDisposeListener(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeDisposeListener(DisposeListener listener) {
+ getShell().removeDisposeListener(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setForegroundColor(Color foreground) {
+ applyForegroundColor(foreground, getContents());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setBackgroundColor(Color background) {
+ applyBackgroundColor(background, getContents());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isFocusControl() {
+ return fTreeViewer.getControl().isFocusControl() || fFilterText.isFocusControl();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setFocus() {
+ getShell().forceFocus();
+ fFilterText.setFocus();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addFocusListener(FocusListener listener) {
+ getShell().addFocusListener(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeFocusListener(FocusListener listener) {
+ getShell().removeFocusListener(listener);
+ }
+
+ final protected ICommand getInvokingCommand() {
+ return fInvokingCommand;
+ }
+
+ final protected KeySequence[] getInvokingCommandKeySequences() {
+ if (fInvokingCommandKeySequences == null) {
+ if (getInvokingCommand() != null) {
+ List list= getInvokingCommand().getKeySequenceBindings();
+ if (!list.isEmpty()) {
+ fInvokingCommandKeySequences= new KeySequence[list.size()];
+ for (int i= 0; i < fInvokingCommandKeySequences.length; i++) {
+ fInvokingCommandKeySequences[i]= ((IKeySequenceBinding) list.get(i)).getKeySequence();
+ }
+ return fInvokingCommandKeySequences;
+ }
+ }
+ }
+ return fInvokingCommandKeySequences;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.PopupDialog#getDialogSettings()
+ */
+ protected IDialogSettings getDialogSettings() {
+ String sectionName= getId();
+
+ IDialogSettings settings= RubyPlugin.getDefault().getDialogSettings().getSection(sectionName);
+ if (settings == null)
+ settings= RubyPlugin.getDefault().getDialogSettings().addNewSection(sectionName);
+
+ return settings;
+ }
+
+ /*
+ * Overridden to insert the filter text into the title and menu area.
+ *
+ * @since 3.2
+ */
+ protected Control createTitleMenuArea(Composite parent) {
+ fViewMenuButtonComposite= (Composite) super.createTitleMenuArea(parent);
+
+ // If there is a header, then the filter text must be created
+ // underneath the title and menu area.
+
+ if (hasHeader()) {
+ fFilterText= createFilterText(parent);
+ }
+
+ // Create a key binding for showing the dialog menu
+ // Key binding service
+ IWorkbenchPart part= RubyPlugin.getActivePage().getActivePart();
+ IWorkbenchPartSite site= part.getSite();
+ fKeyBindingService= site.getKeyBindingService();
+
+ // Create show view menu action
+ fShowViewMenuAction= new Action("showViewMenu") { //$NON-NLS-1$
+ /*
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run() {
+ showDialogMenu();
+ }
+ };
+ fShowViewMenuAction.setEnabled(true);
+ fShowViewMenuAction.setActionDefinitionId("org.eclipse.ui.window.showViewMenu"); //$NON-NLS-1$
+
+ addHandlerAndKeyBindingSupport();
+
+ return fViewMenuButtonComposite;
+ }
+
+ /*
+ * Overridden to insert the filter text into the title control
+ * if there is no header specified.
+ * @since 3.2
+ */
+ protected Control createTitleControl(Composite parent) {
+ if (hasHeader()) {
+ return super.createTitleControl(parent);
+ }
+ fFilterText= createFilterText(parent);
+ return fFilterText;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.PopupDialog#setTabOrder(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setTabOrder(Composite composite) {
+ if (hasHeader()) {
+ composite.setTabList(new Control[] { fFilterText, fTreeViewer.getTree() });
+ } else {
+ fViewMenuButtonComposite.setTabList(new Control[] { fFilterText });
+ composite.setTabList(new Control[] { fViewMenuButtonComposite, fTreeViewer.getTree() });
+ }
+ }
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/AbstractHierarchyViewerSorter.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/AbstractHierarchyViewerSorter.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/AbstractHierarchyViewerSorter.java 2007-07-06 20:01:23 UTC (rev 2721)
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.rubypeople.rdt.internal.ui.typehierarchy;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.rubypeople.rdt.core.IMethod;
+import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.ITypeHierarchy;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.corext.util.MethodOverrideTester;
+import org.rubypeople.rdt.internal.corext.util.RubyModelUtil;
+import org.rubypeople.rdt.internal.ui.viewsupport.SourcePositionSorter;
+import org.rubypeople.rdt.ui.RubyElementSorter;
+
+/**
+ */
+public abstract class AbstractHierarchyViewerSorter extends ViewerSorter {
+
+ private static final int OTHER= 1;
+ private static final int CLASS= 2;
+ private static final int MODULE= 3;
+ private static final int ANONYM= 4;
+
+ private RubyElementSorter fNormalSorter;
+ private SourcePositionSorter fSourcePositonSorter;
+
+ public AbstractHierarchyViewerSorter() {
+ fNormalSorter= new RubyElementSorter();
+ fSourcePositonSorter= new SourcePositionSorter();
+ }
+
+ protected abstract ITypeHierarchy getHierarchy(IType type);
+ public abstract boolean isSortByDefiningType();
+ public abstract boolean isSortAlphabetically();
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.viewers.ViewerSorter#category(java.lang.Object)
+ */
+ public int category(Object element) {
+ if (element instanceof IType) {
+ IType type= (IType) element;
+ if (type.getElementName().length() == 0) {
+ return ANONYM;
+ }
+ if (type.isModule()) {
+ return MODULE;
+ } else {
+ return CLASS;
+ }
+ }
+ return OTHER;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.viewers.ViewerSorter#compare(null, null, null)
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (!isSortAlphabetically() && !isSortByDefiningType()) {
+ return fSourcePositonSorter.compare(viewer, e1, e2);
+ }
+
+ int cat1= category(e1);
+ int cat2= category(e2);
+
+ if (cat1 != cat2)
+ return cat1 - cat2;
+
+ if (cat1 == OTHER) { // method or field
+ if (isSortByDefiningType()) {
+ try {
+ IType def1= (e1 instanceof IMethod) ? getDefiningType((IMethod) e1) : null;
+ IType def2= (e2 instanceof IMethod) ? getDefiningType((IMethod) e2) : null;
+ if (def1 != null) {
+ if (def2 != null) {
+ if (!def2.equals(def1)) {
+ return compareInHierarchy(def1, def2);
+ }
+ } else {
+ return -1;
+ }
+ } else {
+ if (def2 != null) {
+ return 1;
+ }
+ }
+ } catch (RubyModelException e) {
+ // ignore, default to normal comparison
+ }
+ }
+ if (isSortAlphabetically()) {
+ return fNormalSorter.compare(viewer, e1, e2); // use appearance pref page settings
+ }
+ return 0;
+ } else if (cat1 == ANONYM) {
+ return 0;
+ } else if (isSortAlphabetically()) {
+ String name1= ((IType) e1).getElementName();
+ String name2= ((IType) e2).getElementName();
+ return getCollator().compare(name1, name2);
+ }
+ return 0;
+ }
+
+ private IType getDefiningType(IMethod method) throws RubyModelException {
+ if (method.getVisibility() == IMethod.PRIVATE || method.isSingleton() || method.isConstructor()) {
+ return null;
+ }
+
+ IType declaringType= method.getDeclaringType();
+ MethodOverrideTester tester= new MethodOverrideTester(declaringType, getHierarchy(declaringType));
+ IMethod res= tester.findDeclaringMethod(method, true);
+ if (res == null) {
+ return null;
+ }
+ return res.getDeclaringType();
+ }
+
+
+ private int compareInHierarchy(IType def1, IType def2) {
+ if (RubyModelUtil.isSuperType(getHierarchy(def1), def2, def1)) {
+ return 1;
+ } else if (RubyModelUtil.isSuperType(getHierarchy(def2), def1, def2)) {
+ return -1;
+ }
+ // modules after classes
+ if (def1.isModule()) {
+ if (!def2.isModule()) {
+ return 1;
+ }
+ } else if (def2.isModule()) {
+ return -1;
+ }
+ String name1= def1.getElementName();
+ String name2= def2.getElementName();
+
+ return getCollator().compare(name1, name2);
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 19:28:42
|
Revision: 2720
http://svn.sourceforge.net/rubyeclipse/?rev=2720&view=rev
Author: cawilliams
Date: 2007-07-06 12:28:39 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
more groundwork for the quick Outline and Type Hierarchy
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IMethod.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/MethodOverrideTester.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/TextMessages.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IMethod.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IMethod.java 2007-07-06 16:09:16 UTC (rev 2719)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IMethod.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -43,4 +43,6 @@
public boolean isSingleton();
+ public int getNumberOfParameters() throws RubyModelException;
+
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-07-06 16:09:16 UTC (rev 2719)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -736,6 +736,10 @@
public String[] getParameterNames() throws RubyModelException {
return ASTUtil.getArgs(node.getArgsNode(), node.getScope());
}
+
+ public int getNumberOfParameters() throws RubyModelException {
+ return getParameterNames().length;
+ }
public int getVisibility() throws RubyModelException {
return IMethod.PUBLIC;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java 2007-07-06 16:09:16 UTC (rev 2719)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -110,6 +110,10 @@
public String[] getParameterNames() throws RubyModelException {
return parameterNames;
}
+
+ public int getNumberOfParameters() throws RubyModelException {
+ return getParameterNames().length;
+ }
public boolean isSingleton() {
try {
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/MethodOverrideTester.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/MethodOverrideTester.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/MethodOverrideTester.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.rubypeople.rdt.internal.corext.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.rubypeople.rdt.core.IMethod;
+import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.ITypeHierarchy;
+import org.rubypeople.rdt.core.RubyModelException;
+
+
+public class MethodOverrideTester {
+ private static class Substitutions {
+
+ public static final Substitutions EMPTY_SUBST= new Substitutions();
+
+ private HashMap fMap;
+
+ public Substitutions() {
+ fMap= null;
+ }
+
+ public void addSubstitution(String typeVariable, String substitution, String erasure) {
+ if (fMap == null) {
+ fMap= new HashMap(3);
+ }
+ fMap.put(typeVariable, new String[] { substitution, erasure });
+ }
+
+ private String[] getSubstArray(String typeVariable) {
+ if (fMap != null) {
+ return (String[]) fMap.get(typeVariable);
+ }
+ return null;
+ }
+
+ public String getSubstitution(String typeVariable) {
+ String[] subst= getSubstArray(typeVariable);
+ if (subst != null) {
+ return subst[0];
+ }
+ return null;
+ }
+
+ public String getErasure(String typeVariable) {
+ String[] subst= getSubstArray(typeVariable);
+ if (subst != null) {
+ return subst[1];
+ }
+ return null;
+ }
+ }
+
+ private final IType fFocusType;
+ private final ITypeHierarchy fHierarchy;
+
+ private Map /* <IMethod, Substitutions> */ fMethodSubstitutions;
+ private Map /* <IType, Substitutions> */ fTypeVariableSubstitutions;
+
+ public MethodOverrideTester(IType focusType, ITypeHierarchy hierarchy) {
+ fFocusType= focusType;
+ fHierarchy= hierarchy;
+ fTypeVariableSubstitutions= null;
+ fMethodSubstitutions= null;
+ }
+
+ public IType getFocusType() {
+ return fFocusType;
+ }
+
+ public ITypeHierarchy getTypeHierarchy() {
+ return fHierarchy;
+ }
+
+ /**
+ * Finds the method that declares the given method. A declaring method is the 'original' method declaration that does
+ * not override nor implement a method. <code>null</code> is returned it the given method does not override
+ * a method. When searching, super class are examined before implemented interfaces.
+ * @param testVisibility If true the result is tested on visibility. Null is returned if the method is not visible.
+ * @throws RubyModelException
+ */
+ public IMethod findDeclaringMethod(IMethod overriding, boolean testVisibility) throws RubyModelException {
+ IMethod result= null;
+ IMethod overridden= findOverriddenMethod(overriding, testVisibility);
+ while (overridden != null) {
+ result= overridden;
+ overridden= findOverriddenMethod(result, testVisibility);
+ }
+ return result;
+ }
+
+ /**
+ * Finds the method that is overridden by the given method.
+ * First the super class is examined and then the implemented interfaces.
+ * @param testVisibility If true the result is tested on visibility. Null is returned if the method is not visible.
+ * @throws RubyModelException
+ */
+ public IMethod findOverriddenMethod(IMethod overriding, boolean testVisibility) throws RubyModelException {
+ if (overriding.getVisibility() == IMethod.PRIVATE || overriding.isSingleton() || overriding.isConstructor()) {
+ return null;
+ }
+
+ IType type= overriding.getDeclaringType();
+ IType superClass= fHierarchy.getSuperclass(type);
+ if (superClass != null) {
+ IMethod res= findOverriddenMethodInHierarchy(superClass, overriding);
+ if (res != null && res.getVisibility() != IMethod.PRIVATE) {
+ if (!testVisibility || RubyModelUtil.isVisibleInHierarchy(res, type.getSourceFolder())) {
+ return res;
+ }
+ }
+ }
+ if (!overriding.isConstructor()) {
+ IType[] interfaces= fHierarchy.getSuperInterfaces(type);
+ for (int i= 0; i < interfaces.length; i++) {
+ IMethod res= findOverriddenMethodInHierarchy(interfaces[i], overriding);
+ if (res != null) {
+ return res; // methods from interfaces are always public and therefore visible
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds the directly overridden method in a type and its super types. First the super class is examined and then the implemented interfaces.
+ * With generics it is possible that 2 methods in the same type are overidden at the same time. In that case, the first overridden method found is returned.
+ * @param type The type to find methods in
+ * @param overriding The overriding method
+ * @return The first overridden method or <code>null</code> if no method is overridden
+ * @throws RubyModelException
+ */
+ public IMethod findOverriddenMethodInHierarchy(IType type, IMethod overriding) throws RubyModelException {
+ IMethod method= findOverriddenMethodInType(type, overriding);
+ if (method != null) {
+ return method;
+ }
+ IType superClass= fHierarchy.getSuperclass(type);
+ if (superClass != null) {
+ IMethod res= findOverriddenMethodInHierarchy(superClass, overriding);
+ if (res != null) {
+ return res;
+ }
+ }
+ if (!overriding.isConstructor()) {
+ IType[] superInterfaces= fHierarchy.getSuperInterfaces(type);
+ for (int i= 0; i < superInterfaces.length; i++) {
+ IMethod res= findOverriddenMethodInHierarchy(superInterfaces[i], overriding);
+ if (res != null) {
+ return res;
+ }
+ }
+ }
+ return method;
+ }
+
+ /**
+ * Finds an overridden method in a type. WWith generics it is possible that 2 methods in the same type are overidden at the same time.
+ * In that case the first overridden method found is returned.
+ * @param overriddenType The type to find methods in
+ * @param overriding The overriding method
+ * @return The first overridden method or <code>null</code> if no method is overridden
+ * @throws RubyModelException
+ */
+ public IMethod findOverriddenMethodInType(IType overriddenType, IMethod overriding) throws RubyModelException {
+ IMethod[] overriddenMethods= overriddenType.getMethods();
+ for (int i= 0; i < overriddenMethods.length; i++) {
+ if (isSubsignature(overriding, overriddenMethods[i])) {
+ return overriddenMethods[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds an overriding method in a type.
+ * @param overridingType The type to find methods in
+ * @param overridden The overridden method
+ * @return The overriding method or <code>null</code> if no method is overriding.
+ * @throws RubyModelException
+ */
+ public IMethod findOverridingMethodInType(IType overridingType, IMethod overridden) throws RubyModelException {
+ IMethod[] overridingMethods= overridingType.getMethods();
+ for (int i= 0; i < overridingMethods.length; i++) {
+ if (isSubsignature(overridingMethods[i], overridden)) {
+ return overridingMethods[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Tests if a method is a subsignature of another method.
+ * @param overriding overriding method (m1)
+ * @param overridden overridden method (m2)
+ * @return <code>true</code> iff the method <code>m1</code> is a subsignature of the method <code>m2</code>.
+ * This is one of the requirements for m1 to override m2.
+ * Accessibility and return types are not taken into account.
+ * Note that subsignature is <em>not</em> symmetric!
+ * @throws RubyModelException
+ */
+ public boolean isSubsignature(IMethod overriding, IMethod overridden) throws RubyModelException {
+ if (!overridden.getElementName().equals(overriding.getElementName())) {
+ return false;
+ }
+ int nParameters= overridden.getNumberOfParameters();
+ if (nParameters != overriding.getNumberOfParameters()) {
+ return false;
+ }
+
+ return nParameters == 0;
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-07-06 16:09:16 UTC (rev 2719)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -5,10 +5,15 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.rubypeople.rdt.core.Flags;
+import org.rubypeople.rdt.core.IMember;
+import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.ISourceFolder;
import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.ITypeHierarchy;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.util.CharOperation;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
@@ -171,4 +176,46 @@
}
return false;
}
+
+ public static boolean isSuperType(ITypeHierarchy hierarchy, IType possibleSuperType, IType type) {
+ // filed bug 112635 to add this method to ITypeHierarchy
+ IType superClass= hierarchy.getSuperclass(type);
+ if (superClass != null && (possibleSuperType.equals(superClass) || isSuperType(hierarchy, possibleSuperType, superClass))) {
+ return true;
+ }
+ if (Flags.isModule(hierarchy.getCachedFlags(possibleSuperType))) {
+ IType[] superInterfaces= hierarchy.getSuperInterfaces(type);
+ for (int i= 0; i < superInterfaces.length; i++) {
+ IType curr= superInterfaces[i];
+ if (possibleSuperType.equals(curr) || isSuperType(hierarchy, possibleSuperType, curr)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Evaluates if a member in the focus' element hierarchy is visible from
+ * elements in a package.
+ * @param member The member to test the visibility for
+ * @param pack The package of the focus element focus
+ */
+ public static boolean isVisibleInHierarchy(IMember member, ISourceFolder pack) throws RubyModelException {
+ if (member.isType(IRubyElement.GLOBAL))
+ return true;
+ if (!member.isType(IRubyElement.METHOD))
+ return false;
+
+ IMethod method = (IMethod) member;
+
+ IType declaringType= member.getDeclaringType();
+ if (method.getVisibility() == IMethod.PUBLIC || method.getVisibility() == IMethod.PROTECTED || (declaringType != null && declaringType.isModule())) {
+ return true;
+ } else if (method.getVisibility() == IMethod.PRIVATE) {
+ return false;
+ }
+
+ ISourceFolder otherpack= (ISourceFolder) member.getAncestor(IRubyElement.SOURCE_FOLDER);
+ return (pack != null && pack.equals(otherpack));
+ }
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java 2007-07-06 16:09:16 UTC (rev 2719)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -87,6 +87,8 @@
public static String OpenTypeAction_tooltip;
public static String OpenTypeAction_errorTitle;
public static String OpenTypeAction_errorMessage;
+ public static String RubyOutlineControl_statusFieldText_hideInheritedMembers;
+ public static String RubyOutlineControl_statusFieldText_showInheritedMembers;
private RubyUIMessages() {
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/TextMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/TextMessages.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/TextMessages.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -0,0 +1,22 @@
+package org.rubypeople.rdt.internal.ui.text;
+
+import org.eclipse.osgi.util.NLS;
+
+public class TextMessages extends NLS {
+
+ private static final String BUNDLE_NAME = TextMessages.class.getName();
+
+ public static String RubyOutlineInformationControl_GoIntoTopLevelType_label;
+ public static String RubyOutlineInformationControl_GoIntoTopLevelType_tooltip;
+ public static String RubyOutlineInformationControl_GoIntoTopLevelType_description;
+ public static String RubyOutlineInformationControl_LexicalSortingAction_label;
+ public static String RubyOutlineInformationControl_LexicalSortingAction_tooltip;
+ public static String RubyOutlineInformationControl_LexicalSortingAction_description;
+ public static String RubyOutlineInformationControl_SortByDefiningTypeAction_label;
+ public static String RubyOutlineInformationControl_SortByDefiningTypeAction_description;
+ public static String RubyOutlineInformationControl_SortByDefiningTypeAction_tooltip;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, TextMessages.class);
+ }
+}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java 2007-07-06 16:09:16 UTC (rev 2719)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java 2007-07-06 19:28:39 UTC (rev 2720)
@@ -149,5 +149,20 @@
*/
public static final String SEARCH_DECLARATIONS_IN_WORKING_SET= "org.rubypeople.rdt.ui.edit.text.ruby.search.declarations.in.working.set"; //$NON-NLS-1$
+ /**
+ * Action definition ID of the navigate -> Show Outline action
+ * (value <code>"org.rubypeople.rdt.ui.edit.text.ruby.show.outline"</code>).
+ *
+ * @since 1.0
+ */
+ public static final String SHOW_OUTLINE= "org.rubypeople.rdt.ui.edit.text.ruby.show.outline"; //$NON-NLS-1$
+
+ /**
+ * Action definition ID of the Navigate -> Open Structure action
+ * (value <code>"org.rubypeople.rdt.ui.navigate.ruby.open.structure"</code>).
+ *
+ * @since 1.0
+ */
+ public static final String OPEN_STRUCTURE= "org.rubypeople.rdt.ui.navigate.ruby.open.structure"; //$NON-NLS-1$
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 16:09:18
|
Revision: 2719
http://svn.sourceforge.net/rubyeclipse/?rev=2719&view=rev
Author: cawilliams
Date: 2007-07-06 09:09:16 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
add some type hierarchy interfaces
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchy.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchyChangedListener.java
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchy.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchy.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchy.java 2007-07-06 16:09:16 UTC (rev 2719)
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.rubypeople.rdt.core;
+
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * A type hierarchy provides navigations between a type and its resolved
+ * supertypes and subtypes for a specific type or for all types within a region.
+ * Supertypes may extend outside of the type hierarchy's region in which it was
+ * created such that the root of the hierarchy is always included. For example, if a type
+ * hierarchy is created for a <code>java.io.File</code>, and the region the hierarchy was
+ * created in is the package fragment <code>java.io</code>, the supertype
+ * <code>java.lang.Object</code> will still be included.
+ * <p>
+ * A type hierarchy is static and can become stale. Although consistent when
+ * created, it does not automatically track changes in the model.
+ * As changes in the model potentially invalidate the hierarchy, change notifications
+ * are sent to registered <code>ITypeHierarchyChangedListener</code>s. Listeners should
+ * use the <code>exists</code> method to determine if the hierarchy has become completely
+ * invalid (for example, when the type or project the hierarchy was created on
+ * has been removed). To refresh a hierarchy, use the <code>refresh</code> method.
+ * </p>
+ * <p>
+ * The type hierarchy may contain cycles due to malformed supertype declarations.
+ * Most type hierarchy queries are oblivious to cycles; the <code>getAll* </code>
+ * methods are implemented such that they are unaffected by cycles.
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ */
+public interface ITypeHierarchy {
+/**
+ * Adds the given listener for changes to this type hierarchy. Listeners are
+ * notified when this type hierarchy changes and needs to be refreshed.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener the listener
+ */
+void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
+/**
+ * Returns whether the given type is part of this hierarchy.
+ *
+ * @param type the given type
+ * @return true if the given type is part of this hierarchy, false otherwise
+ */
+boolean contains(IType type);
+/**
+ * Returns whether the type and project this hierarchy was created on exist.
+ * @return true if the type and project this hierarchy was created on exist, false otherwise
+ */
+boolean exists();
+/**
+ * Returns all classes in this type hierarchy's graph, in no particular
+ * order. Any classes in the creation region which were not resolved to
+ * have any subtypes or supertypes are not included in the result.
+ *
+ * @return all classes in this type hierarchy's graph
+ */
+IType[] getAllClasses();
+/**
+ * Returns all interfaces in this type hierarchy's graph, in no particular
+ * order. Any interfaces in the creation region which were not resolved to
+ * have any subtypes or supertypes are not included in the result.
+ *
+ * @return all interfaces in this type hierarchy's graph
+ */
+IType[] getAllInterfaces();
+/**
+ * Returns all resolved subtypes (direct and indirect) of the
+ * given type, in no particular order, limited to the
+ * types in this type hierarchy's graph. An empty array
+ * is returned if there are no resolved subtypes for the
+ * given type.
+ *
+ * @param type the given type
+ * @return all resolved subtypes (direct and indirect) of the given type
+ */
+IType[] getAllSubtypes(IType type);
+/**
+ * Returns all resolved superclasses of the
+ * given class, in bottom-up order. An empty array
+ * is returned if there are no resolved superclasses for the
+ * given class.
+ *
+ * <p>NOTE: once a type hierarchy has been created, it is more efficient to
+ * query the hierarchy for superclasses than to query a class recursively up
+ * the superclass chain. Querying an element performs a dynamic resolution,
+ * whereas the hierarchy returns a pre-computed result.
+ *
+ * @param type the given type
+ * @return all resolved superclasses of the given class, in bottom-up order, an empty
+ * array if none.
+ */
+IType[] getAllSuperclasses(IType type);
+/**
+ * Returns all resolved superinterfaces (direct and indirect) of the given type.
+ * If the given type is a class, this includes all superinterfaces of all superclasses.
+ * An empty array is returned if there are no resolved superinterfaces for the
+ * given type.
+ *
+ * <p>NOTE: once a type hierarchy has been created, it is more efficient to
+ * query the hierarchy for superinterfaces than to query a type recursively.
+ * Querying an element performs a dynamic resolution,
+ * whereas the hierarchy returns a pre-computed result.
+ *
+ * @param type the given type
+ * @return all resolved superinterfaces (direct and indirect) of the given type, an empty array if none
+ */
+IType[] getAllSuperInterfaces(IType type);
+/**
+ * Returns all resolved supertypes of the
+ * given type, in bottom-up order. An empty array
+ * is returned if there are no resolved supertypes for the
+ * given type.
+ * <p>
+ * Note that <code>java.lang.Object</code> is NOT considered to be a supertype
+ * of any interface type.
+ * </p><p>NOTE: once a type hierarchy has been created, it is more efficient to
+ * query the hierarchy for supertypes than to query a type recursively up
+ * the supertype chain. Querying an element performs a dynamic resolution,
+ * whereas the hierarchy returns a pre-computed result.
+ *
+ * @param type the given type
+ * @return all resolved supertypes of the given class, in bottom-up order, an empty array
+ * if none
+ */
+IType[] getAllSupertypes(IType type);
+/**
+ * Returns all types in this type hierarchy's graph, in no particular
+ * order. Any types in the creation region which were not resolved to
+ * have any subtypes or supertypes are not included in the result.
+ *
+ * @return all types in this type hierarchy's grap
+ */
+IType[] getAllTypes();
+
+/**
+ * Return the flags associated with the given type (would be equivalent to <code>IMember.getFlags()</code>),
+ * or <code>-1</code> if this information wasn't cached on the hierarchy during its computation.
+ *
+ * @param type the given type
+ * @return the modifier flags for this member
+ * @see Flags
+ * @since 2.0
+ */
+int getCachedFlags(IType type);
+
+/**
+ * Returns all interfaces resolved to extend the given interface,
+ * in no particular order, limited to the interfaces in this
+ * hierarchy's graph.
+ * Returns an empty collection if the given type is a class, or
+ * if no interfaces were resolved to extend the given interface.
+ *
+ * @param type the given type
+ * @return all interfaces resolved to extend the given interface limited to the interfaces in this
+ * hierarchy's graph, an empty array if none.
+ */
+IType[] getExtendingInterfaces(IType type);
+/**
+ * Returns all classes resolved to implement the given interface,
+ * in no particular order, limited to the classes in this type
+ * hierarchy's graph. Returns an empty collection if the given type is a
+ * class, or if no classes were resolved to implement the given
+ * interface.
+ *
+ * @param type the given type
+ * @return all classes resolved to implement the given interface limited to the classes in this type
+ * hierarchy's graph, an empty array if none
+ */
+IType[] getImplementingClasses(IType type);
+/**
+ * Returns all classes in the graph which have no resolved superclass,
+ * in no particular order.
+ *
+ * @return all classes in the graph which have no resolved superclass
+ */
+IType[] getRootClasses();
+/**
+ * Returns all interfaces in the graph which have no resolved superinterfaces,
+ * in no particular order.
+ *
+ * @return all interfaces in the graph which have no resolved superinterfaces
+ */
+IType[] getRootInterfaces();
+/**
+ * Returns the direct resolved subclasses of the given class,
+ * in no particular order, limited to the classes in this
+ * type hierarchy's graph.
+ * Returns an empty collection if the given type is an interface,
+ * or if no classes were resolved to be subclasses of the given
+ * class.
+ *
+ * @param type the given type
+ * @return the direct resolved subclasses of the given class limited to the classes in this
+ * type hierarchy's graph, an empty collection if none.
+ */
+IType[] getSubclasses(IType type);
+/**
+ * Returns the direct resolved subtypes of the given type,
+ * in no particular order, limited to the types in this
+ * type hierarchy's graph.
+ * If the type is a class, this returns the resolved subclasses.
+ * If the type is an interface, this returns both the classes which implement
+ * the interface and the interfaces which extend it.
+ *
+ * @param type the given type
+ * @return the direct resolved subtypes of the given type limited to the types in this
+ * type hierarchy's graph
+ */
+IType[] getSubtypes(IType type);
+/**
+ * Returns the resolved superclass of the given class,
+ * or <code>null</code> if the given class has no superclass,
+ * the superclass could not be resolved, or if the given
+ * type is an interface.
+ *
+ * @param type the given type
+ * @return the resolved superclass of the given class,
+ * or <code>null</code> if the given class has no superclass,
+ * the superclass could not be resolved, or if the given
+ * type is an interface
+ */
+IType getSuperclass(IType type);
+/**
+ * Returns the direct resolved interfaces that the given type implements or extends,
+ * in no particular order, limited to the interfaces in this type
+ * hierarchy's graph.
+ * For classes, this gives the interfaces that the class implements.
+ * For interfaces, this gives the interfaces that the interface extends.
+ *
+ * @param type the given type
+ * @return the direct resolved interfaces that the given type implements or extends limited to the interfaces in this type
+ * hierarchy's graph
+ */
+IType[] getSuperInterfaces(IType type);
+/**
+ * Returns the resolved supertypes of the given type,
+ * in no particular order, limited to the types in this
+ * type hierarchy's graph.
+ * For classes, this returns its superclass and the interfaces that the class implements.
+ * For interfaces, this returns the interfaces that the interface extends. As a consequence
+ * <code>java.lang.Object</code> is NOT considered to be a supertype of any interface
+ * type.
+ *
+ * @param type the given type
+ * @return the resolved supertypes of the given type limited to the types in this
+ * type hierarchy's graph
+ */
+IType[] getSupertypes(IType type);
+/**
+ * Returns the type this hierarchy was computed for.
+ * Returns <code>null</code> if this hierarchy was computed for a region.
+ *
+ * @return the type this hierarchy was computed for
+ */
+IType getType();
+/**
+ * Re-computes the type hierarchy reporting progress.
+ *
+ * @param monitor the given progress monitor
+ * @exception RubyModelException if unable to refresh the hierarchy
+ */
+void refresh(IProgressMonitor monitor) throws RubyModelException;
+/**
+ * Removes the given listener from this type hierarchy.
+ * Has no affect if an identical listener is not registered.
+ *
+ * @param listener the listener
+ */
+void removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
+/**
+ * Stores the type hierarchy in an output stream. This stored hierarchy can be load by
+ * IType#loadTypeHierachy(IRubyProject, InputStream, IProgressMonitor).
+ * Listeners of this hierarchy are not stored.
+ *
+ * Only hierarchies created by the following methods can be store:
+ * <ul>
+ * <li>IType#newSupertypeHierarchy(IProgressMonitor)</li>
+ * <li>IType#newTypeHierarchy(IRubyProject, IProgressMonitor)</li>
+ * <li>IType#newTypeHierarchy(IProgressMonitor)</li>
+ * </ul>
+ *
+ * @param outputStream output stream where the hierarchy will be stored
+ * @param monitor the given progress monitor
+ * @exception RubyModelException if unable to store the hierarchy in the ouput stream
+ * @see IType#loadTypeHierachy(java.io.InputStream, IProgressMonitor)
+ * @since 2.1
+ */
+void store(OutputStream outputStream, IProgressMonitor monitor) throws RubyModelException;
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchyChangedListener.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchyChangedListener.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ITypeHierarchyChangedListener.java 2007-07-06 16:09:16 UTC (rev 2719)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.rubypeople.rdt.core;
+
+/**
+ * A listener which gets notified when a particular type hierarchy object
+ * changes.
+ * <p>
+ * This interface may be implemented by clients.
+ * </p>
+ */
+public interface ITypeHierarchyChangedListener {
+ /**
+ * Notifies that the given type hierarchy has changed in some way and should
+ * be refreshed at some point to make it consistent with the current state of
+ * the Java model.
+ *
+ * @param typeHierarchy the given type hierarchy
+ */
+ void typeHierarchyChanged(ITypeHierarchy typeHierarchy);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 14:55:59
|
Revision: 2718
http://svn.sourceforge.net/rubyeclipse/?rev=2718&view=rev
Author: cawilliams
Date: 2007-07-06 07:55:58 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
update version number of JRuby plugin
Modified Paths:
--------------
trunk/org.rubypeople.rdt-feature/feature.xml
Modified: trunk/org.rubypeople.rdt-feature/feature.xml
===================================================================
--- trunk/org.rubypeople.rdt-feature/feature.xml 2007-07-06 14:41:28 UTC (rev 2717)
+++ trunk/org.rubypeople.rdt-feature/feature.xml 2007-07-06 14:55:58 UTC (rev 2718)
@@ -117,7 +117,7 @@
id="org.jruby"
download-size="2359"
install-size="2359"
- version="1.0.0.3788"
+ version="1.0.0.3967"
unpack="false"/>
<plugin
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 14:41:30
|
Revision: 2717
http://svn.sourceforge.net/rubyeclipse/?rev=2717&view=rev
Author: cawilliams
Date: 2007-07-06 07:41:28 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Property Changed:
----------------
trunk/org.jruby/lib/jruby.jar
Property changes on: trunk/org.jruby/lib/jruby.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 14:40:01
|
Revision: 2716
http://svn.sourceforge.net/rubyeclipse/?rev=2716&view=rev
Author: cawilliams
Date: 2007-07-06 07:39:56 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
update to latest JRuby (rev 3967), include new patch to help fix a bug #5086
Revision Links:
--------------
http://svn.sourceforge.net/rubyeclipse/?rev=3967&view=rev
Modified Paths:
--------------
trunk/org.jruby/META-INF/MANIFEST.MF
trunk/org.jruby/src.zip
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RubyParser.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeFactory.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/encapsulatefield/FieldEncapsulator.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/formatsource/PreviewGeneratorImpl.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/generateconstructor/GeneratedConstructor.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinemethod/ParameterReplacer.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethodsClass.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pushdown/DownPushedMethodsClass.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NodeUtil.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/TC_ModuleNodeProvider.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/TC_NodeProvider.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinemethod/TC_ReturnStatementReplacer.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/nodewrapper/TC_FieldNodeWrapper.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/nodewrapper/TC_MethodNodeWrapper.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
Added Paths:
-----------
trunk/org.jruby/lib/jruby.jar
trunk/org.jruby/patches/
trunk/org.jruby/patches/RubyYaccLexer.patch
Removed Paths:
-------------
trunk/org.jruby/lib/jruby.jar
Modified: trunk/org.jruby/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.jruby/META-INF/MANIFEST.MF 2007-07-06 13:13:42 UTC (rev 2715)
+++ trunk/org.jruby/META-INF/MANIFEST.MF 2007-07-06 14:39:56 UTC (rev 2716)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: JRuby Plug-in
Bundle-SymbolicName: org.jruby
-Bundle-Version: 1.0.0.3788
+Bundle-Version: 1.0.0.3967
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime
Eclipse-LazyStart: false
@@ -10,9 +10,7 @@
lib/asm-2.2.3.jar,
lib/backport-util-concurrent.jar,
lib/jruby.jar
-Export-Package: org.ablaf.ast,
- org.ablaf.internal.ast,
- org.jruby,
+Export-Package: org.jruby,
org.jruby.ast,
org.jruby.ast.types,
org.jruby.ast.util,
@@ -30,7 +28,6 @@
org.jruby.javasupport.util,
org.jruby.lexer.yacc,
org.jruby.libraries,
- org.jruby.main,
org.jruby.parser,
org.jruby.runtime,
org.jruby.runtime.builtin,
Deleted: trunk/org.jruby/lib/jruby.jar
===================================================================
(Binary files differ)
Added: trunk/org.jruby/lib/jruby.jar
===================================================================
--- trunk/org.jruby/lib/jruby.jar (rev 0)
+++ trunk/org.jruby/lib/jruby.jar 2007-07-06 14:39:56 UTC (rev 2716)
@@ -0,0 +1,16366 @@
+PK
+ |
|
From: <caw...@us...> - 2007-07-06 13:13:43
|
Revision: 2715
http://svn.sourceforge.net/rubyeclipse/?rev=2715&view=rev
Author: cawilliams
Date: 2007-07-06 06:13:42 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
add test and fix for #5019 - Hyperlinks in the Console fails if the path contains backslashes
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java 2007-07-06 13:00:50 UTC (rev 2714)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java 2007-07-06 13:13:42 UTC (rev 2715)
@@ -92,8 +92,7 @@
if (file.exists()) return false;
return true;
}
- int index = fFilename.indexOf('/');
- if (index != -1 && fFilename.charAt(index - 1) != ':' ) return true;
+ if (fFilename.contains(":")) return false;
return false;
}
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java 2007-07-06 13:00:50 UTC (rev 2714)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java 2007-07-06 13:13:42 UTC (rev 2715)
@@ -16,6 +16,7 @@
import junit.framework.TestCase;
public class TC_StackTraceLine extends TestCase {
+ private static final String BACKSLASH_FILE_PATH = "C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-1.4.2\\lib/active_support/dependencies.rb:376:in `new_constants_in': undefined method `empty?' for nil:NilClass (NoMethodError)";
private static final String RUBY_CONSOLE_TEST_FAILURE = "testA(BTest) [/RdtTestLib/anotherFile.rb:12]:";
private static final String TEST_UNIT_VIEW_BACKTRACE = " /RdtTestLib/anotherFile.rb:12";
private static final String BACKTRACE_WITH_IN = " /RdtTestLib/anotherFile.rb:12:in `testB'";
@@ -105,7 +106,15 @@
assertEquals("Line Number", 5, traceLine.getLineNumber());
assertEquals("Offset", 1, traceLine.offset());
assertEquals("Length", 37, traceLine.length());
-
}
+
+ public void testBackslashInFilePath() {
+ StackTraceLine traceLine = new StackTraceLine(BACKSLASH_FILE_PATH, new ShamProject("testing"));
+
+ assertEquals("Filename", "C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\activesupport-1.4.2\\lib/active_support/dependencies.rb", traceLine.getFilename());
+ assertEquals("Line Number", 376, traceLine.getLineNumber());
+ assertEquals("Offset", 0, traceLine.offset());
+ assertEquals("Length", 89, traceLine.length());
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-06 13:00:51
|
Revision: 2714
http://svn.sourceforge.net/rubyeclipse/?rev=2714&view=rev
Author: cawilliams
Date: 2007-07-06 06:00:50 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
apply patch from pez
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java 2007-07-05 14:46:40 UTC (rev 2713)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java 2007-07-06 13:00:50 UTC (rev 2714)
@@ -136,12 +136,16 @@
}
public void assertLink(int expectedOffset, int expectedLength, String expectedFilename, int expectedLineNumber, int linkIndex) {
- MetaLink metaLink = (MetaLink) metaLinks.get(linkIndex);
- assertNotNull(metaLink);
- assertEquals("Offset of link["+linkIndex+"]", expectedOffset, metaLink.offset);
- assertEquals(expectedLength, metaLink.length);
- assertEquals(expectedFilename, metaLink.link.getFilename());
- assertEquals(expectedLineNumber, metaLink.link.getLineNumber());
+ try {
+ MetaLink metaLink = (MetaLink) metaLinks.get(linkIndex);
+ assertNotNull(metaLink);
+ assertEquals("Offset of link["+linkIndex+"]", expectedOffset, metaLink.offset);
+ assertEquals(expectedLength, metaLink.length);
+ assertEquals(expectedFilename, metaLink.link.getFilename());
+ assertEquals(expectedLineNumber, metaLink.link.getLineNumber());
+ } catch (IndexOutOfBoundsException e) {
+ fail("Link index out of bounds: (" + linkIndex + ")");
+ }
}
public void addLink(IConsoleHyperlink pLink, int pOffset, int pLength) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-05 14:46:42
|
Revision: 2713
http://svn.sourceforge.net/rubyeclipse/?rev=2713&view=rev
Author: cawilliams
Date: 2007-07-05 07:46:40 -0700 (Thu, 05 Jul 2007)
Log Message:
-----------
add tests and fix to handle files whose path looks absolute but is actually relative to the workspace
(i.e. /app/controllers/tags_controller.rb)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java 2007-07-05 14:03:13 UTC (rev 2712)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/TC_RubyConsoleTracker.java 2007-07-05 14:46:40 UTC (rev 2713)
@@ -77,6 +77,26 @@
console.assertLinkCount(0);
}
+ /**
+ * From http://www.aptana.com/trac/ticket/5019
+ * @throws Exception
+ */
+ public void testBackslashesInFilePath() throws Exception {
+ fileChecker.addKnownFile("C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\rails-1.2.3\\lib/commands/server.rb");
+
+ console.lineAppend("\tfrom C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\rails-1.2.3\\lib/commands/server.rb:1") ;
+ console.assertLinkCount(1);
+ console.assertLink(6, 67, "C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\rails-1.2.3\\lib/commands/server.rb", 1, 0);
+ }
+
+ public void testWorkspaceRelativeStartingWithSlash() throws Exception {
+ fileChecker.addKnownFile("/app/controllers/tags_controller.rb");
+
+ console.lineAppend("\t/app/controllers/tags_controller.rb:5:in `index'") ;
+ console.assertLinkCount(1);
+ console.assertLink(1, 37, "/app/controllers/tags_controller.rb", 5, 0);
+ }
+
private final class MockFileExistanceChecker implements RubyConsoleTracker.FileExistanceChecker {
private List knownFiles = new ArrayList();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java 2007-07-05 14:03:13 UTC (rev 2712)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/StackTraceLine.java 2007-07-05 14:46:40 UTC (rev 2713)
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.rubypeople.rdt.internal.ui.util;
+import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -77,17 +78,22 @@
private void makeRelativeToWorkspace(IProject launchedProject) {
if (fFilename.startsWith("./")) {
fFilename = launchedProject.getFullPath().toPortableString() + fFilename.substring(1);
- return;
+ } else if (fFilename.startsWith("/")) {
+ fFilename = launchedProject.getFullPath().toPortableString() + fFilename;
} else {
fFilename = launchedProject.getFullPath().toPortableString() + '/' + fFilename;
- }
-
+ }
}
private boolean isRelativePath() {
if (fFilename.startsWith("./")) return true;
+ if (fFilename.startsWith("/")) { // If it starts with '/' it could be relative to workspace or absolute on *-nix!
+ File file = new File(fFilename);
+ if (file.exists()) return false;
+ return true;
+ }
int index = fFilename.indexOf('/');
- if (index != -1 && !fFilename.startsWith("/") && fFilename.charAt(index - 1) != ':' ) return true;
+ if (index != -1 && fFilename.charAt(index - 1) != ':' ) return true;
return false;
}
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java 2007-07-05 14:03:13 UTC (rev 2712)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/TC_StackTraceLine.java 2007-07-05 14:46:40 UTC (rev 2713)
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.rubypeople.rdt.internal.ui;
+import org.rubypeople.eclipse.shams.resources.ShamProject;
import org.rubypeople.rdt.internal.ui.util.StackTraceLine;
import junit.framework.TestCase;
@@ -22,6 +23,7 @@
private static final String ODD_WITH_FROM = " ^ from /RdtTestLib/anotherFile.rb:4";
private static final String WITH_OUT_FROM = "/RdtTestLib/anotherFile.rb:4";
private static final String WITH_TRAILING_SPACE = "/RdtTestLib/anotherFile.rb:4 ";
+ private static final String LOOKS_ABSOLUTE = "\t/app/controllers/tags_controller.rb:5:in `index'";
public void testWithFrom() {
assertFalse("has a stack trace", StackTraceLine.isTraceLine(WITH_TRAILING_SPACE));
@@ -94,6 +96,15 @@
assertEquals("Line Number", 12, traceLine.getLineNumber());
assertEquals("Offset", 3, traceLine.offset());
assertEquals("Length", 29, traceLine.length());
+ }
+
+ public void testLooksAbsoluteButIsRelativeToProject() {
+ StackTraceLine traceLine = new StackTraceLine(LOOKS_ABSOLUTE, new ShamProject("testing"));
+
+ assertEquals("Filename", "/testing/app/controllers/tags_controller.rb", traceLine.getFilename());
+ assertEquals("Line Number", 5, traceLine.getLineNumber());
+ assertEquals("Offset", 1, traceLine.offset());
+ assertEquals("Length", 37, traceLine.length());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-05 14:03:27
|
Revision: 2712
http://svn.sourceforge.net/rubyeclipse/?rev=2712&view=rev
Author: cawilliams
Date: 2007-07-05 07:03:13 -0700 (Thu, 05 Jul 2007)
Log Message:
-----------
fix up translation strings.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.java 2007-07-05 13:29:13 UTC (rev 2711)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.java 2007-07-05 14:03:13 UTC (rev 2712)
@@ -10,25 +10,22 @@
*******************************************************************************/
package org.rubypeople.rdt.internal.ui.infoviews;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import org.eclipse.osgi.util.NLS;
/**
- * @since 3.0
+ *
*/
-class InfoViewMessages {
+class InfoViewMessages extends NLS {
private static final String BUNDLE_NAME= InfoViewMessages.class.getName();
-
- private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
-
- private InfoViewMessages() {}
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
+
+ public static String RubyInformation_ri_not_found;
+ public static String RubyInformation_please_wait;
+ public static String RubyInformation_refresh;
+ public static String RubyInformation_refresh_tooltip;
+ public static String RubyInformation_update_job_title;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, InfoViewMessages.class);
}
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.properties 2007-07-05 13:29:13 UTC (rev 2711)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/InfoViewMessages.properties 2007-07-05 14:03:13 UTC (rev 2712)
@@ -1,7 +1,8 @@
-RubyInformation.interpreter_not_selected= You must define an interpreter before viewing Ruby information.
-RubyInformation.ri_not_found= Ri is either not installed or not found. Please set the path to ri through Window > Preferences > Ruby > Ri / Rdoc. This view reflects changes of the path automatically. The ri path should point a file called ri in your ruby installation directory. If there is no such file, you probably can create one if you have rdoc installed (this is tested with version 1.0.1). The file needs to import (require) 'rdoc/ri/ri_driver' and then the line RiDriver.new.process_args.
-RubyInformation.tool_tip= Ask Ri for help
-RubyInformation.run= Run RI
-RubyInformation.please_wait= Please wait...
-RubyInformation.search_label=Filter:
-RubyInformation.result_label=Description:
+RubyInformation_ri_not_found= Ri is either not installed or not found. {0}
+RubyInformation_tool_tip= Ask Ri for help
+RubyInformation_please_wait=Please wait. Updating RI View...
+
+RubyInformation_refresh=Refresh
+RubyInformation_refresh_tooltip=Refresh list of names
+
+RubyInformation_update_job_title=Updating RI View
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-07-05 13:29:13 UTC (rev 2711)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-07-05 14:03:13 UTC (rev 2712)
@@ -53,7 +53,6 @@
private boolean riFound = false;
private PageBook pageBook;
private SashForm form;
- private Label riNotFoundLabel;
private Text searchStr;
private TableViewer searchListViewer;
private Browser searchResult;
@@ -75,14 +74,10 @@
public void createPartControl(Composite parent) {
contributeToActionBars();
- pageBook = new PageBook(parent, SWT.NONE);
-
- riNotFoundLabel = new Label( pageBook, SWT.LEFT | SWT.TOP | SWT.WRAP );
- riNotFoundLabel.setText( InfoViewMessages.getString( "RubyInformation.ri_not_found") );
-
+ pageBook = new PageBook(parent, SWT.NONE);
Label inProgressLabel = new Label( pageBook, SWT.LEFT | SWT.TOP | SWT.WRAP );
- inProgressLabel.setText("Please wait. Updating RI View...");
+ inProgressLabel.setText(InfoViewMessages.RubyInformation_please_wait);
form = new SashForm(pageBook, SWT.HORIZONTAL);
@@ -145,8 +140,8 @@
updatePage();
}
};
- refreshAction.setText("Refresh");
- refreshAction.setToolTipText("Refresh list of names");
+ refreshAction.setText(InfoViewMessages.RubyInformation_refresh);
+ refreshAction.setToolTipText(InfoViewMessages.RubyInformation_refresh_tooltip);
refreshAction.setImageDescriptor(RubyPluginImages.TOOLBAR_REFRESH);
IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
@@ -187,7 +182,7 @@
private RubyInvoker invoker;
public RubyInvokerJob(RubyInvoker invoker) {
- super("Updating RI View"); // $NON-NLS-1$
+ super(InfoViewMessages.RubyInformation_update_job_title);
this.invoker = invoker;
}
@@ -250,7 +245,7 @@
riFound = false;
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
- pageBook.showPage(riNotFoundLabel);
+ pageBook.showPage(riNotFoundLabel());
}
});
return;
@@ -291,7 +286,7 @@
}
protected void beforeInvoke() {
- searchResult.setText(InfoViewMessages.getString("RubyInformation.please_wait"));
+ searchResult.setText(InfoViewMessages.RubyInformation_please_wait);
}
void addToBuffer(int position, final String line) {
@@ -361,7 +356,7 @@
while ((line = reader.readLine()) != null) {
fgPossibleMatches.add(line.trim());
}
- // if not matches were found display an error message
+ // if no matches were found display an error message
if( fgPossibleMatches.size() == 0 ){
view.riNotFound();
} else {
@@ -384,8 +379,14 @@
void riNotFound() {
riFound = false;
- pageBook.showPage( riNotFoundLabel );
+ pageBook.showPage( riNotFoundLabel() );
}
+
+ protected Label riNotFoundLabel() {
+ Label riNotFoundLabel = new Label( pageBook, SWT.LEFT | SWT.TOP | SWT.WRAP );
+ riNotFoundLabel.setText(InfoViewMessages.bind(InfoViewMessages.RubyInformation_ri_not_found, RubyRuntime.getRI()));
+ return riNotFoundLabel;
+ }
public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current) {
updatePage();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-05 13:29:14
|
Revision: 2711
http://svn.sourceforge.net/rubyeclipse/?rev=2711&view=rev
Author: cawilliams
Date: 2007-07-05 06:29:13 -0700 (Thu, 05 Jul 2007)
Log Message:
-----------
fix #5079
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-07-03 18:36:37 UTC (rev 2710)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-07-05 13:29:13 UTC (rev 2711)
@@ -153,7 +153,7 @@
}
IType[] types = requestor.findType(name);
for (int i = 0; i < types.length; i++) {
- Map<String, CompletionProposal> map = doSuggestMethods(guess.getConfidence(), types[i], true);
+ Map<String, CompletionProposal> map = suggestMethods(guess.getConfidence(), types[i], true);
list.addAll(map.values());
}
}
@@ -357,7 +357,9 @@
if (fVisitedTypes.contains(type)) return proposals;
fVisitedTypes.add(type);
IMethod[] methods = type.getMethods();
+ if (methods == null) return proposals;
for (int k = 0; k < methods.length; k++) {
+ if (methods[k] == null) continue;
if (!includeInstanceMethods && !methods[k].isSingleton()) {
continue;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-03 18:36:38
|
Revision: 2710
http://svn.sourceforge.net/rubyeclipse/?rev=2710&view=rev
Author: cawilliams
Date: 2007-07-03 11:36:37 -0700 (Tue, 03 Jul 2007)
Log Message:
-----------
include new feature.properties file as part of build
Modified Paths:
--------------
trunk/org.rubypeople.rdt-feature/build.properties
Modified: trunk/org.rubypeople.rdt-feature/build.properties
===================================================================
--- trunk/org.rubypeople.rdt-feature/build.properties 2007-07-03 18:36:20 UTC (rev 2709)
+++ trunk/org.rubypeople.rdt-feature/build.properties 2007-07-03 18:36:37 UTC (rev 2710)
@@ -1,2 +1,3 @@
-bin.includes = feature.xml
+bin.includes = feature.xml,\
+ feature.properties
gen...@or...=org.rubypeople.rdt
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-03 18:36:23
|
Revision: 2709
http://svn.sourceforge.net/rubyeclipse/?rev=2709&view=rev
Author: cawilliams
Date: 2007-07-03 11:36:20 -0700 (Tue, 03 Jul 2007)
Log Message:
-----------
pull out information into a feature.properties file
Modified Paths:
--------------
trunk/org.rubypeople.rdt-feature/feature.xml
Added Paths:
-----------
trunk/org.rubypeople.rdt-feature/feature.properties
Added: trunk/org.rubypeople.rdt-feature/feature.properties
===================================================================
--- trunk/org.rubypeople.rdt-feature/feature.properties (rev 0)
+++ trunk/org.rubypeople.rdt-feature/feature.properties 2007-07-03 18:36:20 UTC (rev 2709)
@@ -0,0 +1,278 @@
+###############################################################################
+# Copyright (c) 2007 Aptana, Inc.
+#
+# 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. If redistributing this code,
+# this entire header must remain intact.
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Ruby Development Tools
+
+# "providerName" property - name of the company that provides the feature
+providerName=RubyPeople Org.
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Ruby Development Tools
+
+# "descriptionURL" property
+descriptionURL=http://www.rubypeople.org
+
+# "description" property - description of the feature
+description=Ruby Development Tools for Eclipse.\n\
+RDT is a set of plugins for Eclipse which makes the platform\
+a Ruby-aware IDE. RDT provides a ruby debugger, code outline,\
+syntax highlighting, ri/rdoc integration, code completion, code\
+folding, variable occurence marking and much more.
+
+# "copyright" property - text of the "Feature Update Copyright"
+# should be plain text version of copyright
+copyright=\
+The Ruby Development Tools (RDT) plugin for eclipse is subject\n\
+to the Common Public License (CPL) v 1.0. All files of the RDT\n\
+except for the external plug-ins and libraries named below are\n\
+copyright of RubyPeople. RubyPeople is not a legal entity, but\n\
+consists of the following people who have contributed to the\n\
+RDT. Currently these are (in alphabetical order):\n\
+Markus Barchfeld, Thomas Corbat, David Corbin, Zach Dennis,\n\
+Lukas Felber, Mirko Stocker, Adam Williams and Chris Williams.\n\
+See www.rubypeople.org for more information.\n\
+The RDT feature contains the following plug-ins and libraries\n\
+from external providers:\n\
+RegExp plug-in, http://e-p-i-c.sourceforge.net\n\
+JRuby, http://jruby.codehaus.org/\n\
+kxml2, http://kxml.sourceforge.net\n\
+The file org.rubypeople.rdt.launching/ruby/classic-debug.rb\n\
+is based on the debug.rb file, which is part of the ruby 1.6.8\n\
+release. Because of the nature of developing this plugin, many\n\
+features or concepts have been copied from the JDT. Therefore\n\
+you will find code fragements which have been copied from the\n\
+JDT. We did not add the IBM copyright with every code fragment\n\
+of this kind. We think that this is in accordance with the CPL\n\
+and is not an intended removal of copyright.\n
+
+# "copyrightURL" property
+copyrightURL=http://www.rubypeople.org
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=http://www.eclipse.org/legal/cpl-v10.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Common Public License Version 1.0\n\
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS\n\
+COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR\n\
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE\n\
+OF THIS AGREEMENT.\n\
+1. DEFINITIONS\n\
+"Contribution" means:\n\
+a) in the case of the initial Contributor, the initial code and\n\
+documentation distributed under this Agreement, and\n\
+b) in the case of each subsequent Contributor:\n\
+i) changes to the Program, and\n\
+ii) additions to the Program;\n\
+where such changes and/or additions to the Program originate\n\
+from and are distributed by that particular Contributor. A Contribution\n\
+'originates' from a Contributor if it was added to the Program\n\
+by such Contributor itself or anyone acting on such Contributor's\n\
+behalf. Contributions do not include additions to the Program\n\
+which: (i) are separate modules of software distributed in conjunction\n\
+with the Program under their own license agreement, and (ii)\n\
+are not derivative works of the Program.\n\
+"Contributor" means any person or entity that distributes the\n\
+Program.\n\
+"Licensed Patents " mean patent claims licensable by a Contributor\n\
+which are necessarily infringed by the use or sale of its Contribution\n\
+alone or when combined with the Program.\n\
+"Program" means the Contributions distributed in accordance with\n\
+this Agreement.\n\
+"Recipient" means anyone who receives the Program under this\n\
+Agreement, including all Contributors.\n\
+2. GRANT OF RIGHTS\n\
+a) Subject to the terms of this Agreement, each Contributor hereby\n\
+grants Recipient a non-exclusive, worldwide, royalty-free copyright\n\
+license to reproduce, prepare derivative works of, publicly display,\n\
+publicly perform, distribute and sublicense the Contribution\n\
+of such Contributor, if any, and such derivative works, in source\n\
+code and object code form.\n\
+b) Subject to the terms of this Agreement, each Contributor hereby\n\
+grants Recipient a non-exclusive, worldwide, royalty-free patent\n\
+license under Licensed Patents to make, use, sell, offer to sell,\n\
+import and otherwise transfer the Contribution of such Contributor,\n\
+if any, in source code and object code form. This patent license\n\
+shall apply to the combination of the Contribution and the Program\n\
+if, at the time the Contribution is added by the Contributor,\n\
+such addition of the Contribution causes such combination to\n\
+be covered by the Licensed Patents. The patent license shall\n\
+not apply to any other combinations which include the Contribution.\n\
+No hardware per se is licensed hereunder.\n\
+c) Recipient understands that although each Contributor grants\n\
+the licenses to its Contributions set forth herein, no assurances\n\
+are provided by any Contributor that the Program does not infringe\n\
+the patent or other intellectual property rights of any other\n\
+entity. Each Contributor disclaims any liability to Recipient\n\
+for claims brought by any other entity based on infringement\n\
+of intellectual property rights or otherwise. As a condition\n\
+to exercising the rights and licenses granted hereunder, each\n\
+Recipient hereby assumes sole responsibility to secure any other\n\
+intellectual property rights needed, if any. For example, if\n\
+a third party patent license is required to allow Recipient to\n\
+distribute the Program, it is Recipient's responsibility to acquire\n\
+that license before distributing the Program.\n\
+d) Each Contributor represents that to its knowledge it has sufficient\n\
+copyright rights in its Contribution, if any, to grant the copyright\n\
+license set forth in this Agreement.\n\
+3. REQUIREMENTS\n\
+A Contributor may choose to distribute the Program in object\n\
+code form under its own license agreement, provided that:\n\
+a) it complies with the terms and conditions of this Agreement;\n\
+and\n\
+b) its license agreement:\n\
+i) effectively disclaims on behalf of all Contributors all warranties\n\
+and conditions, express and implied, including warranties or\n\
+conditions of title and non-infringement, and implied warranties\n\
+or conditions of merchantability and fitness for a particular\n\
+purpose;\n\
+ii) effectively excludes on behalf of all Contributors all liability\n\
+for damages, including direct, indirect, special, incidental\n\
+and consequential damages, such as lost profits;\n\
+iii) states that any provisions which differ from this Agreement\n\
+are offered by that Contributor alone and not by any other party;\n\
+and\n\
+iv) states that source code for the Program is available from\n\
+such Contributor, and informs licensees how to obtain it in a\n\
+reasonable manner on or through a medium customarily used for\n\
+software exchange.\n\
+When the Program is made available in source code form:\n\
+a) it must be made available under this Agreement; and\n\
+b) a copy of this Agreement must be included with each copy of\n\
+the Program.\n\
+Contributors may not remove or alter any copyright notices contained\n\
+within the Program.\n\
+Each Contributor must identify itself as the originator of its\n\
+Contribution, if any, in a manner that reasonably allows subsequent\n\
+Recipients to identify the originator of the Contribution.\n\
+4. COMMERCIAL DISTRIBUTION\n\
+Commercial distributors of software may accept certain responsibilities\n\
+with respect to end users, business partners and the like. While\n\
+this license is intended to facilitate the commercial use of\n\
+the Program, the Contributor who includes the Program in a commercial\n\
+product offering should do so in a manner which does not create\n\
+potential liability for other Contributors. Therefore, if a Contributor\n\
+includes the Program in a commercial product offering, such Contributor\n\
+("Commercial Contributor") hereby agrees to defend and indemnify\n\
+every other Contributor ("Indemnified Contributor") against any\n\
+losses, damages and costs (collectively "Losses") arising from\n\
+claims, lawsuits and other legal actions brought by a third party\n\
+against the Indemnified Contributor to the extent caused by the\n\
+acts or omissions of such Commercial Contributor in connection\n\
+with its distribution of the Program in a commercial product\n\
+offering. The obligations in this section do not apply to any\n\
+claims or Losses relating to any actual or alleged intellectual\n\
+property infringement. In order to qualify, an Indemnified Contributor\n\
+must: a) promptly notify the Commercial Contributor in writing\n\
+of such claim, and b) allow the Commercial Contributor to control,\n\
+and cooperate with the Commercial Contributor in, the defense\n\
+and any related settlement negotiations. The Indemnified Contributor\n\
+may participate in any such claim at its own expense.\n\
+For example, a Contributor might include the Program in a commercial\n\
+product offering, Product X. That Contributor is then a Commercial\n\
+Contributor. If that Commercial Contributor then makes performance\n\
+claims, or offers warranties related to Product X, those performance\n\
+claims and warranties are such Commercial Contributor's responsibility\n\
+alone. Under this section, the Commercial Contributor would have\n\
+to defend claims against the other Contributors related to those\n\
+performance claims and warranties, and if a court requires any\n\
+other Contributor to pay any damages as a result, the Commercial\n\
+Contributor must pay those damages.\n\
+5. NO WARRANTY\n\
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM\n\
+IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS\n\
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,\n\
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY\n\
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely\n\
+responsible for determining the appropriateness of using and\n\
+distributing the Program and assumes all risks associated with\n\
+its exercise of rights under this Agreement, including but not\n\
+limited to the risks and costs of program errors, compliance\n\
+with applicable laws, damage to or loss of data, programs or\n\
+equipment, and unavailability or interruption of operations.\n\
+6. DISCLAIMER OF LIABILITY\n\
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT\n\
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,\n\
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n\
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND\n\
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n\
+OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE\n\
+OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY\n\
+OF SUCH DAMAGES.\n\
+7. GENERAL\n\
+If any provision of this Agreement is invalid or unenforceable\n\
+under applicable law, it shall not affect the validity or enforceability\n\
+of the remainder of the terms of this Agreement, and without\n\
+further action by the parties hereto, such provision shall be\n\
+reformed to the minimum extent necessary to make such provision\n\
+valid and enforceable.\n\
+\n\
+If Recipient institutes patent litigation against a Contributor\n\
+with respect to a patent applicable to software (including a\n\
+cross-claim or counterclaim in a lawsuit), then any patent licenses\n\
+granted by that Contributor to such Recipient under this Agreement\n\
+shall terminate as of the date such litigation is filed. In addition,\n\
+if Recipient institutes patent litigation against any entity\n\
+(including a cross-claim or counterclaim in a lawsuit) alleging\n\
+that the Program itself (excluding combinations of the Program\n\
+with other software or hardware) infringes such Recipient's patent(s),\n\
+then such Recipient's rights granted under Section 2(b) shall\n\
+terminate as of the date such litigation is filed.\n\
+\n\
+All Recipient's rights under this Agreement shall terminate if\n\
+it fails to comply with any of the material terms or conditions\n\
+of this Agreement and does not cure such failure in a reasonable\n\
+period of time after becoming aware of such noncompliance. If\n\
+all Recipient's rights under this Agreement terminate, Recipient\n\
+agrees to cease use and distribution of the Program as soon as\n\
+reasonably practicable. However, Recipient's obligations under\n\
+this Agreement and any licenses granted by Recipient relating\n\
+to the Program shall continue and survive.\n\
+\n\
+Everyone is permitted to copy and distribute copies of this Agreement,\n\
+but in order to avoid inconsistency the Agreement is copyrighted\n\
+and may only be modified in the following manner. The Agreement\n\
+Steward reserves the right to publish new versions (including\n\
+revisions) of this Agreement from time to time. No one other\n\
+than the Agreement Steward has the right to modify this Agreement.\n\
+\n\
+IBM is the initial Agreement Steward. IBM may assign the responsibility\n\
+to serve as the Agreement Steward to a suitable separate entity.\n\
+\n\
+Each new version of the Agreement will be given a distinguishing\n\
+version number. The Program (including Contributions) may always\n\
+be distributed subject to the version of the Agreement under\n\
+which it was received. In addition, after a new version of the\n\
+Agreement is published, Contributor may elect to distribute the\n\
+Program (including its Contributions) under the new version.\n\
+\n\
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient\n\
+receives no rights or licenses to the intellectual property of\n\
+any Contributor under this Agreement, whether expressly, by implication,\n\
+estoppel or otherwise. All rights in the Program not expressly\n\
+granted under this Agreement are reserved.\n\
+\n\
+This Agreement is governed by the laws of the State of New York\n\
+and the intellectual property laws of the United States of America.\n\
+No party to this Agreement will bring a legal action under this\n\
+Agreement more than one year after the cause of action arose.\n\
+Each party waives its rights to a jury trial in any resulting\n\
+litigation.\n
+########### end of license property ##########################################
Modified: trunk/org.rubypeople.rdt-feature/feature.xml
===================================================================
--- trunk/org.rubypeople.rdt-feature/feature.xml 2007-07-02 17:25:57 UTC (rev 2708)
+++ trunk/org.rubypeople.rdt-feature/feature.xml 2007-07-03 18:36:20 UTC (rev 2709)
@@ -1,250 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.rubypeople.rdt"
- label="Ruby Development Tools"
+ label="%featureName"
version="0.0.0"
- provider-name="RubyPeople"
+ provider-name="%providerName"
plugin="org.rubypeople.rdt">
- <description>
- Ruby Development Tools for Eclipse.
-
-RDT is a set of plugins for Eclipse which makes the platform a Ruby-aware IDE. RDT provides a ruby debugger, code outline, syntax highlighting, ri/rdoc integration, code completion, code folding, variable occurence marking and much more.
+ <description url="%descriptionURL">
+ %description
</description>
- <copyright>
- The Ruby Development Tools (RDT) plugin for eclipse is subject
-to the Common Public License (CPL) v 1.0. All files of the RDT
-except for the external plug-ins and libraries named below are
-copyright of RubyPeople. RubyPeople is not a legal entity, but
-consists of the following people who have contributed to the
-RDT. Currently these are (in alphabetical order):
-
-Markus Barchfeld, Thomas Corbat, David Corbin, Zach Dennis,
-Lukas Felber, Mirko Stocker, Adam Williams and Chris Williams.
-
-See www.rubypeople.org for more information.
-
-The RDT feature contains the following plug-ins and libraries
-from external providers:
-RegExp plug-in, http://e-p-i-c.sourceforge.net
-JRuby, http://jruby.codehaus.org/
-kxml2, http://kxml.sourceforge.net
-The file org.rubypeople.rdt.launching/ruby/classic-debug.rb
-is based on the debug.rb file, which is part of the ruby 1.6.8
-release. Because of the nature of developing this plugin, many
-features or concepts have been copied from the JDT. Therefore
-you will find code fragements which have been copied from the
-JDT. We did not add the IBM copyright with every code fragment
-of this kind. We think that this is in accordance with the CPL
-and is not an intended removal of copyright.
+ <copyright url="%copyrightURL">
+ %copyright
</copyright>
- <license>
- Common Public License Version 1.0
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS
-COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
-DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.
-1. DEFINITIONS
-"Contribution" means:
-a) in the case of the initial Contributor, the initial code and
-documentation distributed under this Agreement, and
-b) in the case of each subsequent Contributor:
-i) changes to the Program, and
-ii) additions to the Program;
-where such changes and/or additions to the Program originate
-from and are distributed by that particular Contributor. A Contribution
-'originates' from a Contributor if it was added to the Program
-by such Contributor itself or anyone acting on such Contributor's
-behalf. Contributions do not include additions to the Program
-which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii)
-are not derivative works of the Program.
-"Contributor" means any person or entity that distributes the
-Program.
-"Licensed Patents " mean patent claims licensable by a Contributor
-which are necessarily infringed by the use or sale of its Contribution
-alone or when combined with the Program.
-"Program" means the Contributions distributed in accordance with
-this Agreement.
-"Recipient" means anyone who receives the Program under this
-Agreement, including all Contributors.
-2. GRANT OF RIGHTS
-a) Subject to the terms of this Agreement, each Contributor hereby
-grants Recipient a non-exclusive, worldwide, royalty-free copyright
-license to reproduce, prepare derivative works of, publicly display,
-publicly perform, distribute and sublicense the Contribution
-of such Contributor, if any, and such derivative works, in source
-code and object code form.
-b) Subject to the terms of this Agreement, each Contributor hereby
-grants Recipient a non-exclusive, worldwide, royalty-free patent
-license under Licensed Patents to make, use, sell, offer to sell,
-import and otherwise transfer the Contribution of such Contributor,
-if any, in source code and object code form. This patent license
-shall apply to the combination of the Contribution and the Program
-if, at the time the Contribution is added by the Contributor,
-such addition of the Contribution causes such combination to
-be covered by the Licensed Patents. The patent license shall
-not apply to any other combinations which include the Contribution.
-No hardware per se is licensed hereunder.
-c) Recipient understands that although each Contributor grants
-the licenses to its Contributions set forth herein, no assurances
-are provided by any Contributor that the Program does not infringe
-the patent or other intellectual property rights of any other
-entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement
-of intellectual property rights or otherwise. As a condition
-to exercising the rights and licenses granted hereunder, each
-Recipient hereby assumes sole responsibility to secure any other
-intellectual property rights needed, if any. For example, if
-a third party patent license is required to allow Recipient to
-distribute the Program, it is Recipient's responsibility to acquire
-that license before distributing the Program.
-d) Each Contributor represents that to its knowledge it has sufficient
-copyright rights in its Contribution, if any, to grant the copyright
-license set forth in this Agreement.
-3. REQUIREMENTS
-A Contributor may choose to distribute the Program in object
-code form under its own license agreement, provided that:
-a) it complies with the terms and conditions of this Agreement;
-and
-b) its license agreement:
-i) effectively disclaims on behalf of all Contributors all warranties
-and conditions, express and implied, including warranties or
-conditions of title and non-infringement, and implied warranties
-or conditions of merchantability and fitness for a particular
-purpose;
-ii) effectively excludes on behalf of all Contributors all liability
-for damages, including direct, indirect, special, incidental
-and consequential damages, such as lost profits;
-iii) states that any provisions which differ from this Agreement
-are offered by that Contributor alone and not by any other party;
-and
-iv) states that source code for the Program is available from
-such Contributor, and informs licensees how to obtain it in a
-reasonable manner on or through a medium customarily used for
-software exchange.
-When the Program is made available in source code form:
-a) it must be made available under this Agreement; and
-b) a copy of this Agreement must be included with each copy of
-the Program.
-Contributors may not remove or alter any copyright notices contained
-within the Program.
-Each Contributor must identify itself as the originator of its
-Contribution, if any, in a manner that reasonably allows subsequent
-Recipients to identify the originator of the Contribution.
-4. COMMERCIAL DISTRIBUTION
-Commercial distributors of software may accept certain responsibilities
-with respect to end users, business partners and the like. While
-this license is intended to facilitate the commercial use of
-the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create
-potential liability for other Contributors. Therefore, if a Contributor
-includes the Program in a commercial product offering, such Contributor
-("Commercial Contributor") hereby agrees to defend and indemnify
-every other Contributor ("Indemnified Contributor") against any
-losses, damages and costs (collectively "Losses") arising from
-claims, lawsuits and other legal actions brought by a third party
-against the Indemnified Contributor to the extent caused by the
-acts or omissions of such Commercial Contributor in connection
-with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any
-claims or Losses relating to any actual or alleged intellectual
-property infringement. In order to qualify, an Indemnified Contributor
-must: a) promptly notify the Commercial Contributor in writing
-of such claim, and b) allow the Commercial Contributor to control,
-and cooperate with the Commercial Contributor in, the defense
-and any related settlement negotiations. The Indemnified Contributor
-may participate in any such claim at its own expense.
-For example, a Contributor might include the Program in a commercial
-product offering, Product X. That Contributor is then a Commercial
-Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance
-claims and warranties are such Commercial Contributor's responsibility
-alone. Under this section, the Commercial Contributor would have
-to defend claims against the other Contributors related to those
-performance claims and warranties, and if a court requires any
-other Contributor to pay any damages as a result, the Commercial
-Contributor must pay those damages.
-5. NO WARRANTY
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM
-IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
-ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
-OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and
-distributing the Program and assumes all risks associated with
-its exercise of rights under this Agreement, including but not
-limited to the risks and costs of program errors, compliance
-with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations.
-6. DISCLAIMER OF LIABILITY
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
-NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE
-OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGES.
-7. GENERAL
-If any provision of this Agreement is invalid or unenforceable
-under applicable law, it shall not affect the validity or enforceability
-of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be
-reformed to the minimum extent necessary to make such provision
-valid and enforceable.
-If Recipient institutes patent litigation against a Contributor
-with respect to a patent applicable to software (including a
-cross-claim or counterclaim in a lawsuit), then any patent licenses
-granted by that Contributor to such Recipient under this Agreement
-shall terminate as of the date such litigation is filed. In addition,
-if Recipient institutes patent litigation against any entity
-(including a cross-claim or counterclaim in a lawsuit) alleging
-that the Program itself (excluding combinations of the Program
-with other software or hardware) infringes such Recipient's patent(s),
-then such Recipient's rights granted under Section 2(b) shall
-terminate as of the date such litigation is filed.
-All Recipient's rights under this Agreement shall terminate if
-it fails to comply with any of the material terms or conditions
-of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If
-all Recipient's rights under this Agreement terminate, Recipient
-agrees to cease use and distribution of the Program as soon as
-reasonably practicable. However, Recipient's obligations under
-this Agreement and any licenses granted by Recipient relating
-to the Program shall continue and survive.
-Everyone is permitted to copy and distribute copies of this Agreement,
-but in order to avoid inconsistency the Agreement is copyrighted
-and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including
-revisions) of this Agreement from time to time. No one other
-than the Agreement Steward has the right to modify this Agreement.
-IBM is the initial Agreement Steward. IBM may assign the responsibility
-to serve as the Agreement Steward to a suitable separate entity.
-Each new version of the Agreement will be given a distinguishing
-version number. The Program (including Contributions) may always
-be distributed subject to the version of the Agreement under
-which it was received. In addition, after a new version of the
-Agreement is published, Contributor may elect to distribute the
-Program (including its Contributions) under the new version.
-Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
-receives no rights or licenses to the intellectual property of
-any Contributor under this Agreement, whether expressly, by implication,
-estoppel or otherwise. All rights in the Program not expressly
-granted under this Agreement are reserved.
-This Agreement is governed by the laws of the State of New York
-and the intellectual property laws of the United States of America.
-No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose.
-Each party waives its rights to a jury trial in any resulting
-litigation.
+ <license url="%licenseURL">
+ %license
</license>
<url>
- <update label="rubyeclipse" url="http://rubyeclipse.sourceforge.net/updatesite"/>
+ <update label="%updateSiteName" url="http://rubyeclipse.sourceforge.net/updatesite"/>
</url>
<requires>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-02 17:26:06
|
Revision: 2708
http://svn.sourceforge.net/rubyeclipse/?rev=2708&view=rev
Author: cawilliams
Date: 2007-07-02 10:25:57 -0700 (Mon, 02 Jul 2007)
Log Message:
-----------
avoid some exceptions
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java 2007-07-01 16:05:37 UTC (rev 2707)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java 2007-07-02 17:25:57 UTC (rev 2708)
@@ -93,6 +93,7 @@
RubyPlugin.log(e);
continue;
}
+ if (position == null) continue;
int startPosition= position.getStartOffset();
if (startPosition < 0) continue;
int length= position.getEndOffset() - position.getStartOffset();
@@ -217,6 +218,7 @@
for (Node node : fUsages) {
try {
ISourcePosition occurrence = getPositionOfName(node);
+ if (occurrence == null) continue;
Position position = new Position(occurrence.getStartOffset(), occurrence.getEndOffset() - occurrence.getStartOffset());
positions.add(position);
} catch (RuntimeException re) {
@@ -674,13 +676,21 @@
name = ASTUtil.getNameReflectively(node);
} else if (node instanceof ClassNode) {
name = getClassNodeName((ClassNode) node);
- String classDeclString = source.substring(pos.getStartOffset(), pos.getEndOffset());
- int begin = pos.getStartOffset() + classDeclString.indexOf(name);
+ int end = pos.getEndOffset();
+ if (source.length() < end) end = source.length();
+ String classDeclString = source.substring(pos.getStartOffset(), end);
+ int nameEnd = classDeclString.indexOf(name);
+ if (nameEnd == -1) return null;
+ int begin = pos.getStartOffset() + nameEnd;
return new SourcePosition(pos.getFile(), pos.getStartLine(), pos.getEndLine(), begin, begin + name.length());
} else if (node instanceof ModuleNode) {
name = getModuleNodeName((ModuleNode) node);
- String moduleDeclString = source.substring(pos.getStartOffset(), pos.getEndOffset());
- int begin = moduleDeclString.indexOf(name);
+ int end = pos.getEndOffset();
+ if (source.length() < end) end = source.length();
+ String classDeclString = source.substring(pos.getStartOffset(), end);
+ int nameEnd = classDeclString.indexOf(name);
+ if (nameEnd == -1) return null;
+ int begin = pos.getStartOffset() + nameEnd;
return new SourcePosition(pos.getFile(), pos.getStartLine(), pos.getEndLine(), begin, begin + name.length());
} else if (node instanceof SymbolNode) {
// XXX: This is a hack to get around improper offsets in my JRuby
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-01 16:05:39
|
Revision: 2707
http://svn.sourceforge.net/rubyeclipse/?rev=2707&view=rev
Author: cawilliams
Date: 2007-07-01 09:05:37 -0700 (Sun, 01 Jul 2007)
Log Message:
-----------
add in a hacky fix to avoid adding gems to our command line loadpath (they're added in dynamically in ruby. We only keep track of them as loadpaths for our own usage in modelling the code and dependencies, so we shouldn't be throwing them on the loadpath on the command line)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java 2007-06-30 16:59:50 UTC (rev 2706)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java 2007-07-01 16:05:37 UTC (rev 2707)
@@ -365,15 +365,30 @@
}
break;
case PROJECT:
- case ARCHIVE:
setLoadpathProperty(USER_CLASSES);
break;
+ case ARCHIVE:
+ if (isGem()) { // FIXME This is a huge hack. We should integrate the idea of gems into our loadpath infrastructure much more!
+ setLoadpathProperty(STANDARD_CLASSES);
+ } else {
+ setLoadpathProperty(USER_CLASSES);
+ }
+ break;
default:
break;
}
}
+ private boolean isGem() {
+ String[] segments = fLoadpathEntry.getPath().segments();
+ if (segments == null) return false;
+ for (int i = 0; i < segments.length; i++) {
+ if (segments[i].equals("gems")) return true;
+ }
+ return false;
+ }
+
/**
* @see IRuntimeLoadpathEntry#setLoadpathProperty(int)
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-30 16:59:54
|
Revision: 2706
http://svn.sourceforge.net/rubyeclipse/?rev=2706&view=rev
Author: cawilliams
Date: 2007-06-30 09:59:50 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
add all plugins' download and install sizes
Modified Paths:
--------------
trunk/org.rubypeople.rdt-feature/feature.xml
Modified: trunk/org.rubypeople.rdt-feature/feature.xml
===================================================================
--- trunk/org.rubypeople.rdt-feature/feature.xml 2007-06-30 15:59:56 UTC (rev 2705)
+++ trunk/org.rubypeople.rdt-feature/feature.xml 2007-06-30 16:59:50 UTC (rev 2706)
@@ -278,84 +278,84 @@
<plugin
id="org.kxml2"
- download-size="0"
- install-size="0"
+ download-size="29"
+ install-size="32"
version="2.1.4"/>
<plugin
id="org.rubypeople.rdt.doc.user"
download-size="341"
- install-size="0"
+ install-size="341"
version="0.0.0"
unpack="false"/>
<plugin
id="org.epic.regexp"
- download-size="0"
- install-size="0"
+ download-size="43"
+ install-size="51"
version="0.1.4"/>
<plugin
id="org.rubypeople.rdt.ui"
download-size="1369"
- install-size="0"
+ install-size="1646"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt"
- download-size="0"
- install-size="0"
+ download-size="25"
+ install-size="25"
version="0.0.0"
unpack="false"/>
<plugin
id="org.rubypeople.rdt.testunit"
download-size="124"
- install-size="0"
+ install-size="151"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.launching"
download-size="88"
- install-size="0"
+ install-size="123"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.debug.ui"
download-size="104"
- install-size="0"
+ install-size="132"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.debug.core"
download-size="45"
- install-size="0"
+ install-size="56"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.core"
download-size="544"
- install-size="0"
+ install-size="706"
version="0.0.0"/>
<plugin
id="org.jruby"
download-size="2359"
- install-size="0"
+ install-size="2359"
version="1.0.0.3788"
unpack="false"/>
<plugin
id="org.rubypeople.rdt.refactoring"
download-size="427"
- install-size="0"
+ install-size="427"
version="0.0.0"
unpack="false"/>
<plugin
id="com.aptana.rdt"
download-size="88"
- install-size="0"
+ install-size="88"
version="0.0.0"
unpack="false"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-30 16:00:00
|
Revision: 2705
http://svn.sourceforge.net/rubyeclipse/?rev=2705&view=rev
Author: cawilliams
Date: 2007-06-30 08:59:56 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
put in some of the filesizes for the plugins
Modified Paths:
--------------
trunk/org.rubypeople.rdt-feature/feature.xml
Modified: trunk/org.rubypeople.rdt-feature/feature.xml
===================================================================
--- trunk/org.rubypeople.rdt-feature/feature.xml 2007-06-29 17:19:36 UTC (rev 2704)
+++ trunk/org.rubypeople.rdt-feature/feature.xml 2007-06-30 15:59:56 UTC (rev 2705)
@@ -284,7 +284,7 @@
<plugin
id="org.rubypeople.rdt.doc.user"
- download-size="0"
+ download-size="341"
install-size="0"
version="0.0.0"
unpack="false"/>
@@ -297,7 +297,7 @@
<plugin
id="org.rubypeople.rdt.ui"
- download-size="0"
+ download-size="1369"
install-size="0"
version="0.0.0"/>
@@ -310,51 +310,51 @@
<plugin
id="org.rubypeople.rdt.testunit"
- download-size="0"
+ download-size="124"
install-size="0"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.launching"
- download-size="0"
+ download-size="88"
install-size="0"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.debug.ui"
- download-size="0"
+ download-size="104"
install-size="0"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.debug.core"
- download-size="0"
+ download-size="45"
install-size="0"
version="0.0.0"/>
<plugin
id="org.rubypeople.rdt.core"
- download-size="0"
+ download-size="544"
install-size="0"
version="0.0.0"/>
<plugin
id="org.jruby"
- download-size="0"
+ download-size="2359"
install-size="0"
version="1.0.0.3788"
unpack="false"/>
<plugin
id="org.rubypeople.rdt.refactoring"
- download-size="0"
+ download-size="427"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.aptana.rdt"
- download-size="0"
+ download-size="88"
install-size="0"
version="0.0.0"
unpack="false"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-29 17:19:39
|
Revision: 2704
http://svn.sourceforge.net/rubyeclipse/?rev=2704&view=rev
Author: cawilliams
Date: 2007-06-29 10:19:36 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
wrap possible runtime exceptions, log them and keep on trucking
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java 2007-06-29 17:00:10 UTC (rev 2703)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/OccurrencesFinder.java 2007-06-29 17:19:36 UTC (rev 2704)
@@ -47,6 +47,7 @@
import org.rubypeople.rdt.internal.ti.util.INodeAcceptor;
import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator;
import org.rubypeople.rdt.internal.ti.util.ScopedNodeLocator;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
/**
* Implements "Mark Occurences" feature
@@ -85,8 +86,15 @@
for (Iterator iter= fUsages.iterator(); iter.hasNext();) {
Node node= (Node) iter.next();
- ISourcePosition position = getPositionOfName(node);
+ ISourcePosition position;
+ try {
+ position = getPositionOfName(node);
+ } catch (RuntimeException e) {
+ RubyPlugin.log(e);
+ continue;
+ }
int startPosition= position.getStartOffset();
+ if (startPosition < 0) continue;
int length= position.getEndOffset() - position.getStartOffset();
try {
boolean isWriteAccess= fWriteUsages.contains(node);
@@ -207,9 +215,13 @@
// Convert ISourcePosition to IPosition
List<Position> positions = new LinkedList<Position>();
for (Node node : fUsages) {
- ISourcePosition occurrence = getPositionOfName(node);
- Position position = new Position(occurrence.getStartOffset(), occurrence.getEndOffset() - occurrence.getStartOffset());
- positions.add(position);
+ try {
+ ISourcePosition occurrence = getPositionOfName(node);
+ Position position = new Position(occurrence.getStartOffset(), occurrence.getEndOffset() - occurrence.getStartOffset());
+ positions.add(position);
+ } catch (RuntimeException re) {
+ RubyPlugin.log(re);
+ }
}
// Uniqueify positions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-29 17:00:12
|
Revision: 2703
http://svn.sourceforge.net/rubyeclipse/?rev=2703&view=rev
Author: cawilliams
Date: 2007-06-29 10:00:10 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
remove unsued import
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-29 16:29:48 UTC (rev 2702)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-29 17:00:10 UTC (rev 2703)
@@ -8,7 +8,6 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.rules.Token;
import org.eclipse.ui.texteditor.ITextEditor;
import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.rdt.core.IMethod;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-29 16:29:50
|
Revision: 2702
http://svn.sourceforge.net/rubyeclipse/?rev=2702&view=rev
Author: cawilliams
Date: 2007-06-29 09:29:48 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-29 16:05:43 UTC (rev 2701)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-29 16:29:48 UTC (rev 2702)
@@ -8,12 +8,15 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.rules.Token;
import org.eclipse.ui.texteditor.ITextEditor;
+import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.corext.util.CodeFormatterUtil;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.rubyeditor.WorkingCopyManager;
@@ -76,6 +79,14 @@
try {
int p = (offset == d.getLength() ? offset - 1 : offset);
+ try {
+ new RubyParser().parse(d.get());
+ return;
+ } catch(SyntaxException se) {
+ if (!se.getMessage().equals("embedded document meets end of file")) {
+ return;
+ }
+ }
int lineNumber = d.getLineOfOffset(p);
IRegion line = d.getLineInformation(lineNumber);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-29 16:05:45
|
Revision: 2701
http://svn.sourceforge.net/rubyeclipse/?rev=2701&view=rev
Author: cawilliams
Date: 2007-06-29 09:05:43 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
include some code to keep track of types visited when we're recursing through type hierarchies. If we've already visited the type, we skip out. This should help avoid StackOverflows.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-06-27 19:21:32 UTC (rev 2700)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-06-29 16:05:43 UTC (rev 2701)
@@ -75,6 +75,7 @@
private CompletionRequestor fRequestor;
private CompletionContext fContext;
+ private Set<IType> fVisitedTypes;
public CompletionEngine(CompletionRequestor requestor) {
this.fRequestor = requestor;
@@ -152,7 +153,7 @@
}
IType[] types = requestor.findType(name);
for (int i = 0; i < types.length; i++) {
- Map<String, CompletionProposal> map = suggestMethods(guess.getConfidence(), types[i], true);
+ Map<String, CompletionProposal> map = doSuggestMethods(guess.getConfidence(), types[i], true);
list.addAll(map.values());
}
}
@@ -262,6 +263,22 @@
fRequestor.accept(proposal);
}
}
+
+ /**
+ * Wrap beginning of recursion to suggest methods for a type. We keep track of types visited so that we can avoid inifnite loops.
+ *
+ * @param confidence
+ * @param type
+ * @param includeInstanceMethods
+ * @return
+ * @throws RubyModelException
+ */
+ private Map<String, CompletionProposal> suggestMethods(int confidence, IType type, boolean includeInstanceMethods) throws RubyModelException {
+ if (fVisitedTypes == null) fVisitedTypes = new HashSet<IType>();
+ Map<String, CompletionProposal> list = doSuggestMethods(100, type, true);
+ fVisitedTypes.clear();
+ return list;
+ }
private List<CompletionProposal> sort(Map<String, CompletionProposal> proposals) {
List<CompletionProposal> list = new ArrayList<CompletionProposal>(proposals.values());
@@ -333,10 +350,12 @@
}
}
- private Map<String, CompletionProposal> suggestMethods(int confidence, IType type, boolean includeInstanceMethods) throws RubyModelException {
+ private Map<String, CompletionProposal> doSuggestMethods(int confidence, IType type, boolean includeInstanceMethods) throws RubyModelException {
Map<String, CompletionProposal> proposals = new HashMap<String, CompletionProposal>();
if (type == null)
return proposals;
+ if (fVisitedTypes.contains(type)) return proposals;
+ fVisitedTypes.add(type);
IMethod[] methods = type.getMethods();
for (int k = 0; k < methods.length; k++) {
if (!includeInstanceMethods && !methods[k].isSingleton()) {
@@ -367,7 +386,7 @@
for (int j = 0; j < moduleTypes.length; j++) {
try {
IType moduleType = moduleTypes[j];
- proposals.putAll(suggestMethods(confidence, moduleType, true));
+ proposals.putAll(doSuggestMethods(confidence, moduleType, true));
} catch (RubyModelException e) {
// ignore
}
@@ -384,7 +403,7 @@
IType[] supers = requestor.findType(superClass);
for (int i = 0; i < supers.length; i++) {
IType superType = supers[i];
- proposals.putAll(suggestMethods(confidence, superType, includeInstanceMethods));
+ proposals.putAll(doSuggestMethods(confidence, superType, includeInstanceMethods));
}
return proposals;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2007-06-27 19:21:32 UTC (rev 2700)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2007-06-29 16:05:43 UTC (rev 2701)
@@ -59,8 +59,12 @@
import org.rubypeople.rdt.internal.ti.util.INodeAcceptor;
import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator;
+import com.sun.corba.se.impl.io.FVDCodeBaseImpl;
+
public class SelectionEngine {
+ private HashSet<IType> fVisitedTypes;
+
public IRubyElement[] select(IRubyScript script, int start, int end)
throws RubyModelException {
String source = script.getSource();
@@ -145,7 +149,9 @@
IType[] types = getReceiver(script, source, selected, root, start);
for (int i = 0; i < types.length; i++) {
IType type = types[i];
+ if (fVisitedTypes == null) { fVisitedTypes = new HashSet<IType>(); } // keep track of types so we don't get into infinite loop
Collection<IMethod> methods = suggestMethods(type);
+ fVisitedTypes.clear();
for (IMethod method : methods) {
if (method.getElementName().equals(methodName))
possible.add(method);
@@ -231,12 +237,14 @@
private Collection<IMethod> suggestMethods(IType type) throws RubyModelException {
List<IMethod> proposals = new ArrayList<IMethod>();
if (type == null) return proposals;
+ if (fVisitedTypes.contains(type)) return proposals;
+ fVisitedTypes.add(type);
IMethod[] methods = type.getMethods();
for (int k = 0; k < methods.length; k++) {
proposals.add(methods[k]);
}
proposals.addAll(addModuleMethods(type)); // Decrement confidence by one as a hack to make sure as we move up the inheritance chain we suggest "closer" parents methods first
- if (!type.isModule()) proposals.addAll(addSuperClassMethods(type));
+ if (!type.isModule()) proposals.addAll(addSuperClassMethods(type));
return proposals;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-27 19:21:34
|
Revision: 2700
http://svn.sourceforge.net/rubyeclipse/?rev=2700&view=rev
Author: cawilliams
Date: 2007-06-27 12:21:32 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
remove unused method
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-06-27 19:00:54 UTC (rev 2699)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-06-27 19:21:32 UTC (rev 2700)
@@ -523,28 +523,6 @@
}
}
- private void addLocalVariablesAndArguments(Node enclosingMethodNode) {
- // Add local vars and arguments
- if (enclosingMethodNode != null && enclosingMethodNode instanceof MethodDefNode) {
- Set<String> matches = new HashSet<String>();
- StaticScope scope = ((MethodDefNode) enclosingMethodNode).getScope();
- if (scope != null && scope.getVariables().length > 0) {
- List locals = Arrays.asList(scope.getVariables());
- for (Iterator iter = locals.iterator(); iter.hasNext();) {
- String local = (String) iter.next();
- if (!fContext.prefixStartsWith(local))
- continue;
- matches.add(local);
- }
- }
- for (String local : matches) { // Avoid duplicates
- CompletionProposal proposal = new CompletionProposal(CompletionProposal.LOCAL_VARIABLE_REF, local, 100);
- proposal.setReplaceRange(fContext.getReplaceStart(), fContext.getReplaceStart() + local.length());
- fRequestor.accept(proposal);
- }
- }
- }
-
/**
* Gets the members available inside a type node (ModuleNode, ClassNode): -
* Instance variables - Class variables - Methods
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-27 19:00:55
|
Revision: 2699
http://svn.sourceforge.net/rubyeclipse/?rev=2699&view=rev
Author: cawilliams
Date: 2007-06-27 12:00:54 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
close #4984 - Automatically close =begin with =end
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-27 18:35:23 UTC (rev 2698)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-27 19:00:54 UTC (rev 2699)
@@ -11,10 +11,13 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.corext.util.CodeFormatterUtil;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.rubyeditor.WorkingCopyManager;
+import org.rubypeople.rdt.internal.ui.text.IRubyPartitions;
public class RubyCommentAutoIndentStrategy extends
DefaultIndentLineAutoEditStrategy {
@@ -22,11 +25,13 @@
private String fPartitioning;
private ITextEditor fEditor;
private WorkingCopyManager fManager;
+ private IRubyProject fProject;
- public RubyCommentAutoIndentStrategy(ITextEditor textEditor, String partitioning) {
+ public RubyCommentAutoIndentStrategy(ITextEditor textEditor, String partitioning, IRubyProject project) {
fPartitioning = partitioning;
fEditor = textEditor;
fManager = RubyPlugin.getDefault().getWorkingCopyManager();
+ fProject = project;
}
public void customizeDocumentCommand(IDocument document,
@@ -56,7 +61,15 @@
* the command to deal with
*/
private void indentAfterNewLine(IDocument d, DocumentCommand c) {
+ if (fPartitioning.equals(IRubyPartitions.RUBY_SINGLE_LINE_COMMENT)) {
+ doSingleLineComment(d, c);
+ } else {
+ doMultiLineComment(d, c);
+ }
+ }
+ private void doMultiLineComment(IDocument d, DocumentCommand c) {
+
int offset = c.offset;
if (offset == -1 || d.getLength() == 0)
return;
@@ -66,6 +79,34 @@
int lineNumber = d.getLineOfOffset(p);
IRegion line = d.getLineInformation(lineNumber);
+ String aLine = getLine(d, lineNumber - 1);
+ StringBuffer buf = new StringBuffer(c.text);
+ if (aLine.trim().equals("=begin")) {
+ // add =end
+ buf.append(CodeFormatterUtil.createIndentString(1, fProject));
+ c.caretOffset= c.offset + buf.length();
+ c.shiftsCaret= false;
+ buf.append(TextUtilities.getDefaultLineDelimiter(d));
+ buf.append("=end");
+ }
+
+ c.text = buf.toString();
+
+ } catch (BadLocationException excp) {
+ // stop work
+ }
+ }
+
+ private void doSingleLineComment(IDocument d, DocumentCommand c) {
+ int offset = c.offset;
+ if (offset == -1 || d.getLength() == 0)
+ return;
+
+ try {
+ int p = (offset == d.getLength() ? offset - 1 : offset);
+
+ int lineNumber = d.getLineOfOffset(p);
+ IRegion line = d.getLineInformation(lineNumber);
if (lineNumber != 0) { // If first line, extend the comment
String nextLine = getLine(d, lineNumber + 1); // otherwise check next line
if (!(isComment(nextLine) || isClassDefinition(nextLine)
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java 2007-06-27 18:35:23 UTC (rev 2698)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java 2007-06-27 19:00:54 UTC (rev 2699)
@@ -325,8 +325,8 @@
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
String partitioning = getConfiguredDocumentPartitioning(sourceViewer);
- if (IRubyPartitions.RUBY_SINGLE_LINE_COMMENT.equals(contentType)) {
- return new IAutoEditStrategy[] { new RubyCommentAutoIndentStrategy(fTextEditor, partitioning) };
+ if (IRubyPartitions.RUBY_SINGLE_LINE_COMMENT.equals(contentType) || IRubyPartitions.RUBY_MULTI_LINE_COMMENT.equals(contentType)) {
+ return new IAutoEditStrategy[] { new RubyCommentAutoIndentStrategy(fTextEditor, partitioning, getProject()) };
} else if (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)) {
return new IAutoEditStrategy[] { new RubyAutoIndentStrategy(partitioning, getProject()) };
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-27 18:36:23
|
Revision: 2696
http://svn.sourceforge.net/rubyeclipse/?rev=2696&view=rev
Author: cawilliams
Date: 2007-06-27 10:56:56 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
fix #4341 - After upgrading RDT, old Test::Unit launches are broken.
We copy over RemoteTestRunner.rb to the state location folder now (unless it already exists) and that path should remian stable across installs of the plguins (and should only change when the user changes their workspace, which means that launch configs won't stay either)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchConfigurationDelegate.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchConfigurationDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchConfigurationDelegate.java 2007-06-27 17:38:07 UTC (rev 2695)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchConfigurationDelegate.java 2007-06-27 17:56:56 UTC (rev 2696)
@@ -1,10 +1,17 @@
package org.rubypeople.rdt.testunit.launcher;
-import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.net.URL;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -111,14 +118,51 @@
return display;
}
+ private static URL getOriginalTestRunner() {
+ IPath path = new Path("ruby").append(TestUnitLaunchShortcut.TEST_RUNNER_FILE);
+ URL url = FileLocator.find(TestunitPlugin.getDefault().getBundle(), path, null);
+ if (url == null)
+ throw new RuntimeException("Expected directory of RemoteTestRunner.rb does not exist: " + path);
+ return url;
+ }
+
public static String getTestRunnerPath() {
- String directory = RubyCore.getOSDirectory(TestunitPlugin.getDefault());
- File pluginDirFile = new File(directory, "ruby");
+ IPath path = TestunitPlugin.getDefault().getStateLocation().append(TestUnitLaunchShortcut.TEST_RUNNER_FILE);
- if (!pluginDirFile.exists())
- throw new RuntimeException("Expected directory of RemoteTestRunner.rb does not exist: " + pluginDirFile.getAbsolutePath());
+ if (!path.toFile().exists()) {
+ // copy original over
+ Writer writer = null;
+ InputStream stream = null;
+ try {
+ URL url = getOriginalTestRunner();
+ stream = url.openStream();
+ path.toFile().createNewFile();
+ writer = new FileWriter(path.toFile());
+ int b = 0; // FIXME Copy over on byte buffers rather than per byte to speed this up
+ while((b = stream.read()) != -1) {
+ writer.write(b);
+ }
+ } catch (IOException e) {
+ // ignore
+ e.printStackTrace();
+ } finally {
+ try {
+ if (stream != null) stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ try {
+ if (writer != null) writer.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ if (!path.toFile().exists())
+ throw new RuntimeException("Expected directory of RemoteTestRunner.rb does not exist: " + path);
- return pluginDirFile.getAbsolutePath() + File.separator + TestUnitLaunchShortcut.TEST_RUNNER_FILE;
+ return path.toPortableString();
}
private int getPort() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|