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
|
Revision: 2372
http://svn.sourceforge.net/rubyeclipse/?rev=2372&view=rev
Author: tcorbat
Date: 2007-04-26 04:23:58 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Same problem fixed as in NodeProvider.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/formatsource/PreviewGeneratorImpl.java
Modified: 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/formatsource/PreviewGeneratorImpl.java 2007-04-26 11:22:23 UTC (rev 2371)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/formatsource/PreviewGeneratorImpl.java 2007-04-26 11:23:58 UTC (rev 2372)
@@ -41,7 +41,7 @@
import org.jruby.parser.DefaultRubyParser;
import org.jruby.parser.RubyParserConfiguration;
import org.jruby.parser.RubyParserPool;
-import org.jruby.parser.postprocessor.DefaultCommentPlacer;
+//import org.jruby.parser.postprocessor.DefaultCommentPlacer;
public class PreviewGeneratorImpl implements PreviewGenerator {
@@ -61,7 +61,7 @@
LexerSource lexerSource = new LexerSource("", new StringReader(source)); //$NON-NLS-1$
ReWriteVisitor visitor = factory.createReWriteVisitor();
RubyParserConfiguration parserConfig = new RubyParserConfiguration();
- parserConfig.addPostProcessor(new DefaultCommentPlacer());
+// parserConfig.addPostProcessor(new DefaultCommentPlacer());
parser.parse(parserConfig, lexerSource).getAST().accept(visitor);
visitor.flushStream();
RubyParserPool.getInstance().returnParser(parser);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tc...@us...> - 2007-04-26 11:22:29
|
Revision: 2371
http://svn.sourceforge.net/rubyeclipse/?rev=2371&view=rev
Author: tcorbat
Date: 2007-04-26 04:22:23 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Comment handling not yet supportet by JRuby, uncommented the responsible parts.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java 2007-04-26 11:07:41 UTC (rev 2370)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java 2007-04-26 11:22:23 UTC (rev 2371)
@@ -67,7 +67,7 @@
import org.jruby.parser.RubyParserConfiguration;
import org.jruby.parser.RubyParserPool;
import org.jruby.parser.RubyParserResult;
-import org.jruby.parser.postprocessor.DefaultCommentPlacer;
+//import org.jruby.parser.postprocessor.DefaultCommentPlacer;
import org.rubypeople.rdt.refactoring.nodewrapper.AttrAccessorNodeWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.FieldNodeWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.MethodCallNodeWrapper;
@@ -106,7 +106,7 @@
parser.setWarnings(new NullWarnings());
LexerSource lexerSource = new LexerSource(fileName, reader);
RubyParserConfiguration parserConfig = new RubyParserConfiguration();
- parserConfig.addPostProcessor(new DefaultCommentPlacer());
+// parserConfig.addPostProcessor(new DefaultCommentPlacer());
RubyParserResult result = parser.parse(parserConfig, lexerSource);
return (RootNode) result.getAST();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tc...@us...> - 2007-04-26 11:07:52
|
Revision: 2370
http://svn.sourceforge.net/rubyeclipse/?rev=2370&view=rev
Author: tcorbat
Date: 2007-04-26 04:07:41 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Extract Method and Move Method are dealing with comments now (when they are placed in the AST)
Modified Paths:
--------------
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/SelectionNodeProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractMethodRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractedMethodCall.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/movemethod/DelegateMethodEditProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/InsertMethodEditProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ExtractMethodPage.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeFactory.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeFactory.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -296,7 +296,27 @@
}
public static ISourcePosition unionPositions(ISourcePosition first, ISourcePosition second) {
- return parserSupport.union(first, second);
+ String fileName = first.getFile();
+ int startOffset = first.getStartOffset();
+ int endOffset = first.getEndOffset();
+ int startLine = first.getStartLine();
+ int endLine = first.getEndLine();
+
+
+ if(startOffset > second.getStartOffset()){
+ startOffset = second.getStartOffset();
+ startLine = second.getStartLine();
+ }
+
+ if(endOffset < second.getEndOffset()){
+ endOffset = second.getEndOffset();
+ endLine = second.getEndLine();
+ }
+
+
+ ISourcePosition commentIncludingPos = new SourcePosition(fileName, startLine, endLine, startOffset, endOffset);
+
+ return commentIncludingPos;
}
public static Node createGetterSetter(String attrName, boolean isWriterMethod, VisibilityNodeWrapper.METHOD_VISIBILITY visibility) {
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/NodeProvider.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -67,6 +67,7 @@
import org.jruby.parser.RubyParserConfiguration;
import org.jruby.parser.RubyParserPool;
import org.jruby.parser.RubyParserResult;
+import org.jruby.parser.postprocessor.DefaultCommentPlacer;
import org.rubypeople.rdt.refactoring.nodewrapper.AttrAccessorNodeWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.FieldNodeWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.MethodCallNodeWrapper;
@@ -104,7 +105,9 @@
parser = RubyParserPool.getInstance().borrowParser();
parser.setWarnings(new NullWarnings());
LexerSource lexerSource = new LexerSource(fileName, reader);
- RubyParserResult result = parser.parse(new RubyParserConfiguration(), lexerSource);
+ RubyParserConfiguration parserConfig = new RubyParserConfiguration();
+ parserConfig.addPostProcessor(new DefaultCommentPlacer());
+ RubyParserResult result = parser.parse(parserConfig, lexerSource);
return (RootNode) result.getAST();
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/SelectionNodeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/SelectionNodeProvider.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/SelectionNodeProvider.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -228,7 +228,7 @@
}
public static boolean nodeContainsPosition(Node n, int position) {
- return (position + CURSOR_TOLERANCE >= n.getPosition().getStartOffset() && position - CURSOR_TOLERANCE < n.getPosition().getEndOffset());
+ return (position + CURSOR_TOLERANCE >= NodeUtil.subPositionUnion(n).getStartOffset() && position - CURSOR_TOLERANCE < NodeUtil.subPositionUnion(n).getEndOffset());
}
public static String[] localNamesFromLocalAsgnNodes(Collection<LocalAsgnNode> nodes) {
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractMethodRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractMethodRefactoring.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractMethodRefactoring.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -39,12 +39,9 @@
public static final String NAME = Messages.ExtractMethodRefactoring_Name;
-// private SelectionInformation selectionInformation;
-
public ExtractMethodRefactoring(TextSelectionProvider selectionProvider) {
super(NAME);
-// initPositions((ITextSelection) getEditor().getSelectionProvider().getSelection());
ExtractMethodConfig config = new ExtractMethodConfig(getDocumentProvider(), selectionProvider.getSelectionInformation());
ExtractMethodConditionChecker checker = new ExtractMethodConditionChecker(config);
@@ -56,13 +53,4 @@
pages.add(page);
}
}
-
-// private void initPositions(ITextSelection selection) {
-// int startOffset = selection.getOffset();
-// int endOffset = startOffset + selection.getLength();
-// if (endOffset > startOffset) {
-// endOffset--;
-// }
-// selectionInformation = new SelectionInformation(startOffset, endOffset, getEditor().getViewer().getDocument().get());
-// }
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractedMethodCall.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractedMethodCall.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractedMethodCall.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -63,11 +63,11 @@
}
private int getStartOffset() {
- return extractedMethodHelper.getSelectedNodes().getPosition().getStartOffset();
+ return getExtendedPosition(extractedMethodHelper.getSelectedNodes()).getStartOffset();
}
private int getEndOffset() {
- return extractedMethodHelper.getSelectedNodes().getPosition().getEndOffset();
+ return getExtendedPosition(extractedMethodHelper.getSelectedNodes()).getEndOffset();
}
@Override
Modified: 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/formatsource/PreviewGeneratorImpl.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/formatsource/PreviewGeneratorImpl.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -41,6 +41,7 @@
import org.jruby.parser.DefaultRubyParser;
import org.jruby.parser.RubyParserConfiguration;
import org.jruby.parser.RubyParserPool;
+import org.jruby.parser.postprocessor.DefaultCommentPlacer;
public class PreviewGeneratorImpl implements PreviewGenerator {
@@ -59,7 +60,9 @@
LexerSource lexerSource = new LexerSource("", new StringReader(source)); //$NON-NLS-1$
ReWriteVisitor visitor = factory.createReWriteVisitor();
- parser.parse(new RubyParserConfiguration(), lexerSource).getAST().accept(visitor);
+ RubyParserConfiguration parserConfig = new RubyParserConfiguration();
+ parserConfig.addPostProcessor(new DefaultCommentPlacer());
+ parser.parse(parserConfig, lexerSource).getAST().accept(visitor);
visitor.flushStream();
RubyParserPool.getInstance().returnParser(parser);
return writer.getBuffer().toString();
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/DelegateMethodEditProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/DelegateMethodEditProvider.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/DelegateMethodEditProvider.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -32,7 +32,6 @@
import org.jruby.ast.ArrayNode;
import org.jruby.ast.Node;
-import org.jruby.lexer.yacc.ISourcePosition;
import org.rubypeople.rdt.refactoring.core.NodeFactory;
import org.rubypeople.rdt.refactoring.core.NodeProvider;
import org.rubypeople.rdt.refactoring.editprovider.ReplaceEditProvider;
@@ -42,19 +41,19 @@
public class DelegateMethodEditProvider extends ReplaceEditProvider {
private MoveMethodConfig config;
- private ISourcePosition scopePos;
+ private Node scopePos;
private MethodNodeWrapper oldMethod;
public DelegateMethodEditProvider(MoveMethodConfig config) {
super(false);
this.config = config;
oldMethod = config.getMethodNode();
- scopePos = NodeProvider.unwrap(oldMethod.getBodyNode()).getPosition();
+ scopePos = NodeProvider.unwrap(oldMethod.getBodyNode());
}
@Override
protected int getOffsetLength() {
- return scopePos.getEndOffset() - scopePos.getStartOffset();
+ return getExtendedPosition(scopePos).getEndOffset() - getExtendedPosition(scopePos).getStartOffset();
}
@Override
@@ -83,7 +82,7 @@
@Override
protected int getOffset(String document) {
- return scopePos.getStartOffset();
+ return getExtendedPosition(scopePos).getStartOffset();
}
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/InsertMethodEditProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/InsertMethodEditProvider.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/movemethod/InsertMethodEditProvider.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -102,12 +102,19 @@
}
private MethodDefNode createMethodNodeWithAdditionalArg(MethodDefNode methodNode) {
+ MethodDefNode resultMethod;
ArgsNodeWrapper args = config.getMovedMethodArgs();
if (config.getMethodNode().isClassMethod()) {
String destClassName = config.getDestinationClassNode().getName();
- return NodeFactory.createStaticMethodNode(destClassName, config.getMovedMethodName(), args.getWrappedNode(), new LocalStaticScope(null), methodNode.getBodyNode());
+ resultMethod = NodeFactory.createStaticMethodNode(destClassName, config.getMovedMethodName(), args.getWrappedNode(), new LocalStaticScope(null), methodNode.getBodyNode());
}
- return NodeFactory.createMethodNodeWithoutNewline(config.getMovedMethodName(), args.getWrappedNode(), methodNode.getBodyNode());
+ else{
+ resultMethod = NodeFactory.createMethodNodeWithoutNewline(config.getMovedMethodName(), args.getWrappedNode(), methodNode.getBodyNode());
+ }
+
+ resultMethod.addComments(methodNode.getComments());
+ resultMethod.setPosition(methodNode.getPosition());
+ return resultMethod;
}
private TextEdit getFieldInsertionEdit(String docStr) {
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ExtractMethodPage.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ExtractMethodPage.java 2007-04-26 10:47:41 UTC (rev 2369)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ExtractMethodPage.java 2007-04-26 11:07:41 UTC (rev 2370)
@@ -53,6 +53,7 @@
import org.rubypeople.rdt.refactoring.ui.pages.extractmethod.ParametersButtonDownListener;
import org.rubypeople.rdt.refactoring.ui.pages.extractmethod.ParametersButtonUpListener;
import org.rubypeople.rdt.refactoring.ui.pages.extractmethod.SignatureObserver;
+import org.rubypeople.rdt.refactoring.util.NodeUtil;
public class ExtractMethodPage extends RefactoringWizardPage implements IValidationController {
@@ -117,8 +118,8 @@
private void setupSelectionPreview() {
extractComposite.getCodeViewer().setPreviewText(selectionInformation.getSource());
- int nodeStart = extractedMethod.getSelectedNodes().getPosition().getStartOffset();
- int nodeLength = extractedMethod.getSelectedNodes().getPosition().getEndOffset() - nodeStart;
+ int nodeStart = NodeUtil.subPositionUnion(extractedMethod.getSelectedNodes()).getStartOffset();
+ int nodeLength = NodeUtil.subPositionUnion(extractedMethod.getSelectedNodes()).getEndOffset() - nodeStart;
extractComposite.getCodeViewer().setBackgroundColor(nodeStart, nodeLength, SWT.COLOR_GRAY);
int selectionStart = selectionInformation.getStartOfSelection();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-26 10:48:07
|
Revision: 2369
http://svn.sourceforge.net/rubyeclipse/?rev=2369&view=rev
Author: mirkostocker
Date: 2007-04-26 03:47:41 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
show a warning if the name hasn't changed or is already used
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java 2007-04-26 08:36:50 UTC (rev 2368)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java 2007-04-26 10:47:41 UTC (rev 2369)
@@ -38,6 +38,10 @@
import org.rubypeople.rdt.refactoring.nodewrapper.ModuleNodeWrapper;
public abstract class ModuleNodeProvider {
+
+ private interface IModuleAcceptor {
+ boolean accept(ModuleNodeWrapper wrapper);
+ }
public static ModuleNodeWrapper getSelectedModuleNode(Node root, int pos) {
@@ -48,14 +52,14 @@
return createModuleNodeWrapper(root, module);
}
- public static Collection<ModuleNodeWrapper> findOtherParts(IDocumentProvider doc, ModuleNodeWrapper module) {
+ private static Collection<ModuleNodeWrapper> findModules(IDocumentProvider doc, IModuleAcceptor acceptor) {
ArrayList<ModuleNodeWrapper> modules = new ArrayList<ModuleNodeWrapper>();
for (String file : doc.getFileNames()) {
for (Node node : NodeProvider.getSubNodes(doc.getRootNode(file), ModuleNode.class)) {
ModuleNode moduleNode = (ModuleNode) node;
ModuleNodeWrapper wrapper = createModuleNodeWrapper(doc.getRootNode(file), moduleNode);
- if(wrapper.getFullName().equals(module.getFullName())) {
+ if(acceptor.accept(wrapper)) {
modules.add(wrapper);
}
}
@@ -64,6 +68,22 @@
return modules;
}
+ public static Collection<ModuleNodeWrapper> findOtherParts(IDocumentProvider doc, final ModuleNodeWrapper module) {
+ return findModules(doc, new IModuleAcceptor(){
+
+ public boolean accept(ModuleNodeWrapper wrapper) {
+ return wrapper.getFullName().equals(module.getFullName());
+ }});
+ }
+
+ public static Collection<ModuleNodeWrapper> findAllModules(IDocumentProvider doc) {
+ return findModules(doc, new IModuleAcceptor(){
+
+ public boolean accept(ModuleNodeWrapper wrapper) {
+ return true;
+ }});
+ }
+
public static Collection<ConstNode> getAllModuleMethodDefinitions(Collection<ModuleNodeWrapper> modules) {
ArrayList<ConstNode> methods = new ArrayList<ConstNode>();
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java 2007-04-26 08:36:50 UTC (rev 2368)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java 2007-04-26 10:47:41 UTC (rev 2369)
@@ -32,10 +32,12 @@
import java.util.Collection;
import java.util.HashSet;
+import org.jruby.ast.ClassNode;
import org.jruby.ast.Colon2Node;
import org.jruby.ast.ConstNode;
import org.jruby.ast.Node;
import org.jruby.ast.RootNode;
+import org.jruby.ast.SClassNode;
import org.rubypeople.rdt.refactoring.core.IRefactoringConfig;
import org.rubypeople.rdt.refactoring.core.ModuleNodeProvider;
import org.rubypeople.rdt.refactoring.core.NodeProvider;
@@ -62,6 +64,16 @@
}
@Override
+ protected void checkFinalConditions() {
+ if (config.getOriginalName().equals(config.getNewName())) {
+ addWarning("You did not change the name.");
+ }
+ if(config.getAllModuleNames().contains(config.getNewName())) {
+ addWarning("The name you chose is already in use.");
+ }
+ }
+
+ @Override
public void init(IRefactoringConfig configObj) {
config = (RenameModuleConfig) configObj;
@@ -70,14 +82,25 @@
return;
}
config.setSelectedModule(selectedModule);
+ config.setNewName(config.getOriginalName());
config.setModuleParts(ModuleNodeProvider.findOtherParts(config.getDocumentProvider(), config.getSelectedModule()));
config.setIncludes(new ModuleIncludeFinder(config.getDocumentProvider()).find(config.getOriginalFullName()));
config.setPossibleCalls(findPossibleCalls());
config.setSelectedCalls(config.getPossibleCalls());
+
+ config.setAllModuleNames(getAllModuleNames());
}
+ private Collection<String> getAllModuleNames() {
+ Collection<String> names = new ArrayList<String>();
+ for(ModuleNodeWrapper module : ModuleNodeProvider.findAllModules(config.getDocumentProvider())) {
+ names.add(module.getFullName());
+ }
+ return names;
+ }
+
private ArrayList<ModuleSpecifierWrapper> findPossibleCalls() {
ArrayList<ModuleSpecifierWrapper> calls = new ArrayList<ModuleSpecifierWrapper>();
@@ -86,7 +109,9 @@
for(String file : config.getDocumentProvider().getFileNames()) {
RootNode rootNode = config.getDocumentProvider().getRootNode(file);
for (final Node node : NodeProvider.getSubNodes(rootNode, ConstNode.class, Colon2Node.class)) {
- if(toSkip.contains(node)) {
+ if(toSkip.contains(node)
+ || NodeProvider.findParentNode(rootNode, node) instanceof ClassNode
+ || NodeProvider.findParentNode(rootNode, node) instanceof SClassNode) {
continue;
}
ModuleSpecifierWrapper module = ModuleSpecifierWrapper.create(node, NameHelper.getEncosingModulePrefix(rootNode, node));
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java 2007-04-26 08:36:50 UTC (rev 2368)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java 2007-04-26 10:47:41 UTC (rev 2369)
@@ -50,6 +50,7 @@
private Collection<? extends INodeWrapper> possibleCalls;
private Collection<? extends INodeWrapper> selectedCalls;
private Collection<ModuleSpecifierWrapper> includes;
+ private Collection<String> allModuleNames;
public RenameModuleConfig(IDocumentProvider doc, int carretPosition) {
this.doc = doc;
@@ -125,4 +126,12 @@
public Collection<ModuleSpecifierWrapper> getIncludes() {
return includes;
}
+
+ public Collection<String> getAllModuleNames() {
+ return allModuleNames;
+ }
+
+ public void setAllModuleNames(Collection<String> allModuleNames) {
+ this.allModuleNames = allModuleNames;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-26 08:36:52
|
Revision: 2368
http://svn.sourceforge.net/rubyeclipse/?rev=2368&view=rev
Author: mbarchfe
Date: 2007-04-26 01:36:50 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
xvfb: do not listen on tcp port
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/build.sh
trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/build.sh
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/build.sh 2007-04-26 08:13:34 UTC (rev 2367)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/build.sh 2007-04-26 08:36:50 UTC (rev 2368)
@@ -4,7 +4,7 @@
exit 1
fi
#echo "Make sure xvfb is running - otherwise the tests won't run. Start with"
-Xvfb :1 &
+Xvfb -nolisten tcp :1 &
export DISPLAY=localhost:1
cmd="ant -f build-RDT.xml $1"
logfile=build.$1.log
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh 2007-04-26 08:13:34 UTC (rev 2367)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh 2007-04-26 08:36:50 UTC (rev 2368)
@@ -1,4 +1,4 @@
#!/bin/bash
-Xvfb :1 &
+Xvfb -nolisten tcp :1 &
export DISPLAY=localhost:1
~/cruisecontrol/cruisecontrol.sh -webport 8080 -jmxport 8000 $@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-26 08:13:36
|
Revision: 2367
http://svn.sourceforge.net/rubyeclipse/?rev=2367&view=rev
Author: mbarchfe
Date: 2007-04-26 01:13:34 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
bump nightly version to 0.9.0 - labelincrementer
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2007-04-26 08:11:36 UTC (rev 2366)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2007-04-26 08:13:34 UTC (rev 2367)
@@ -1,7 +1,7 @@
<cruisecontrol>
<project name="RDT" buildafterfailed="false">
<plugin name="labelincrementer" classname="org.rubypeople.rdt.cruisecontrol.plugin.EclipsePluginLabelProvider"/>
- <labelincrementer prefix="0.8.0"/>
+ <labelincrementer prefix="0.9.0"/>
<property name="buildDirectory" value="/home/rdt/build-cc"/>
<bootstrappers>
<svnbootstrapper localworkingcopy="../pluginbuilder"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-26 08:11:37
|
Revision: 2366
http://svn.sourceforge.net/rubyeclipse/?rev=2366&view=rev
Author: mirkostocker
Date: 2007-04-26 01:11:36 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
fix a NPE.. sorry :)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java 2007-04-26 07:54:14 UTC (rev 2365)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java 2007-04-26 08:11:36 UTC (rev 2366)
@@ -144,7 +144,7 @@
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
Change change = createEditChanges();
- Map<String, String> filesToRename = fileNameChangeProvider.getFilesToRename(getAllAffectedFiles(change));
+ Map<String, String> filesToRename = getFileNameChangeProvider().getFilesToRename(getAllAffectedFiles(change));
if(filesToRename.isEmpty()) {
return change;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-26 07:54:18
|
Revision: 2365
http://svn.sourceforge.net/rubyeclipse/?rev=2365&view=rev
Author: mbarchfe
Date: 2007-04-26 00:54:14 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
bump nightly version to 0.9.0
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2007-04-25 22:34:38 UTC (rev 2364)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2007-04-26 07:54:14 UTC (rev 2365)
@@ -21,7 +21,7 @@
target="main-cc"
uselogger="true"
usedebug="false">
- <property name="version" value="0.8.0"/>
+ <property name="version" value="0.9.0"/>
<property name="buildDirectory" value="${buildDirectory}"/>
</ant>
</schedule>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-25 22:34:41
|
Revision: 2364
http://svn.sourceforge.net/rubyeclipse/?rev=2364&view=rev
Author: cawilliams
Date: 2007-04-25 15:34:38 -0700 (Wed, 25 Apr 2007)
Log Message:
-----------
re-arrange fields, so user picks install location before entering name. Also add explanatory text telling user to enter/browse to the ruby install, not the executable!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java 2007-04-25 22:20:48 UTC (rev 2363)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java 2007-04-25 22:34:38 UTC (rev 2364)
@@ -228,16 +228,22 @@
fVMTypeCombo.doFillIntoGrid(parent, 3);
((GridData)fVMTypeCombo.getComboControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
- fVMName.doFillIntoGrid(parent, 3);
-
+ Label l = new Label(parent, SWT.NONE);
+ l.setText(RubyVMMessages.enterRubyInstallLocation);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ l.setLayoutData(gd);
+
fRubyVMRoot.doFillIntoGrid(parent, 3);
+ fVMName.doFillIntoGrid(parent, 3);
+
fVMArgs.doFillIntoGrid(parent, 3);
((GridData)fVMArgs.getTextControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
- Label l = new Label(parent, SWT.NONE);
+ l = new Label(parent, SWT.NONE);
l.setText(RubyVMMessages.AddVMDialog_JRE_system_libraries__1);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
l.setLayoutData(gd);
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-04-25 22:20:48 UTC (rev 2363)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-04-25 22:34:38 UTC (rev 2364)
@@ -31,6 +31,7 @@
public static String InstalledJREsBlock_15;
public static String JREsPreferencePage_2;
public static String JREsPreferencePage_1;
+ public static String enterRubyInstallLocation;
static {
// load message values from bundle file
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties 2007-04-25 22:20:48 UTC (rev 2363)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties 2007-04-25 22:34:38 UTC (rev 2364)
@@ -1,3 +1,4 @@
+enterRubyInstallLocation=Please enter or browse to your the ruby install location.\nThis will typically be /usr, /usr/local, /opt or C:\\ruby.\nThis is the location of the ruby install, not the executable.\nWe will auto-detect the executable from this path.
addVMDialog_pickJRERootDialog_message=Select the root directory of the Ruby installation:\n(For *nix systems, this may be /usr or /usr/local. If the ruby executable is in /usr/local/bin/ruby, use /usr/local).
addVMDialog_enterLocation=Enter the location of the Ruby VM.
addVMDialog_locationNotExists=The location does not exist.
@@ -9,7 +10,7 @@
addVMDialog_duplicateName=The name is already used.
addVMDialog_enterName=Enter a name for the RubyVM.
addVMDialog_jreHome=&RubyVM home directory:
-addVMDialog_jreName=RubyVM &name:
+addVMDialog_jreName=RubyVM display &name:
addVMDialog_jreType=RubyVM &type:
AddVMDialog_23=Default &VM Arguments:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-25 22:20:52
|
Revision: 2363
http://svn.sourceforge.net/rubyeclipse/?rev=2363&view=rev
Author: cawilliams
Date: 2007-04-25 15:20:48 -0700 (Wed, 25 Apr 2007)
Log Message:
-----------
if user has selected the bin directory, trim it off the file before we set our install location.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java 2007-04-25 19:28:24 UTC (rev 2362)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/AddVMDialog.java 2007-04-25 22:20:48 UTC (rev 2363)
@@ -100,6 +100,9 @@
}
}
if (s.isOK()) {
+ if (file.getName().equals("bin")) {
+ file = file.getParentFile();
+ }
fLibraryBlock.setHomeDirectory(file);
String name = fVMName.getText();
if (name == null || name.trim().length() == 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-25 19:28:26
|
Revision: 2362
http://svn.sourceforge.net/rubyeclipse/?rev=2362&view=rev
Author: cawilliams
Date: 2007-04-25 12:28:24 -0700 (Wed, 25 Apr 2007)
Log Message:
-----------
modify the code which handles "upgrading" old storage of interpreters. Look for runtimeConfiguration.xml and parse out interpreters there, adding them. This should fix people who have 0.8.1 or earlier installed and move over to latest nightlies. though anyone who has already been bit by this will need a different fix, perhaps (which checks to see if stored pref contains any vms, rather than whether it's just an empty string)...
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-04-25 10:14:02 UTC (rev 2361)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-04-25 19:28:24 UTC (rev 2362)
@@ -364,13 +364,12 @@
}
// If the top-level node wasn't what we expected, bail out
- if (!config.getNodeName().equalsIgnoreCase("vmSettings")) { //$NON-NLS-1$
+ if (!config.getNodeName().equalsIgnoreCase("runtimeconfig")) { //$NON-NLS-1$
throw new IOException(LaunchingMessages.RubyRuntime_badFormat);
}
- // Populate the default VM-related fields
- container.setDefaultVMInstallCompositeID(config.getAttribute("defaultVM")); //$NON-NLS-1$
-
+ IVMInstallType vmType = RubyRuntime.getVMInstallType("org.rubypeople.rdt.launching.StandardVMType");
+
// Traverse the parsed structure and populate the VMType to VM Map
NodeList list = config.getChildNodes();
int length = list.getLength();
@@ -378,48 +377,20 @@
Node node = list.item(i);
short type = node.getNodeType();
if (type == Node.ELEMENT_NODE) {
- Element vmTypeElement = (Element) node;
- if (vmTypeElement.getNodeName().equalsIgnoreCase("vmType")) { //$NON-NLS-1$
- populateVMTypes(vmTypeElement, container);
+ Element vmElement = (Element) node;
+ if (vmElement.getNodeName().equalsIgnoreCase("interpreter")) { //$NON-NLS-1$
+ populateVMForType(vmType, vmElement, container);
}
}
}
}
-
- /**
- * For the specified vm type node, parse all subordinate VM definitions and add them
- * to the specified container.
- */
- private static void populateVMTypes(Element vmTypeElement, VMDefinitionsContainer container) {
-
- // Retrieve the 'id' attribute and the corresponding VM type object
- String id = vmTypeElement.getAttribute("id"); //$NON-NLS-1$
- IVMInstallType vmType= RubyRuntime.getVMInstallType(id);
- if (vmType != null) {
-
- // For each VM child node, populate the container with a subordinate node
- NodeList vmNodeList = vmTypeElement.getChildNodes();
- for (int i = 0; i < vmNodeList.getLength(); ++i) {
- Node vmNode = vmNodeList.item(i);
- short type = vmNode.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element vmElement = (Element) vmNode;
- if (vmElement.getNodeName().equalsIgnoreCase("vm")) { //$NON-NLS-1$
- populateVMForType(vmType, vmElement, container);
- }
- }
- }
- } else {
- LaunchingPlugin.log(LaunchingMessages.RubyRuntime_VM_type_element_with_unknown_id_1);
- }
- }
/**
* Parse the specified VM node, create a VMStandin for it, and add this to the
* specified container.
*/
private static void populateVMForType(IVMInstallType vmType, Element vmElement, VMDefinitionsContainer container) {
- String id= vmElement.getAttribute("id"); //$NON-NLS-1$
+ String id= vmElement.getAttribute("name"); //$NON-NLS-1$
if (id != null) {
// Retrieve the 'path' attribute. If none, skip this node.
@@ -430,37 +401,14 @@
// Create a VMStandin for the node and set its 'name' & 'installLocation' attributes
VMStandin vmStandin = new VMStandin(vmType, id);
- vmStandin.setName(vmElement.getAttribute("name")); //$NON-NLS-1$
+ vmStandin.setName(id); //$NON-NLS-1$
File installLocation= new File(installPath);
+ // If the path is to the executable (which it should be), chop off last part of path!
+ if (installLocation.isFile()) {
+ installLocation = installLocation.getParentFile();
+ }
vmStandin.setInstallLocation(installLocation);
container.addVM(vmStandin);
-
- // Look for subordinate nodes. These may be 'libraryLocation',
- // 'libraryLocations' or 'versionInfo'.
- NodeList list = vmElement.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element subElement = (Element)node;
- String subElementName = subElement.getNodeName();
- if (subElementName.equals("libraryLocation")) { //$NON-NLS-1$
- IPath loc = getLibraryLocation(subElement);
- vmStandin.setLibraryLocations(new IPath[]{loc});
- break;
- } else if (subElementName.equals("libraryLocations")) { //$NON-NLS-1$
- setLibraryLocations(vmStandin, subElement);
- break;
- }
- }
- }
-
- // vm Arguments
- String vmArgs = vmElement.getAttribute("vmargs"); //$NON-NLS-1$
- if (vmArgs != null && vmArgs.length() >0) {
- vmStandin.setVMArgs(vmArgs);
- }
} else {
LaunchingPlugin.log(LaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2);
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-04-25 10:14:02 UTC (rev 2361)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-04-25 19:28:24 UTC (rev 2362)
@@ -517,14 +517,14 @@
} else {
// Otherwise, look for the old file that previously held the VM definitions
IPath stateLocation= LaunchingPlugin.getDefault().getStateLocation();
- IPath stateFile= stateLocation.append("vmConfiguration.xml"); //$NON-NLS-1$
+ IPath stateFile= stateLocation.append("runtimeConfiguration.xml"); //$NON-NLS-1$
File file = new File(stateFile.toOSString());
if (file.exists()) {
// If file exists, load VM definitions from it into memory and write the definitions to
// the preference store WITHOUT triggering any processing of the new value
FileInputStream fileInputStream = new FileInputStream(file);
- VMDefinitionsContainer.parseXMLIntoContainer(fileInputStream, vmDefs);
+ VMDefinitionsContainer.parseXMLIntoContainer(fileInputStream, vmDefs);
}
}
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-25 10:14:06
|
Revision: 2361
http://svn.sourceforge.net/rubyeclipse/?rev=2361&view=rev
Author: mirkostocker
Date: 2007-04-25 03:14:02 -0700 (Wed, 25 Apr 2007)
Log Message:
-----------
add some infrastructure code (copied from JDT) to rename files and add a first attempt to rename the file if the renamed class has the same name. My plans are to implement a "rename file" refactoring that updates the 'require' statements. After that, we can start adding Rails specific extensions to refactorings, for example to rename view files if we rename a controller method.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RenameAction.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Messages.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/messages.properties
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/rename/RenameRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassRefactoring.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IRubyStatusConstants.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/DynamicValidationStateChange.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RDTChange.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RenameResourceChange.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Resources.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/WorkspaceTracker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassFileNameChangeProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/editprovider/FileNameChangeProvider.java
Modified: trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF 2007-04-25 10:14:02 UTC (rev 2361)
@@ -62,7 +62,8 @@
org.eclipse.ui.editors,
org.rubypeople.rdt.core,
org.eclipse.compare,
- org.jruby
+ org.jruby,
+ org.eclipse.core.filesystem
Eclipse-LazyStart: true
Bundle-Vendor: %rubyRefactoring.providerName
Bundle-ClassPath: refactoring.jar
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RenameAction.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RenameAction.java 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RenameAction.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -32,8 +32,6 @@
public class RenameAction extends WorkbenchWindowActionDelegate {
- public static final Class[] renamableClasses = {};
-
@Override
public void run() {
run(RenameRefactoring.class, RenameRefactoring.NAME);
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/DynamicValidationStateChange.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/DynamicValidationStateChange.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/DynamicValidationStateChange.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,116 @@
+package org.rubypeople.rdt.refactoring.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+
+import org.eclipse.core.resources.IWorkspaceRunnable;
+
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+
+public class DynamicValidationStateChange extends CompositeChange implements WorkspaceTracker.Listener {
+
+ private boolean fListenerRegistered= false;
+ private RefactoringStatus fValidationState= null;
+ private long fTimeStamp;
+
+ // 30 minutes
+ private static final long LIFE_TIME= 30 * 60 * 1000;
+
+ public DynamicValidationStateChange(Change change) {
+ super(change.getName());
+ add(change);
+ markAsSynthetic();
+ }
+
+ public DynamicValidationStateChange(String name) {
+ super(name);
+ markAsSynthetic();
+ }
+
+ public DynamicValidationStateChange(String name, Change[] changes) {
+ super(name, changes);
+ markAsSynthetic();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeValidationData(IProgressMonitor pm) {
+ super.initializeValidationData(pm);
+ WorkspaceTracker.INSTANCE.addListener(this);
+ fListenerRegistered= true;
+ fTimeStamp= System.currentTimeMillis();
+ }
+
+ public void dispose() {
+ if (fListenerRegistered) {
+ WorkspaceTracker.INSTANCE.removeListener(this);
+ fListenerRegistered= false;
+ }
+ super.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
+ if (fValidationState == null) {
+ return super.isValid(pm);
+ }
+ return fValidationState;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Change perform(IProgressMonitor pm) throws CoreException {
+ final Change[] result= new Change[1];
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ result[0]= DynamicValidationStateChange.super.perform(monitor);
+ }
+ };
+ RubyCore.run(runnable, null, pm);
+ return result[0];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Change createUndoChange(Change[] childUndos) {
+ DynamicValidationStateChange result= new DynamicValidationStateChange(getName());
+ for (int i= 0; i < childUndos.length; i++) {
+ result.add(childUndos[i]);
+ }
+ return result;
+ }
+
+ public void workspaceChanged() {
+ long currentTime= System.currentTimeMillis();
+ if (currentTime - fTimeStamp < LIFE_TIME)
+ return;
+ fValidationState= RefactoringStatus.createFatalErrorStatus(Messages.DynamicValidationStateChange_workspace_changed);
+ // remove listener from workspace tracker
+ WorkspaceTracker.INSTANCE.removeListener(this);
+ fListenerRegistered= false;
+ // clear up the children to not hang onto too much memory
+ Change[] children= clear();
+ for (int i= 0; i < children.length; i++) {
+ final Change change= children[i];
+ SafeRunner.run(new ISafeRunnable() {
+ public void run() throws Exception {
+ change.dispose();
+ }
+ public void handleException(Throwable exception) {
+ RubyPlugin.log(exception);
+ }
+ });
+ }
+ }
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Messages.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Messages.java 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Messages.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -1,5 +1,7 @@
package org.rubypeople.rdt.refactoring.core;
+import java.text.MessageFormat;
+
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
@@ -10,11 +12,37 @@
public static String RefactoringConditionChecker_SyntaxErrorInCurrent;
public static String RefactoringConditionChecker_SyntaxErrorInProject;
+
+ public static String RenameResourceChange_name;
+
+ public static String RenameResourceChange_does_not_exist;
+
+ public static String RenameResourceChange_rename_resource;
+
+ public static String DynamicValidationStateChange_workspace_changed;
+
+ public static String Change_is_unsaved;
+
+ public static String Change_is_read_only;
+
+ public static String Change_same_read_only;
+
+ public static String Change_has_modifications;
+
+ public static String Change_does_not_exist;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
+ public static String format(String message, Object object) {
+ return MessageFormat.format(message, new Object[] { object});
+ }
+
+ public static String format(String message, Object[] objects) {
+ return MessageFormat.format(message, objects);
+ }
+
private Messages() {
}
}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RDTChange.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RDTChange.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RDTChange.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,254 @@
+package org.rubypeople.rdt.refactoring.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension4;
+
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.rubypeople.rdt.core.IRubyElement;
+
+/**
+ * RDT specific change object, copied from the JDT
+ */
+public abstract class RDTChange extends Change {
+
+ private long fModificationStamp;
+ private boolean fReadOnly;
+
+ private static class ValidationState {
+ private IResource fResource;
+ private int fKind;
+ private boolean fDirty;
+ private boolean fReadOnly;
+ private long fModificationStamp;
+ private ITextFileBuffer fTextFileBuffer;
+ public static final int RESOURCE= 1;
+ public static final int DOCUMENT= 2;
+ public ValidationState(IResource resource) {
+ fResource= resource;
+ if (resource instanceof IFile) {
+ initializeFile((IFile)resource);
+ } else {
+ initializeResource(resource);
+ }
+ }
+ public void checkDirty(RefactoringStatus status, long stampToMatch, IProgressMonitor pm) throws CoreException {
+ if (fDirty) {
+ if (fKind == DOCUMENT && fTextFileBuffer != null && stampToMatch == fModificationStamp) {
+ fTextFileBuffer.commit(pm, false);
+ } else {
+ status.addFatalError(Messages.format(
+ Messages.Change_is_unsaved, fResource.getFullPath().toString()));
+ }
+ }
+ }
+ public void checkDirty(RefactoringStatus status) {
+ if (fDirty) {
+ status.addFatalError(Messages.format(
+ Messages.Change_is_unsaved, fResource.getFullPath().toString()));
+ }
+ }
+ public void checkReadOnly(RefactoringStatus status) {
+ if (fReadOnly) {
+ status.addFatalError(Messages.format(
+ Messages.Change_is_read_only, fResource.getFullPath().toString()));
+ }
+ }
+ public void checkSameReadOnly(RefactoringStatus status, boolean valueToMatch) {
+ if (fReadOnly != valueToMatch) {
+ status.addFatalError(Messages.format(
+ Messages.Change_same_read_only,
+ fResource.getFullPath().toString()));
+ }
+ }
+ public void checkModificationStamp(RefactoringStatus status, long stampToMatch) {
+ if (fKind == DOCUMENT) {
+ if (stampToMatch != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP && fModificationStamp != stampToMatch) {
+ status.addFatalError(Messages.format(
+ Messages.Change_has_modifications, fResource.getFullPath().toString()));
+ }
+ } else {
+ if (stampToMatch != IResource.NULL_STAMP && fModificationStamp != stampToMatch) {
+ status.addFatalError(Messages.format(
+ Messages.Change_has_modifications, fResource.getFullPath().toString()));
+
+ }
+ }
+ }
+ private void initializeFile(IFile file) {
+ fTextFileBuffer= getBuffer(file);
+ if (fTextFileBuffer == null) {
+ initializeResource(file);
+ } else {
+ IDocument document= fTextFileBuffer.getDocument();
+ fDirty= fTextFileBuffer.isDirty();
+ fReadOnly= Resources.isReadOnly(file);
+ if (document instanceof IDocumentExtension4) {
+ fKind= DOCUMENT;
+ fModificationStamp= ((IDocumentExtension4)document).getModificationStamp();
+ } else {
+ fKind= RESOURCE;
+ fModificationStamp= file.getModificationStamp();
+ }
+ }
+
+ }
+ private void initializeResource(IResource resource) {
+ fKind= RESOURCE;
+ fDirty= false;
+ fReadOnly= Resources.isReadOnly(resource);
+ fModificationStamp= resource.getModificationStamp();
+ }
+ }
+
+ protected static final int NONE= 0;
+ protected static final int READ_ONLY= 1 << 0;
+ protected static final int DIRTY= 1 << 1;
+ private static final int SAVE= 1 << 2;
+ protected static final int SAVE_IF_DIRTY= SAVE | DIRTY;
+
+ protected RDTChange() {
+ fModificationStamp= IResource.NULL_STAMP;
+ fReadOnly= false;
+ }
+
+ public void initializeValidationData(IProgressMonitor pm) {
+ IResource resource= getResource(getModifiedElement());
+ if (resource != null) {
+ fModificationStamp= getModificationStamp(resource);
+ fReadOnly= Resources.isReadOnly(resource);
+ }
+ }
+
+ // protected final RefactoringStatus isValid(IProgressMonitor pm, boolean checkReadOnly, boolean checkDirty) throws CoreException {
+ protected final RefactoringStatus isValid(IProgressMonitor pm, int flags) throws CoreException {
+ pm.beginTask("", 2); //$NON-NLS-1$
+ try {
+ RefactoringStatus result= new RefactoringStatus();
+ Object modifiedElement= getModifiedElement();
+ checkExistence(result, modifiedElement);
+ if (result.hasFatalError())
+ return result;
+ if (flags == NONE)
+ return result;
+ IResource resource= getResource(modifiedElement);
+ if (resource != null) {
+ ValidationState state= new ValidationState(resource);
+ state.checkModificationStamp(result, fModificationStamp);
+ if (result.hasFatalError())
+ return result;
+ state.checkSameReadOnly(result, fReadOnly);
+ if (result.hasFatalError())
+ return result;
+ if ((flags & READ_ONLY) != 0) {
+ state.checkReadOnly(result);
+ if (result.hasFatalError())
+ return result;
+ }
+ if ((flags & DIRTY) != 0) {
+ if ((flags & SAVE) != 0) {
+ state.checkDirty(result, fModificationStamp, new SubProgressMonitor(pm, 1));
+ } else {
+ state.checkDirty(result);
+ }
+ }
+ }
+ return result;
+ } finally {
+ pm.done();
+ }
+ }
+
+ protected final RefactoringStatus isValid(int flags) throws CoreException {
+ return isValid(new NullProgressMonitor(), flags);
+ }
+
+ protected static void checkIfModifiable(RefactoringStatus status, Object element, int flags) {
+ checkIfModifiable(status, getResource(element), flags);
+ }
+
+ protected static void checkIfModifiable(RefactoringStatus result, IResource resource, int flags) {
+ checkExistence(result, resource);
+ if (result.hasFatalError())
+ return;
+ if (flags == NONE)
+ return;
+ ValidationState state= new ValidationState(resource);
+ if ((flags & READ_ONLY) != 0) {
+ state.checkReadOnly(result);
+ if (result.hasFatalError())
+ return;
+ }
+ if ((flags & DIRTY) != 0) {
+ state.checkDirty(result);
+ }
+ }
+
+ protected static void checkExistence(RefactoringStatus status, Object element) {
+ if (element == null) {
+ status.addFatalError(Messages.DynamicValidationStateChange_workspace_changed);
+
+ } else if (element instanceof IResource && !((IResource)element).exists()) {
+ status.addFatalError(Messages.format(
+ Messages.Change_does_not_exist, ((IResource)element).getFullPath().toString()));
+ } else if (element instanceof IRubyElement && !((IRubyElement)element).exists()) {
+ status.addFatalError(Messages.format(
+ Messages.Change_does_not_exist, ((IRubyElement)element).getElementName()));
+ }
+ }
+
+ private static IResource getResource(Object element) {
+ if (element instanceof IResource) {
+ return (IResource)element;
+ }
+ /*if (element instanceof ICompilationUnit) {
+ return ((ICompilationUnit)element).getPrimary().getResource();
+ }*/
+ if (element instanceof IRubyElement) {
+ return ((IRubyElement)element).getResource();
+ }
+ if (element instanceof IAdaptable) {
+ return (IResource)((IAdaptable)element).getAdapter(IResource.class);
+ }
+ return null;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ public long getModificationStamp(IResource resource) {
+ if (!(resource instanceof IFile))
+ return resource.getModificationStamp();
+ IFile file= (IFile)resource;
+ ITextFileBuffer buffer= getBuffer(file);
+ if (buffer == null) {
+ return file.getModificationStamp();
+ } else {
+ IDocument document= buffer.getDocument();
+ if (document instanceof IDocumentExtension4) {
+ return ((IDocumentExtension4)document).getModificationStamp();
+ } else {
+ return file.getModificationStamp();
+ }
+ }
+ }
+
+ private static ITextFileBuffer getBuffer(IFile file) {
+ ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
+ return manager.getTextFileBuffer(file.getFullPath());
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RenameResourceChange.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RenameResourceChange.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RenameResourceChange.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,93 @@
+package org.rubypeople.rdt.refactoring.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.ChangeDescriptor;
+import org.eclipse.ltk.core.refactoring.RefactoringChangeDescriptor;
+import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+
+public final class RenameResourceChange extends RDTChange {
+
+ public static IPath renamedResourcePath(IPath path, String newName) {
+ return path.removeLastSegments(1).append(newName);
+ }
+
+ private final String fComment;
+
+ private final RefactoringDescriptor fDescriptor;
+
+ private final String fNewName;
+
+ private final IPath fResourcePath;
+
+ private final long fStampToRestore;
+
+ private RenameResourceChange(RefactoringDescriptor descriptor, IPath resourcePath, String newName, String comment, long stampToRestore) {
+ fDescriptor= descriptor;
+ fResourcePath= resourcePath;
+ fNewName= newName;
+ fComment= comment;
+ fStampToRestore= stampToRestore;
+ }
+
+ public RenameResourceChange(RefactoringDescriptor descriptor, IResource resource, String newName, String comment) {
+ this(descriptor, resource.getFullPath(), newName, comment, IResource.NULL_STAMP);
+ }
+
+ public ChangeDescriptor getDescriptor() {
+ if (fDescriptor != null)
+ return new RefactoringChangeDescriptor(fDescriptor);
+ return null;
+ }
+
+ public Object getModifiedElement() {
+ return getResource();
+ }
+
+ public String getName() {
+ return Messages.format(Messages.RenameResourceChange_name, new String[] { fResourcePath.toString(), fNewName});
+ }
+
+ public String getNewName() {
+ return fNewName;
+ }
+
+ private IResource getResource() {
+ return ResourcesPlugin.getWorkspace().getRoot().findMember(fResourcePath);
+ }
+
+ public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
+ IResource resource= getResource();
+ if (resource == null || !resource.exists()) {
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(Messages.RenameResourceChange_does_not_exist, fResourcePath.toString()));
+ } else {
+ return super.isValid(pm, DIRTY);
+ }
+ }
+
+ public Change perform(IProgressMonitor pm) throws CoreException {
+ try {
+ pm.beginTask(Messages.RenameResourceChange_rename_resource, 1);
+
+ IResource resource= getResource();
+ long currentStamp= resource.getModificationStamp();
+ IPath newPath= renamedResourcePath(fResourcePath, fNewName);
+ resource.move(newPath, IResource.SHALLOW, pm);
+ if (fStampToRestore != IResource.NULL_STAMP) {
+ IResource newResource= ResourcesPlugin.getWorkspace().getRoot().findMember(newPath);
+ newResource.revertModificationStamp(fStampToRestore);
+ }
+ String oldName= fResourcePath.lastSegment();
+ return new RenameResourceChange(null, newPath, oldName, fComment, currentStamp);
+ } finally {
+ pm.done();
+ }
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Resources.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Resources.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/Resources.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,228 @@
+package org.rubypeople.rdt.refactoring.core;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.filesystem.EFS;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.ResourceAttributes;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.rubypeople.rdt.internal.ui.IRubyStatusConstants;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.RubyUIStatus;
+
+public class Resources {
+
+ private Resources() {
+ }
+
+ /**
+ * Checks if the given resource is in sync with the underlying file system.
+ *
+ * @param resource the resource to be checked
+ * @return IStatus status describing the check's result. If <code>status.
+ * isOK()</code> returns <code>true</code> then the resource is in sync
+ */
+ public static IStatus checkInSync(IResource resource) {
+ return checkInSync(new IResource[] {resource});
+ }
+
+ /**
+ * Checks if the given resources are in sync with the underlying file
+ * system.
+ *
+ * @param resources the resources to be checked
+ * @return IStatus status describing the check's result. If <code>status.
+ * isOK() </code> returns <code>true</code> then the resources are in sync
+ */
+ public static IStatus checkInSync(IResource[] resources) {
+ IStatus result= null;
+ for (int i= 0; i < resources.length; i++) {
+ IResource resource= resources[i];
+ if (!resource.isSynchronized(IResource.DEPTH_INFINITE)) {
+ result= addOutOfSync(result, resource);
+ }
+ }
+ if (result != null)
+ return result;
+ return new Status(IStatus.OK, RubyPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
+ }
+
+ /**
+ * Makes the given resource committable. Committable means that it is
+ * writeable and that its content hasn't changed by calling
+ * <code>validateEdit</code> for the given resource on <tt>IWorkspace</tt>.
+ *
+ * @param resource the resource to be checked
+ * @param context the context passed to <code>validateEdit</code>
+ * @return status describing the method's result. If <code>status.isOK()</code> returns <code>true</code> then the resources are committable.
+ *
+ * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
+ */
+ public static IStatus makeCommittable(IResource resource, Object context) {
+ return makeCommittable(new IResource[] { resource }, context);
+ }
+
+ /**
+ * Makes the given resources committable. Committable means that all
+ * resources are writeable and that the content of the resources hasn't
+ * changed by calling <code>validateEdit</code> for a given file on
+ * <tt>IWorkspace</tt>.
+ *
+ * @param resources the resources to be checked
+ * @param context the context passed to <code>validateEdit</code>
+ * @return IStatus status describing the method's result. If <code>status.
+ * isOK()</code> returns <code>true</code> then the add resources are
+ * committable
+ *
+ * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
+ */
+ public static IStatus makeCommittable(IResource[] resources, Object context) {
+ List readOnlyFiles= new ArrayList();
+ for (int i= 0; i < resources.length; i++) {
+ IResource resource= resources[i];
+ if (resource.getType() == IResource.FILE && isReadOnly(resource))
+ readOnlyFiles.add(resource);
+ }
+ if (readOnlyFiles.size() == 0)
+ return new Status(IStatus.OK, RubyPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
+
+ Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
+ IStatus status= ResourcesPlugin.getWorkspace().validateEdit(
+ (IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]), context);
+ if (!status.isOK())
+ return status;
+
+ IStatus modified= null;
+ Map newTimeStamps= createModificationStampMap(readOnlyFiles);
+ for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
+ IFile file= (IFile) iter.next();
+ if (!oldTimeStamps.get(file).equals(newTimeStamps.get(file)))
+ modified= addModified(modified, file);
+ }
+ if (modified != null)
+ return modified;
+ return new Status(IStatus.OK, RubyPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
+ }
+
+ private static Map createModificationStampMap(List files){
+ Map map= new HashMap();
+ for (Iterator iter= files.iterator(); iter.hasNext(); ) {
+ IFile file= (IFile)iter.next();
+ map.put(file, new Long(file.getModificationStamp()));
+ }
+ return map;
+ }
+
+ private static IStatus addModified(IStatus status, IFile file) {
+ IStatus entry= RubyUIStatus.createError(
+ IRubyStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
+ Messages.format("CorextMessages.Resources_fileModified", file.getFullPath().toString()),
+ null);
+ if (status == null) {
+ return entry;
+ } else if (status.isMultiStatus()) {
+ ((MultiStatus)status).add(entry);
+ return status;
+ } else {
+ MultiStatus result= new MultiStatus(RubyPlugin.getPluginId(),
+ IRubyStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
+ "CorextMessages.Resources_modifiedResources", null);
+ result.add(status);
+ result.add(entry);
+ return result;
+ }
+ }
+
+ private static IStatus addOutOfSync(IStatus status, IResource resource) {
+ IStatus entry= new Status(
+ IStatus.ERROR,
+ ResourcesPlugin.PI_RESOURCES,
+ IResourceStatus.OUT_OF_SYNC_LOCAL,
+ Messages.format("CorextMessages.Resources_outOfSync", resource.getFullPath().toString()),
+ null);
+ if (status == null) {
+ return entry;
+ } else if (status.isMultiStatus()) {
+ ((MultiStatus)status).add(entry);
+ return status;
+ } else {
+ MultiStatus result= new MultiStatus(
+ ResourcesPlugin.PI_RESOURCES,
+ IResourceStatus.OUT_OF_SYNC_LOCAL,
+ "CorextMessages.Resources_outOfSyncResources", null);
+ result.add(status);
+ result.add(entry);
+ return result;
+ }
+ }
+
+ /**
+ * This method is used to generate a list of local locations to
+ * be used in DnD for file transfers.
+ *
+ * @param resources the array of resources to get the local
+ * locations for
+ * @return the local locations
+ */
+ public static String[] getLocationOSStrings(IResource[] resources) {
+ List result= new ArrayList(resources.length);
+ for (int i= 0; i < resources.length; i++) {
+ IPath location= resources[i].getLocation();
+ if (location != null)
+ result.add(location.toOSString());
+ }
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ /**
+ * Returns the location of the given resource. For local
+ * resources this is the OS path in the local file system. For
+ * remote resource this is the URI.
+ *
+ * @param resource the resource
+ * @return the location string or <code>null</code> if the
+ * location URI of the resource is <code>null</code>
+ */
+ public static String getLocationString(IResource resource) {
+ URI uri= resource.getLocationURI();
+ if (uri == null)
+ return null;
+ return EFS.SCHEME_FILE.equalsIgnoreCase(uri.getScheme())
+ ? new File(uri).getAbsolutePath()
+ : uri.toString();
+ }
+
+ public static boolean isReadOnly(IResource resource) {
+ ResourceAttributes resourceAttributes = resource.getResourceAttributes();
+ if (resourceAttributes == null) // not supported on this platform for this resource
+ return false;
+ return resourceAttributes.isReadOnly();
+ }
+
+ static void setReadOnly(IResource resource, boolean readOnly) {
+ ResourceAttributes resourceAttributes = resource.getResourceAttributes();
+ if (resourceAttributes == null) // not supported on this platform for this resource
+ return;
+
+ resourceAttributes.setReadOnly(readOnly);
+ try {
+ resource.setResourceAttributes(resourceAttributes);
+ } catch (CoreException e) {
+ RubyPlugin.log(e);
+ }
+ }
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/RubyRefactoring.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -32,6 +32,7 @@
import java.util.Collection;
import java.util.Map;
+import org.eclipse.core.internal.resources.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -43,10 +44,12 @@
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
import org.rubypeople.rdt.refactoring.documentprovider.DocumentProvider;
import org.rubypeople.rdt.refactoring.documentprovider.WorkspaceDocumentProvider;
import org.rubypeople.rdt.refactoring.editprovider.FileMultiEditProvider;
+import org.rubypeople.rdt.refactoring.editprovider.FileNameChangeProvider;
import org.rubypeople.rdt.refactoring.editprovider.IEditProvider;
import org.rubypeople.rdt.refactoring.editprovider.IMultiFileEditProvider;
import org.rubypeople.rdt.refactoring.preview.RubyTextFileChange;
@@ -69,6 +72,8 @@
private RubyEditor editor;
+ private FileNameChangeProvider fileNameChangeProvider;
+
public RubyRefactoring(String name) {
this.name = name;
initialStatus = new RefactoringStatus();
@@ -84,10 +89,14 @@
protected void setEditProvider(IEditProvider editProvider) {
this.editProvider = editProvider;
}
-
+
protected void setEditProvider(IMultiFileEditProvider multiFileEditProvider) {
this.multiFileEditProvider = multiFileEditProvider;
}
+
+ protected void setFileNameChangeProvider(FileNameChangeProvider fileNameChangeProvider) {
+ this.fileNameChangeProvider = fileNameChangeProvider;
+ }
@Override
public String getName() {
@@ -133,7 +142,35 @@
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
+ Change change = createEditChanges();
+
+ Map<String, String> filesToRename = fileNameChangeProvider.getFilesToRename(getAllAffectedFiles(change));
+ if(filesToRename.isEmpty()) {
+ return change;
+ }
+
+ CompositeChange compositeChange = new CompositeChange(getName(), new Change[]{change});
+ compositeChange.markAsSynthetic();
+ for (Map.Entry<String, String> entry : filesToRename.entrySet()) {
+ RenameResourceChange renameResourceChange = new RenameResourceChange(null, RubyPlugin.getWorkspace().getRoot().findMember(entry.getKey()), entry.getValue(), "comment");
+ compositeChange.add(new DynamicValidationStateChange(renameResourceChange));
+ }
+ return compositeChange;
+ }
+
+ private Collection<File> getAllAffectedFiles(Change change) {
+ Collection<File> affectedFiles = new ArrayList<File>();
+ for (Object object : change.getAffectedObjects()) {
+ if (object instanceof File) {
+ affectedFiles.add((File) object);
+ }
+ }
+ return affectedFiles;
+ }
+
+ private Change createEditChanges() {
DocumentProvider docProvider = new WorkspaceDocumentProvider(getActiveFile());
+
if(multiFileEditProvider != null) {
return createMultiFileChange(docProvider);
}
@@ -184,4 +221,8 @@
public IMultiFileEditProvider getMultiFileEditProvider() {
return multiFileEditProvider;
}
+
+ public FileNameChangeProvider getFileNameChangeProvider() {
+ return fileNameChangeProvider != null ? fileNameChangeProvider : new FileNameChangeProvider();
+ }
}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/WorkspaceTracker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/WorkspaceTracker.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/WorkspaceTracker.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,55 @@
+package org.rubypeople.rdt.refactoring.core;
+
+import org.eclipse.core.runtime.ListenerList;
+
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+
+public class WorkspaceTracker {
+
+ public final static WorkspaceTracker INSTANCE= new WorkspaceTracker();
+
+ public interface Listener {
+ public void workspaceChanged();
+ }
+
+ private ListenerList fListeners;
+ private ResourceListener fResourceListener;
+
+ private WorkspaceTracker() {
+ fListeners= new ListenerList();
+ }
+
+ private class ResourceListener implements IResourceChangeListener {
+ public void resourceChanged(IResourceChangeEvent event) {
+ workspaceChanged();
+ }
+ }
+
+ private void workspaceChanged() {
+ Object[] listeners= fListeners.getListeners();
+ for (int i= 0; i < listeners.length; i++) {
+ ((Listener)listeners[i]).workspaceChanged();
+ }
+ }
+
+ public void addListener(Listener l) {
+ fListeners.add(l);
+ if (fResourceListener == null) {
+ fResourceListener= new ResourceListener();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(fResourceListener);
+ }
+ }
+
+ public void removeListener(Listener l) {
+ if (fListeners.size() == 0)
+ return;
+ fListeners.remove(l);
+ if (fListeners.size() == 0) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(fResourceListener);
+ fResourceListener= null;
+ }
+ }
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/messages.properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/messages.properties 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/messages.properties 2007-04-25 10:14:02 UTC (rev 2361)
@@ -1,3 +1,12 @@
RefactoringConditionChecker_SyntaxErrorInProject=There is a syntax error somewhere in the project, the refactoring might not work on these files.
RefactoringConditionChecker_EmptyDocument=Nothing to do in empty document.
RefactoringConditionChecker_SyntaxErrorInCurrent=There is a syntax error in the current file, refactoring is not possible.
+RenameResourceChange_rename_resource=rename resource
+RenameResourceChange_name=Rename ''{0}'' to: ''{1}''
+RenameResourceChange_does_not_exist=''{0}'' does not exist
+Change_is_unsaved={0} is unsaved.
+Change_is_read_only={0} is read only.
+Change_has_modifications={0} has been modified since the refactoring got executed.
+Change_does_not_exist=''{0}'' does not exist anymore.
+Change_same_read_only= The read only state of {0} has changed.
+DynamicValidationStateChange_workspace_changed=The workspace has been modified since the refactoring change object has been created
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/rename/RenameRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/rename/RenameRefactoring.java 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/rename/RenameRefactoring.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -68,6 +68,7 @@
setName(delegateRenameRefactoring.getName());
setEditProvider(delegateRenameRefactoring.getMultiFileEditProvider());
setEditProvider(delegateRenameRefactoring.getEditProvider());
+ setFileNameChangeProvider(delegateRenameRefactoring.getFileNameChangeProvider());
for(IWizardPage aktPage : delegateRenameRefactoring.getPages()) {
pages.add(aktPage);
}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassFileNameChangeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassFileNameChangeProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassFileNameChangeProvider.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,31 @@
+package org.rubypeople.rdt.refactoring.core.renameclass;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.internal.resources.File;
+import org.rubypeople.rdt.refactoring.editprovider.FileNameChangeProvider;
+
+public class RenameClassFileNameChangeProvider extends FileNameChangeProvider {
+
+ private final RenameClassConfig config;
+
+ public RenameClassFileNameChangeProvider(RenameClassConfig renameClassConfig) {
+ this.config = renameClassConfig;
+ }
+
+ @Override
+ public Map<String, String> getFilesToRename(Collection<File> objects) {
+ HashMap<String, String> filesToRename = new HashMap<String, String>();
+ for (File file : objects) {
+ String name = file.getName();
+ name = name.replaceAll("\\." + file.getFileExtension() + "$", "");
+ if(name.equals(config.getSelectedNode().getCPath().getName())) {
+ filesToRename.put(file.getFullPath().toString(), config.getNewName() + ".rb");
+ }
+ }
+ return filesToRename;
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassRefactoring.java 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassRefactoring.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -48,7 +48,7 @@
if(conditionChecker.shouldPerform()) {
RenameClassEditProvider editProvider = new RenameClassEditProvider(renameClassConfig);
setEditProvider(editProvider);
-
+ setFileNameChangeProvider(new RenameClassFileNameChangeProvider(renameClassConfig));
pages.add(new RenamePage(NAME, renameClassConfig.getSelectedNode().getCPath().getName(),
new NewNameListener(renameClassConfig, new ConstNameValidator(), new ArrayList<String>())));
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/editprovider/FileNameChangeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/editprovider/FileNameChangeProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/editprovider/FileNameChangeProvider.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -0,0 +1,15 @@
+package org.rubypeople.rdt.refactoring.editprovider;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.internal.resources.File;
+
+public class FileNameChangeProvider {
+
+ public Map<String, String> getFilesToRename(Collection<File> objects) {
+ return new HashMap<String, String>();
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IRubyStatusConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IRubyStatusConstants.java 2007-04-21 00:29:10 UTC (rev 2360)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IRubyStatusConstants.java 2007-04-25 10:14:02 UTC (rev 2361)
@@ -22,5 +22,10 @@
// collide with resource and ruby model constants.
public static final int INTERNAL_ERROR= 10001;
-
+
+ /**
+ * Status constant indicating that an validateEdit call has changed the
+ * content of a file on disk.
+ */
+ public static final int VALIDATE_EDIT_CHANGED_CONTENT= 10003;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-21 00:29:12
|
Revision: 2360
http://svn.sourceforge.net/rubyeclipse/?rev=2360&view=rev
Author: cawilliams
Date: 2007-04-20 17:29:10 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
wrap the text and use double single-quotes to make them show up
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2007-04-21 00:04:19 UTC (rev 2359)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2007-04-21 00:29:10 UTC (rev 2360)
@@ -167,7 +167,7 @@
DebuggerPreferencePage_description_label=Debugger preferences
DebuggerPreferencePage_useRubyDebug_label=Use ruby-debug library
DebuggerPreferencePage_verboseDebugger_label=Debugger verbose mode
-DebuggerPreferencePage_useRubyDebug_comment=In order to use ruby-debug you have to install the gem ruby-debug-ide, version 0.1 is compatible with this release of RDT. You should always take the latest service release (currently being 0.1.2)\nFor the installation you usually have to enter 'gem install ruby-debug-ide'
+DebuggerPreferencePage_useRubyDebug_comment=In order to use ruby-debug you have to install the gem ruby-debug-ide,\n version 0.1 is compatible with this release of RDT.\nYou should always take the latest service release (currently being 0.1.2)\nFor the installation you usually have to enter ''gem install ruby-debug-ide''
PropertyAndPreferencePage_useprojectsettings_label=Enable pr&oject specific settings
PropertyAndPreferencePage_useworkspacesettings_change=Configure Workspace Settings...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-21 00:04:21
|
Revision: 2359
http://svn.sourceforge.net/rubyeclipse/?rev=2359&view=rev
Author: cawilliams
Date: 2007-04-20 17:04:19 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
remove debug output spit out to console
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/AbstractInspectAction.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/AbstractInspectAction.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/AbstractInspectAction.java 2007-04-21 00:03:40 UTC (rev 2358)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/AbstractInspectAction.java 2007-04-21 00:04:19 UTC (rev 2359)
@@ -25,7 +25,7 @@
protected IWorkbenchPage page;
public void init(IViewPart view) {
- System.out.println("view:" + view) ;
+// System.out.println("view:" + view) ;
page = view.getSite().getPage() ;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-21 00:03:41
|
Revision: 2358
http://svn.sourceforge.net/rubyeclipse/?rev=2358&view=rev
Author: cawilliams
Date: 2007-04-20 17:03:40 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
modify how we construct the executable. Instead of returning a string, we return a list of strings. This lets us hack it for ruby-debug so we can invoke ruby on the generic ruby-debug-ide command.
using the ruby-debug-ide.cmd file on windows led us to have a orphaned ruby process that wasn't terminated (terminate would kill cmd.exe). So now on Win32 we can forcibly terminate a ruby-debug session running rails and then continue to relaunch in debug mode! hurray!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-04-20 23:56:02 UTC (rev 2357)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-04-21 00:03:40 UTC (rev 2358)
@@ -19,30 +19,17 @@
private static final String PORT_SWITCH = "--port";
private static final String VERBOSE_FLAG = "-d";
- private static final String RDEBUG_EXECUTABLE_WINDOWS = "rdebug-ide.cmd";
private static final String RDEBUG_EXECUTABLE = "rdebug-ide";
public RDebugVMDebugger(IVMInstall vmInstance) {
super(vmInstance);
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.rubypeople.rdt.launching.IVMRunner#run(org.rubypeople.rdt.launching.VMRunnerConfiguration,
- * org.eclipse.debug.core.ILaunch,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(VMRunnerConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
- // Set it up to use rdebug executable
- Map map = config.getVMSpecificAttributesMap();
- if (map == null) map = new HashMap();
- String executable = findRDebugExecutable(fVMInstance.getInstallLocation());
- map.put(IRubyLaunchConfigurationConstants.ATTR_RUBY_COMMAND, executable);
- config.setVMSpecificAttributesMap(map);
-
- super.run(config, launch, monitor);
+
+ @Override
+ protected List<String> constructProgramString(VMRunnerConfiguration config) throws CoreException {
+ List<String> string = super.constructProgramString(config);
+ string.add(findRDebugExecutable(fVMInstance.getInstallLocation()));
+ return string;
}
protected List<String> debugSpecificVMArgs(RubyDebugTarget debugTarget) {
@@ -60,13 +47,7 @@
}
public static String findRDebugExecutable(File vmInstallLocation) {
- // see StandardVMRunner.constructProgramString
- String cmdWin = RDEBUG_EXECUTABLE_WINDOWS;
- String path = vmInstallLocation + File.separator + "bin" + File.separator + cmdWin;
- if (new File(path).exists()) {
- return cmdWin;
- }
- return RDEBUG_EXECUTABLE;
+ return vmInstallLocation + File.separator + "bin" + File.separator + RDEBUG_EXECUTABLE;
}
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-04-20 23:56:02 UTC (rev 2357)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-04-21 00:03:40 UTC (rev 2358)
@@ -63,9 +63,8 @@
subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Constructing_command_line____3);
RubyDebugTarget debugTarget = new RubyDebugTarget(launch, port);
- String program = constructProgramString(config);
- List<String> arguments = new ArrayList<String>(12);
- arguments.add(program);
+ List<String> arguments = constructProgramString(config);
+// arguments.add(program);
// VM args are the first thing after the ruby program so that users can
// specify
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-04-20 23:56:02 UTC (rev 2357)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-04-21 00:03:40 UTC (rev 2358)
@@ -125,7 +125,8 @@
* @return full path to ruby executable
* @exception CoreException if unable to locate an executeable
*/
- protected String constructProgramString(VMRunnerConfiguration config) throws CoreException {
+ protected List<String> constructProgramString(VMRunnerConfiguration config) throws CoreException {
+ List<String> string = new ArrayList<String>();
// Look for the user-specified ruby executable command
String command= null;
Map map= config.getVMSpecificAttributesMap();
@@ -139,18 +140,21 @@
if (exe == null) {
abort(MessageFormat.format(LaunchingMessages.StandardVMRunner_Unable_to_locate_executable_for__0__1, fVMInstance.getName()), null, IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
- return exe.getAbsolutePath();
+ string.add(exe.getAbsolutePath());
+ return string;
}
// Build the path to the ruby executable. First try 'bin'
String installLocation = fVMInstance.getInstallLocation().getAbsolutePath() + File.separatorChar;
File exe = new File(installLocation + "bin" + File.separatorChar + command); //$NON-NLS-1$
if (fileExists(exe)){
- return exe.getAbsolutePath();
+ string.add(exe.getAbsolutePath());
+ return string;
}
exe = new File(exe.getAbsolutePath() + ".exe"); //$NON-NLS-1$
if (fileExists(exe)){
- return exe.getAbsolutePath();
+ string.add(exe.getAbsolutePath());
+ return string;
}
// not found
@@ -186,10 +190,8 @@
subMonitor.beginTask(LaunchingMessages.StandardVMRunner_Launching_VM____1, 2);
subMonitor.subTask(LaunchingMessages.StandardVMRunner_Constructing_command_line____2);
- String program= constructProgramString(config);
- List<String> arguments= new ArrayList<String>();
- arguments.add(program);
+ List<String> arguments= constructProgramString(config);
// VM args are the first thing after the ruby program so that users can specify
// options like '-client' & '-server' which are required to be the first option
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 23:56:04
|
Revision: 2357
http://svn.sourceforge.net/rubyeclipse/?rev=2357&view=rev
Author: cawilliams
Date: 2007-04-20 16:56:02 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
comment out printing debug stuff to command line
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java 2007-04-20 23:54:29 UTC (rev 2356)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java 2007-04-20 23:56:02 UTC (rev 2357)
@@ -97,7 +97,7 @@
}
private synchronized void findReaderForTag() throws XmlStreamReaderException {
- System.out.println("There are no threads:" + threads.size()) ;
+// System.out.println("There are no threads:" + threads.size()) ;
for (XmlStreamReader streamReader : threads.keySet()) {
if (streamReader.processStartElement(xpp)) {
currentReader = streamReader;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 23:54:31
|
Revision: 2356
http://svn.sourceforge.net/rubyeclipse/?rev=2356&view=rev
Author: cawilliams
Date: 2007-04-20 16:54:29 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
fix translation strings and keys
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties 2007-04-20 23:54:18 UTC (rev 2355)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties 2007-04-20 23:54:29 UTC (rev 2356)
@@ -531,35 +531,41 @@
NewSourceFolderDialog_usefolder_button=&Folder as source folder
NewSourceFolderDialog_sourcefolder_label=&Source folder name:
-JavaProjectWizardFirstPage_NameGroup_label_text=&Project name:
-JavaProjectWizardFirstPage_LocationGroup_title=Contents
-JavaProjectWizardFirstPage_LocationGroup_external_desc=Create project from e&xisting source
-JavaProjectWizardFirstPage_JREGroup_default_compliance=Use def&ault JRE (Currently ''{0}'')
-JavaProjectWizardFirstPage_LocationGroup_workspace_desc=Create new project in &workspace
-JavaProjectWizardFirstPage_LocationGroup_locationLabel_desc=&Directory:
-JavaProjectWizardFirstPage_LocationGroup_browseButton_desc=B&rowse...
-JavaProjectWizardFirstPage_LayoutGroup_title=Project layout
-JavaProjectWizardFirstPage_LayoutGroup_option_separateFolders=&Create separate source and output folders
-JavaProjectWizardFirstPage_LayoutGroup_option_oneFolder=&Use project folder as root for sources and class files
-JavaProjectWizardFirstPage_LayoutGroup_link_description=<a>Configure d&efault...</a>
-JavaProjectWizardFirstPage_LayoutGroup_configure=C&onfigure Defaults...
-JavaProjectWizardFirstPage_DetectGroup_message=The specified external location already exists. If a project is created in this location, the wizard will automatically try to detect existing sources and class files and configure the classpath appropriately.
-JavaProjectWizardFirstPage_DetectGroup_jre_message=Using a {1} JRE with compiler compliance level {0} is not recommended. <a>Configure compliance...</a>
-JavaProjectWizardFirstPage_Message_enterProjectName=Enter a project name.
-JavaProjectWizardFirstPage_Message_projectAlreadyExists=A project with this name already exists.
-JavaProjectWizardFirstPage_JREGroup_specific_compliance=U&se a project specific JRE:
-JavaProjectWizardFirstPage_Message_enterLocation=Enter a location for the project.
-JavaProjectWizardFirstPage_JREGroup_compliance_13=1.3
-JavaProjectWizardFirstPage_JREGroup_compliance_14=1.4
-JavaProjectWizardFirstPage_JREGroup_compliance_50=5.0
-JavaProjectWizardFirstPage_Message_invalidDirectory=Invalid project contents directory
-JavaProjectWizardFirstPage_JREGroup_link_description=<a>C&onfigure JREs...</a>
-JavaProjectWizardFirstPage_Message_cannotCreateInWorkspace=Cannot create project content in workspace.
-JavaProjectWizardFirstPage_page_pageName=SimpleProjectFirstPage
-JavaProjectWizardFirstPage_JREGroup_title=JRE
-JavaProjectWizardFirstPage_page_title=Create a Java project
-JavaProjectWizardFirstPage_page_description=Create a Java project in the workspace or in an external location.
+# ------- RubyProjectWizard -------
+RubyProjectWizard_title=New Ruby Project
+RubyProjectWizard_op_error_title=Error Creating Ruby Project
+RubyProjectWizard_op_error_create_message=An error occurred while creating the Ruby project
+
+RubyProjectWizardFirstPage_NameGroup_label_text=&Project name:
+RubyProjectWizardFirstPage_LocationGroup_title=Contents
+RubyProjectWizardFirstPage_LocationGroup_external_desc=Create project from e&xisting source
+RubyProjectWizardFirstPage_JREGroup_default_compliance=Use def&ault RubyVM (Currently ''{0}'')
+RubyProjectWizardFirstPage_LocationGroup_workspace_desc=Create new project in &workspace
+RubyProjectWizardFirstPage_LocationGroup_locationLabel_desc=&Directory:
+RubyProjectWizardFirstPage_LocationGroup_browseButton_desc=B&rowse...
+RubyProjectWizardFirstPage_LayoutGroup_title=Project layout
+RubyProjectWizardFirstPage_LayoutGroup_option_separateFolders=&Create separate source and output folders
+RubyProjectWizardFirstPage_LayoutGroup_option_oneFolder=&Use project folder as root for sources
+RubyProjectWizardFirstPage_LayoutGroup_link_description=<a>Configure d&efault...</a>
+RubyProjectWizardFirstPage_LayoutGroup_configure=C&onfigure Defaults...
+RubyProjectWizardFirstPage_DetectGroup_message=The specified external location already exists. If a project is created in this location, the wizard will automatically try to detect existing sources and class files and configure the classpath appropriately.
+RubyProjectWizardFirstPage_DetectGroup_jre_message=Using a {1} JRE with compiler compliance level {0} is not recommended. <a>Configure compliance...</a>
+RubyProjectWizardFirstPage_Message_enterProjectName=Enter a project name.
+RubyProjectWizardFirstPage_Message_projectAlreadyExists=A project with this name already exists.
+RubyProjectWizardFirstPage_JREGroup_specific_compliance=U&se a project specific Ruby VM:
+RubyProjectWizardFirstPage_Message_enterLocation=Enter a location for the project.
+RubyProjectWizardFirstPage_JREGroup_compliance_13=1.3
+RubyProjectWizardFirstPage_JREGroup_compliance_14=1.4
+RubyProjectWizardFirstPage_JREGroup_compliance_50=5.0
+RubyProjectWizardFirstPage_Message_invalidDirectory=Invalid project contents directory
+RubyProjectWizardFirstPage_JREGroup_link_description=<a>C&onfigure Ruby VMs...</a>
+RubyProjectWizardFirstPage_Message_cannotCreateInWorkspace=Cannot create project content in workspace.
+RubyProjectWizardFirstPage_page_pageName=SimpleProjectFirstPage
+RubyProjectWizardFirstPage_JREGroup_title=Ruby VM
+RubyProjectWizardFirstPage_page_title=Create a Ruby project
+RubyProjectWizardFirstPage_page_description=Create a Ruby project in the workspace or in an external location.
+
# ------- HintTextGroup -------
HintTextGroup_Exception_Title=Error Caused by Operation ''{0}''
HintTextGroup_Exception_Title_refresh=Error while Refreshing the Tree
@@ -815,17 +821,17 @@
ClasspathModifierQueries_confirm_remove_linked_folder_label=Java Build Path
ClasspathModifierQueries_confirm_remove_linked_folder_message=Are you sure you want to remove folder ''{0}'' from the build path?
-JavaProjectWizardSecondPage_error_title=New Java project
-JavaProjectWizardSecondPage_error_message=An error occurred while creating project. Check log for details.
-JavaProjectWizardSecondPage_problem_backup=Problem while creating backup for ''{0}''
-JavaProjectWizardSecondPage_operation_initialize=Initializing project...
-JavaProjectWizardSecondPage_operation_create=Creating project...
-JavaProjectWizardSecondPage_operation_remove=Removing project...
-JavaProjectWizardSecondPage_error_remove_title=Error Creating Java Project
-JavaProjectWizardSecondPage_error_remove_message=An error occurred while removing a temporary project.
-JavaProjectWizardSecondPage_problem_restore_project=Problem while restoring backup for .project
-JavaProjectWizardSecondPage_problem_restore_classpath=Problem while restoring backup for .classpath
-JavaProjectWizardFirstPage_directory_message=Choose a directory for the project contents:
+RubyProjectWizardSecondPage_error_title=New Java project
+RubyProjectWizardSecondPage_error_message=An error occurred while creating project. Check log for details.
+RubyProjectWizardSecondPage_problem_backup=Problem while creating backup for ''{0}''
+RubyProjectWizardSecondPage_operation_initialize=Initializing project...
+RubyProjectWizardSecondPage_operation_create=Creating project...
+RubyProjectWizardSecondPage_operation_remove=Removing project...
+RubyProjectWizardSecondPage_error_remove_title=Error Creating Java Project
+RubyProjectWizardSecondPage_error_remove_message=An error occurred while removing a temporary project.
+RubyProjectWizardSecondPage_problem_restore_project=Problem while restoring backup for .project
+RubyProjectWizardSecondPage_problem_restore_classpath=Problem while restoring backup for .classpath
+RubyProjectWizardFirstPage_directory_message=Choose a directory for the project contents:
UserLibraryWizardPage_title=User Library
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 23:54:20
|
Revision: 2355
http://svn.sourceforge.net/rubyeclipse/?rev=2355&view=rev
Author: cawilliams
Date: 2007-04-20 16:54:18 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
remove unused button
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardFirstPage.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardFirstPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardFirstPage.java 2007-04-20 23:27:55 UTC (rev 2354)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardFirstPage.java 2007-04-20 23:54:18 UTC (rev 2355)
@@ -261,7 +261,7 @@
*/
private final class LayoutGroup implements Observer, SelectionListener {
- private final SelectionButtonDialogField fStdRadio, fSrcBinRadio;
+ private final SelectionButtonDialogField fStdRadio;
private final Group fGroup;
private final Link fPreferenceLink;
@@ -276,14 +276,9 @@
fStdRadio= new SelectionButtonDialogField(SWT.RADIO);
fStdRadio.setLabelText(NewWizardMessages.RubyProjectWizardFirstPage_LayoutGroup_option_oneFolder);
- fSrcBinRadio= new SelectionButtonDialogField(SWT.RADIO);
- fSrcBinRadio.setLabelText(NewWizardMessages.RubyProjectWizardFirstPage_LayoutGroup_option_separateFolders);
-
fStdRadio.doFillIntoGrid(fGroup, 3);
LayoutUtil.setHorizontalGrabbing(fStdRadio.getSelectionButton(null));
-
- fSrcBinRadio.doFillIntoGrid(fGroup, 2);
-
+
fPreferenceLink= new Link(fGroup, SWT.NONE);
fPreferenceLink.setText(NewWizardMessages.RubyProjectWizardFirstPage_LayoutGroup_link_description);
fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.END, false, false));
@@ -291,20 +286,19 @@
// boolean useSrcBin= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ);
boolean useSrcBin= false;
- fSrcBinRadio.setSelection(useSrcBin);
fStdRadio.setSelection(!useSrcBin);
}
public void update(Observable o, Object arg) {
final boolean detect= fDetectGroup.mustDetect();
fStdRadio.setEnabled(!detect);
- fSrcBinRadio.setEnabled(!detect);
+// fSrcBinRadio.setEnabled(!detect);
fPreferenceLink.setEnabled(!detect);
fGroup.setEnabled(!detect);
}
public boolean isSrcBin() {
- return fSrcBinRadio.isSelected();
+ return false;
}
/* (non-Rubydoc)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 23:27:59
|
Revision: 2354
http://svn.sourceforge.net/rubyeclipse/?rev=2354&view=rev
Author: cawilliams
Date: 2007-04-20 16:27:55 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
include icons we need
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/add_as_source_folder.gif
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/add_to_buildpath.gif
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/exclude_from_buildpath.gif
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/exclusion_filter_attrib.gif
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/include_on_buildpath.gif
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/inclusion_filter_attrib.gif
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/remove_as_source_folder.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/add_as_source_folder.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/exclude_from_buildpath.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/exclusion_filter_attrib.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/include_on_buildpath.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/inclusion_filter_attrib.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/remove_as_source_folder.gif
trunk/org.rubypeople.rdt.ui/icons/full/obj16/envvar_obj.gif
trunk/org.rubypeople.rdt.ui/icons/full/obj16/exclusion_filter_attrib.gif
trunk/org.rubypeople.rdt.ui/icons/full/obj16/inclusion_filter_attrib.gif
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/add_as_source_folder.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/add_as_source_folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/add_to_buildpath.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/add_to_buildpath.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/exclude_from_buildpath.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/exclude_from_buildpath.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/exclusion_filter_attrib.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/exclusion_filter_attrib.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/include_on_buildpath.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/include_on_buildpath.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/inclusion_filter_attrib.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/inclusion_filter_attrib.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/remove_as_source_folder.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/remove_as_source_folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/add_as_source_folder.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/add_as_source_folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/exclude_from_buildpath.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/exclude_from_buildpath.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/exclusion_filter_attrib.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/exclusion_filter_attrib.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/include_on_buildpath.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/include_on_buildpath.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/inclusion_filter_attrib.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/inclusion_filter_attrib.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/remove_as_source_folder.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/remove_as_source_folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/envvar_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/envvar_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/exclusion_filter_attrib.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/exclusion_filter_attrib.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/inclusion_filter_attrib.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/inclusion_filter_attrib.gif
___________________________________________________________________
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-04-20 23:27:43
|
Revision: 2353
http://svn.sourceforge.net/rubyeclipse/?rev=2353&view=rev
Author: cawilliams
Date: 2007-04-20 16:27:42 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
remove button that shouldn't be there
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java 2007-04-20 22:54:48 UTC (rev 2352)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java 2007-04-20 23:27:42 UTC (rev 2353)
@@ -74,17 +74,15 @@
private Control fSWTControl;
- private final int IDX_ADDFOL= 0;
- private final int IDX_ADDEXT= 1;
- private final int IDX_EDIT= 3;
- private final int IDX_REMOVE= 4;
+ private final int IDX_ADDEXT= 0;
+ private final int IDX_EDIT= 2;
+ private final int IDX_REMOVE= 3;
public LibrariesWorkbookPage(CheckedListDialogField classPathList, IWorkbenchPreferenceContainer pageContainer) {
fClassPathList= classPathList;
fSWTControl= null;
String[] buttonLabels= new String[] {
- NewWizardMessages.LibrariesWorkbookPage_libraries_addclassfolder_button,
NewWizardMessages.LibrariesWorkbookPage_libraries_addextjar_button,
/* */ null,
NewWizardMessages.LibrariesWorkbookPage_libraries_edit_button,
@@ -200,10 +198,7 @@
private void libaryPageCustomButtonPressed(DialogField field, int index) {
CPListElement[] libentries= null;
- switch (index) {
- case IDX_ADDFOL: /* add (internal) folder */
- libentries= openScriptFolderDialog(null);
- break;
+ switch (index) {
case IDX_ADDEXT: /* add external folder */
libentries= openExtFolderDialog(null);
break;
@@ -226,9 +221,6 @@
elementsToAdd.add(curr);
}
}
- if (!elementsToAdd.isEmpty() && (index == IDX_ADDFOL)) {
- askForAddingExclusionPatternsDialog(elementsToAdd);
- }
fLibrariesList.addElements(elementsToAdd);
fLibrariesList.postSetSelection(new StructuredSelection(libentries));
@@ -262,17 +254,6 @@
fLibrariesList.postSetSelection(new StructuredSelection(element));
}
- private void askForAddingExclusionPatternsDialog(List newEntries) {
- HashSet modified= new HashSet();
- List existing= fClassPathList.getElements();
- fixNestingConflicts((CPListElement[])newEntries.toArray(new CPListElement[newEntries.size()]), (CPListElement[])existing.toArray(new CPListElement[existing.size()]), modified);
- if (!modified.isEmpty()) {
- String title= NewWizardMessages.LibrariesWorkbookPage_exclusion_added_title;
- String message= NewWizardMessages.LibrariesWorkbookPage_exclusion_added_message;
- MessageDialog.openInformation(getShell(), title, message);
- }
- }
-
protected void libaryPageDoubleClicked(TreeListDialogField field) {
List selection= fLibrariesList.getSelectedElements();
if (canEdit(selection)) {
@@ -424,9 +405,6 @@
List selElements= fLibrariesList.getSelectedElements();
fLibrariesList.enableButton(IDX_EDIT, canEdit(selElements));
fLibrariesList.enableButton(IDX_REMOVE, canRemove(selElements));
-
- boolean noAttributes= containsOnlyTopLevelEntries(selElements);
- fLibrariesList.enableButton(IDX_ADDFOL, noAttributes);
}
private boolean canEdit(List selElements) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 22:54:50
|
Revision: 2352
http://svn.sourceforge.net/rubyeclipse/?rev=2352&view=rev
Author: cawilliams
Date: 2007-04-20 15:54:48 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
more build/load path support
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/AddSelectedSourceFolderOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/CreateFolderOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/EditFiltersOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ExcludeOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ILoadpathInformationProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/IPackageExplorerActionListener.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LinkedSourceFolderOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LoadpathModifier.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/PackageExplorerActionEvent.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/RemoveFromLoadpathOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ResetAllOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/UnexcludeOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/LoadPathContainer.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackagesMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/AddSourceFolderWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/AddSourceFolderWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/BuildPathBasePage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/BuildPathSupport.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/BuildPathWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElement.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElementAttribute.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElementSorter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListLabelProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPUserLibraryElement.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CreateMultipleSourceFoldersDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditFilterWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/ExclusionInclusionDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/ExclusionInclusionEntryDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/FolderSelectionDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LoadpathContainerDefaultPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LoadpathContainerDescriptor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LoadpathContainerSelectionPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LoadpathContainerWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LoadpathOrderingWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/MultipleFolderSelectionDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/NewContainerDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/ProjectsWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/SetFilterWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/SourceContainerWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/workingsets/OthersWorkingSetUpdater.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/workingsets/WorkingSetMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/workingsets/WorkingSetModel.java
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/AddSelectedSourceFolderOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/AddSelectedSourceFolderOperation.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/AddSelectedSourceFolderOperation.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,149 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * Copyright (c) 2000, 2005 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.buildpath;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.corext.buildpath.LoadpathModifier.ILoadpathModifierListener;
+import org.rubypeople.rdt.internal.corext.util.Messages;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierOperation;
+
+
+/**
+ * Operation to add objects (of type <code>IFolder</code> or <code>
+ * IRubyElement</code> as source folder to the classpath.
+ *
+ * @see org.eclipse.jdt.internal.corext.buildpath.LoadpathModifier#addToLoadpath(List, IRubyProject, OutputFolderQuery, IProgressMonitor)
+ * @see org.eclipse.jdt.internal.corext.buildpath.RemoveFromLoadpathOperation
+ */
+public class AddSelectedSourceFolderOperation extends LoadpathModifierOperation {
+
+ /**
+ * Constructor
+ *
+ * @param listener a <code>ILoadpathModifierListener</code> that is notified about
+ * changes on classpath entries or <code>null</code> if no such notification is
+ * necessary.
+ * @param informationProvider a provider to offer information to the action
+ *
+ * @see ILoadpathInformationProvider
+ * @see LoadpathModifier
+ */
+ public AddSelectedSourceFolderOperation(ILoadpathModifierListener listener, ILoadpathInformationProvider informationProvider) {
+ super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_tooltip, ILoadpathInformationProvider.ADD_SEL_SF_TO_BP);
+ }
+
+ /**
+ * Method which runs the actions with a progress monitor.<br>
+ *
+ * This operation requires the following query from the provider:
+ * <li>IOutputFolderQuery</li>
+ *
+ * @param monitor a progress monitor, can be <code>null</code>
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ List result= null;
+ fException= null;
+ try {
+ List elements= getSelectedElements();
+ IRubyProject project= fInformationProvider.getRubyProject();
+ result= addToLoadpath(elements, project, monitor);
+ } catch (CoreException e) {
+ fException= e;
+ result= null;
+ }
+ super.handleResult(result, monitor);
+ }
+
+ /**
+ * Find out whether this operation can be executed on
+ * the provided list of elements.
+ *
+ * @param elements a list of elements
+ * @param types an array of types for each element, that is,
+ * the type at position 'i' belongs to the selected element
+ * at position 'i'
+ *
+ * @return <code>true</code> if the operation can be
+ * executed on the provided list of elements, <code>
+ * false</code> otherwise.
+ * @throws RubyModelException
+ */
+ public boolean isValid(List elements, int[] types) throws RubyModelException {
+ if (elements.size() == 0)
+ return false;
+ for (int i= 0; i < elements.size(); i++) {
+ Object object= elements.get(i);
+ switch (types[i]) {
+ case DialogPackageExplorerActionGroup.RUBY_PROJECT: if (isSourceFolder((IRubyProject) object)) return false; break;
+ case DialogPackageExplorerActionGroup.SOURCE_FOLDER: break; // is ok
+ case DialogPackageExplorerActionGroup.INCLUDED_FOLDER: break; // is ok
+ case DialogPackageExplorerActionGroup.FOLDER: break; // is ok
+ case DialogPackageExplorerActionGroup.EXCLUDED_FOLDER: break; // is ok
+ default: return false; // all others are not ok
+ }
+
+ }
+ return true;
+ }
+
+ /**
+ * Get a description for this operation. The description depends on
+ * the provided type parameter, which must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>. If the type is
+ * <code>DialogPackageExplorerActionGroup.MULTI</code>, then the
+ * description will be very general to describe the situation of
+ * all the different selected objects as good as possible.
+ *
+ * @param type the type of the selected object, must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>.
+ * @return a string describing the operation
+ */
+ public String getDescription(int type) {
+ Object obj= getSelectedElements().get(0);
+ if (obj instanceof IRubyElement) {
+ String name= escapeSpecialChars(((IRubyElement) obj).getElementName());
+ if (type == DialogPackageExplorerActionGroup.RUBY_PROJECT)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ProjectToBuildpath, name);
+ if (type == DialogPackageExplorerActionGroup.SOURCE_FOLDER)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_PackageToBuildpath, name);
+ if (type == DialogPackageExplorerActionGroup.MODIFIED_FRAGMENT_ROOT)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_PackageToBuildpath, name);
+ } else if (obj instanceof IResource) {
+ String name= escapeSpecialChars(((IResource) obj).getName());
+ if (type == DialogPackageExplorerActionGroup.FOLDER)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_FolderToBuildpath, name);
+ if (type == DialogPackageExplorerActionGroup.EXCLUDED_FOLDER)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_FolderToBuildpath, name);
+ }
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_toBuildpath;
+ }
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/CreateFolderOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/CreateFolderOperation.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/CreateFolderOperation.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,103 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * 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.buildpath;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierOperation;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.GenerateBuildPathActionGroup.CreateLocalSourceFolderAction;
+
+public class CreateFolderOperation extends LoadpathModifierOperation {
+
+ private final ILoadpathModifierListener fListener;
+ private final ILoadpathInformationProvider fCPInformationProvider;
+
+ /**
+ * Creates a new <code>AddFolderOperation</code>.
+ *
+ * @param listener a <code>ILoadpathModifierListener</code> that is notified about
+ * changes on classpath entries or <code>null</code> if no such notification is
+ * necessary.
+ * @param informationProvider a provider to offer information to the action
+ *
+ * @see ILoadpathInformationProvider
+ * @see LoadpathModifier
+ */
+ public CreateFolderOperation(ILoadpathModifierListener listener, ILoadpathInformationProvider informationProvider) {
+ super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip, ILoadpathInformationProvider.CREATE_FOLDER);
+ fListener= listener;
+ fCPInformationProvider= informationProvider;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ CreateLocalSourceFolderAction action= new CreateLocalSourceFolderAction();
+ action.selectionChanged(new StructuredSelection(fCPInformationProvider.getRubyProject()));
+ action.run();
+ ISourceFolderRoot createdElement= (ISourceFolderRoot)action.getCreatedElement();
+ if (createdElement == null) {
+ //Wizard was cancled.
+ return;
+ }
+ try {
+ IResource correspondingResource= createdElement.getCorrespondingResource();
+ List result= new ArrayList();
+ result.add(correspondingResource);
+ if (fListener != null) {
+ List entries= action.getCPListElements();
+ fListener.classpathEntryChanged(entries);
+ }
+ fCPInformationProvider.handleResult(result, null, ILoadpathInformationProvider.CREATE_FOLDER);
+ } catch (RubyModelException e) {
+ if (monitor == null) {
+ fCPInformationProvider.handleResult(Collections.EMPTY_LIST, e, ILoadpathInformationProvider.CREATE_FOLDER);
+ } else {
+ throw new InvocationTargetException(e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isValid(List elements, int[] types) throws RubyModelException {
+ return types.length == 1 && types[0] == DialogPackageExplorerActionGroup.RUBY_PROJECT;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDescription(int type) {
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_createNewSourceFolder;
+ }
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/EditFiltersOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/EditFiltersOperation.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/EditFiltersOperation.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,142 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * Copyright (c) 2000, 2005 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.buildpath;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierOperation;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.GenerateBuildPathActionGroup.EditFilterAction;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierQueries.IInclusionExclusionQuery;
+
+/**
+ * Operation to edit the inclusion / exclusion filters of an
+ * <code>IRubyElement</code>.
+ *
+ * @see org.eclipse.jdt.internal.corext.buildpath.LoadpathModifier#editFilters(IRubyElement, IRubyProject, IInclusionExclusionQuery, IProgressMonitor)
+ */
+public class EditFiltersOperation extends LoadpathModifierOperation {
+
+ private final ILoadpathInformationProvider fCPInformationProvider;
+ private final ILoadpathModifierListener fListener;
+
+ /**
+ * Constructor
+ *
+ * @param listener a <code>ILoadpathModifierListener</code> that is notified about
+ * changes on classpath entries or <code>null</code> if no such notification is
+ * necessary.
+ * @param informationProvider a provider to offer information to the action
+ *
+ * @see ILoadpathInformationProvider
+ * @see LoadpathModifier
+ */
+ public EditFiltersOperation(ILoadpathModifierListener listener, ILoadpathInformationProvider informationProvider) {
+ super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip, ILoadpathInformationProvider.EDIT_FILTERS);
+ fListener= listener;
+ fCPInformationProvider= informationProvider;
+
+ }
+
+ /**
+ * Method which runs the actions with a progress monitor.<br>
+ *
+ * This operation requires the following query:
+ * <li>IInclusionExclusionQuery</li>
+ *
+ * @param monitor a progress monitor, can be <code>null</code>
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ EditFilterAction action= new EditFilterAction();
+ IStructuredSelection selection= fCPInformationProvider.getSelection();
+ Object firstElement= selection.getFirstElement();
+ action.selectionChanged(selection);
+ action.run();
+ List l= new ArrayList();
+ l.add(firstElement);
+ if (fListener != null) {
+ List entries= action.getCPListElements();
+ fListener.classpathEntryChanged(entries);
+ }
+ fCPInformationProvider.handleResult(l, null, ILoadpathInformationProvider.EDIT_FILTERS);
+ }
+
+ /**
+ * Find out whether this operation can be executed on
+ * the provided list of elements.
+ *
+ * @param elements a list of elements
+ * @param types an array of types for each element, that is,
+ * the type at position 'i' belongs to the selected element
+ * at position 'i'
+ *
+ * @return <code>true</code> if the operation can be
+ * executed on the provided list of elements, <code>
+ * false</code> otherwise.
+ * @throws RubyModelException
+ */
+ public boolean isValid(List elements, int[] types) throws RubyModelException {
+ if (elements.size() != 1)
+ return false;
+ IRubyProject project= fInformationProvider.getRubyProject();
+ Object element= elements.get(0);
+
+ if (element instanceof IRubyProject) {
+ if (isSourceFolder(project))
+ return true;
+ } else if (element instanceof ISourceFolderRoot) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get a description for this operation. The description depends on
+ * the provided type parameter, which must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>. If the type is
+ * <code>DialogPackageExplorerActionGroup.MULTI</code>, then the
+ * description will be very general to describe the situation of
+ * all the different selected objects as good as possible.
+ *
+ * @param type the type of the selected object, must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>.
+ * @return a string describing the operation
+ */
+ public String getDescription(int type) {
+ if (type == DialogPackageExplorerActionGroup.RUBY_PROJECT)
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_Edit;
+ if (type == DialogPackageExplorerActionGroup.SOURCE_FOLDER_ROOT)
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_Edit;
+ if (type == DialogPackageExplorerActionGroup.MODIFIED_FRAGMENT_ROOT)
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_Edit;
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_Edit;
+ }
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ExcludeOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ExcludeOperation.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ExcludeOperation.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,137 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * Copyright (c) 2000, 2005 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.buildpath;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.buildpath.LoadpathModifier.ILoadpathModifierListener;
+import org.rubypeople.rdt.internal.corext.util.Messages;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierOperation;
+
+
+/**
+ * Operation to exclude objects of type <code>IRubyElement</code>.
+ *
+ * @see org.eclipse.jdt.internal.corext.buildpath.LoadpathModifier#exclude(List, IRubyProject, IProgressMonitor)
+ * @see org.eclipse.jdt.internal.corext.buildpath.UnexcludeOperation
+ */
+public class ExcludeOperation extends LoadpathModifierOperation {
+
+ /**
+ * Constructor
+ *
+ * @param listener a <code>ILoadpathModifierListener</code> that is notified about
+ * changes on classpath entries or <code>null</code> if no such notification is
+ * necessary.
+ * @param informationProvider a provider to offer information to the operation
+ *
+ * @see ILoadpathInformationProvider
+ * @see LoadpathModifier
+ */
+ public ExcludeOperation(ILoadpathModifierListener listener, ILoadpathInformationProvider informationProvider) {
+ super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Exclude_tooltip, ILoadpathInformationProvider.EXCLUDE);
+ }
+
+ /**
+ * Method which runs the actions with a progress monitor.<br>
+ *
+ * This operation does not require any queries from the provider.
+ *
+ * @param monitor a progress monitor, can be <code>null</code>
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ List result= null;
+ fException= null;
+ try {
+ List javaElements= getSelectedElements();
+ IRubyProject project= fInformationProvider.getRubyProject();
+ result= exclude(javaElements, project, monitor);
+ } catch (CoreException e) {
+ fException= e;
+ result= null;
+ }
+ super.handleResult(result, monitor);
+ }
+
+ /**
+ * Find out whether this operation can be executed on
+ * the provided list of elements.
+ *
+ * @param elements a list of elements
+ * @param types an array of types for each element, that is,
+ * the type at position 'i' belongs to the selected element
+ * at position 'i'
+ *
+ * @return <code>true</code> if the operation can be
+ * executed on the provided list of elements, <code>
+ * false</code> otherwise.
+ * @throws RubyModelException
+ */
+ public boolean isValid(List elements, int[] types) throws RubyModelException {
+ if (elements.size() == 0)
+ return false;
+ for(int i= 0; i < elements.size(); i++) {
+ Object element= elements.get(i);
+ int type= types[i];
+ if (!(type == DialogPackageExplorerActionGroup.SOURCE_FOLDER ||
+ type == DialogPackageExplorerActionGroup.INCLUDED_FOLDER ||
+ element instanceof IRubyScript))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Get a description for this operation. The description depends on
+ * the provided type parameter, which must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>. If the type is
+ * <code>DialogPackageExplorerActionGroup.MULTI</code>, then the
+ * description will be very general to describe the situation of
+ * all the different selected objects as good as possible.
+ *
+ * @param type the type of the selected object, must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>.
+ * @return a string describing the operation
+ */
+ public String getDescription(int type) {
+ IRubyElement elem= (IRubyElement) getSelectedElements().get(0);
+ String name= escapeSpecialChars(elem.getElementName());
+ if (type == DialogPackageExplorerActionGroup.SOURCE_FOLDER)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ExcludePackage, name);
+ if (type == DialogPackageExplorerActionGroup.INCLUDED_FOLDER)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ExcludePackage, name);
+ if (type == DialogPackageExplorerActionGroup.RUBY_SCRIPT)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ExcludeFile, name);
+ if (type == DialogPackageExplorerActionGroup.INCLUDED_FILE)
+ return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ExcludeFile, name);
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_Exclude;
+ }
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ILoadpathInformationProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ILoadpathInformationProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/ILoadpathInformationProvider.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,117 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * Copyright (c) 2000, 2005 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.buildpath;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierQueries.IRemoveLinkedFolderQuery;
+
+
+/**
+ * Interface representing a information provider for
+ * operations. The interface allows the operation to get
+ * information about the current state and to callback on
+ * the provider if the result of an operation needs to be handled.
+ *
+ * @see org.eclipse.jdt.internal.corext.buildpath.LoadpathModifierOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.CreateFolderOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.AddSelectedSourceFolderOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.RemoveFromLoadpathOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.IncludeOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.UnincludeOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.ExcludeOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.UnexcludeOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.EditFiltersOperation
+ * @see org.eclipse.jdt.internal.corext.buildpath.ResetOperation
+ */
+public interface ILoadpathInformationProvider {
+ public static final int ADD_SEL_SF_TO_BP= 0x00;
+ public static final int REMOVE_FROM_BP= 0x01;
+ public static final int EXCLUDE= 0x02;
+ public static final int UNEXCLUDE= 0x03;
+ public static final int EDIT_FILTERS= 0x04;
+ public static final int CREATE_LINK= 0x05;
+ public static final int RESET_ALL= 0x06;
+// public static final int EDIT_OUTPUT= 0x07;
+ public static final int CREATE_OUTPUT= 0x08;
+ public static final int RESET= 0x09;
+ public static final int INCLUDE= 0xA;
+ public static final int UNINCLUDE= 0xB;
+ public static final int CREATE_FOLDER= 0xC;
+ public static final int ADD_JAR_TO_BP= 0xD;
+ public static final int ADD_LIB_TO_BP= 0xE;
+ public static final int ADD_SEL_LIB_TO_BP= 0xF;
+
+ /**
+ * Method to invoce the <code>ILoadpathInformationProvider</code> to
+ * process the result of the corresponding operation. Normally, operations
+ * call this method at the end of their computation an pass the result
+ * back to the provider.
+ *
+ * @param resultElements the result list of an operation, can be empty
+ * @param exception an exception object in case that an exception occurred,
+ * <code>null</code> otherwise. Note: clients should check the exception
+ * object before processing the result because otherwise, the result might be
+ * incorrect
+ * @param operationType constant to specify which kind of operation was executed;
+ * corresponds to one of the following constants of <code>ILoadpathInformationProvider</code>:
+ * <li>CREATE_FOLDER</li>
+ * <li>ADD_TO_BP</li>
+ * <li>REMOVE_FROM_BP</li>
+ * <li>INCLUDE</li>
+ * <li>UNINCLUDE</li>
+ * <li>EXCLUDE</li>
+ * <li>UNEXCLUDE</li>
+ * <li>EDIT</li>
+ * <li>RESET</li>
+ * <li>CREATE_OUTPUT</li>
+ */
+ public void handleResult(List resultElements, CoreException exception, int operationType);
+
+ /**
+ * Method to retrieve the current list of selected elements of the provider, this is
+ * the objects on which the operation should be executed on.
+ *
+ * For example: if a tree item is selected and an operation should be
+ * executed on behalf of this item, then <code>getSelection()</code>
+ * should return this item.
+ *
+ * @return the current list of selected elements from the provider, must not be
+ * <code>null</code>
+ */
+ public IStructuredSelection getSelection();
+
+ /**
+ * Method to retrieve the Ruby project from the provider.
+ *
+ * @return the current Ruby project, must not be <code>null</code>
+ */
+ public IRubyProject getRubyProject();
+
+ public void deleteCreatedResources();
+
+ public IRemoveLinkedFolderQuery getRemoveLinkedFolderQuery() throws RubyModelException;
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/IPackageExplorerActionListener.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/IPackageExplorerActionListener.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/IPackageExplorerActionListener.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * Copyright (c) 2000, 2005 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.buildpath;
+
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup;
+
+/**
+ * Interface for listeners of <code>PackageExplorerActionEvent</code>.
+ */
+public interface IPackageExplorerActionListener {
+
+ /**
+ * Handle the <code>PackageExplorerActionEvent</code> which is fired
+ * whenever the set of available actions changes.
+ *
+ * @param event event to be processed
+ *
+ * @see PackageExplorerActionEvent
+ * @see DialogPackageExplorerActionGroup#addListener(IPackageExplorerActionListener)
+ */
+ public void handlePackageExplorerActionEvent(PackageExplorerActionEvent event);
+
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LinkedSourceFolderOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LinkedSourceFolderOperation.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LinkedSourceFolderOperation.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,130 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * 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.buildpath;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierOperation;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.GenerateBuildPathActionGroup.CreateLinkedSourceFolderAction;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierQueries.ILinkToQuery;
+
+/**
+ * Operation create a link to a source folder.
+ *
+ * @see org.eclipse.jdt.internal.corext.buildpath.LoadpathModifier#createLinkedSourceFolder(ILinkToQuery, IRubyProject, IProgressMonitor)
+ */
+public class LinkedSourceFolderOperation extends LoadpathModifierOperation {
+
+ private ILoadpathModifierListener fListener;
+ private ILoadpathInformationProvider fCPInformationProvider;
+
+ /**
+ * Constructor
+ *
+ * @param listener a <code>ILoadpathModifierListener</code> that is notified about
+ * changes on classpath entries or <code>null</code> if no such notification is
+ * necessary.
+ * @param informationProvider a provider to offer information to the action
+ *
+ * @see ILoadpathInformationProvider
+ * @see LoadpathModifier
+ */
+ public LinkedSourceFolderOperation(ILoadpathModifierListener listener, ILoadpathInformationProvider informationProvider) {
+ super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_tooltip, ILoadpathInformationProvider.CREATE_LINK);
+ fListener= listener;
+ fCPInformationProvider= informationProvider;
+ }
+
+ /**
+ * Method which runs the actions with a progress monitor.<br>
+ *
+ * This operation requires the following query from the provider:
+ * <li>ILinkToQuery</li>
+ *
+ * @param monitor a progress monitor, can be <code>null</code>
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ CreateLinkedSourceFolderAction action= new CreateLinkedSourceFolderAction();
+ action.selectionChanged(new StructuredSelection(fCPInformationProvider.getRubyProject()));
+ action.run();
+ ISourceFolderRoot createdElement= (ISourceFolderRoot)action.getCreatedElement();
+ if (createdElement == null) {
+ //Wizard was cancled.
+ return;
+ }
+ try {
+ IResource correspondingResource= createdElement.getCorrespondingResource();
+ List result= new ArrayList();
+ result.add(correspondingResource);
+ if (fListener != null) {
+ List entries= action.getCPListElements();
+ fListener.classpathEntryChanged(entries);
+ }
+ fCPInformationProvider.handleResult(result, null, ILoadpathInformationProvider.CREATE_LINK);
+ } catch (RubyModelException e) {
+ if (monitor == null) {
+ fCPInformationProvider.handleResult(Collections.EMPTY_LIST, e, ILoadpathInformationProvider.CREATE_LINK);
+ } else {
+ throw new InvocationTargetException(e);
+ }
+ }
+ }
+
+ /**
+ * This particular operation is always valid.
+ *
+ * @param elements a list of elements
+ * @param types an array of types for each element, that is,
+ * the type at position 'i' belongs to the selected element
+ * at position 'i'
+ *
+ * @return <code>true</code> if the operation can be
+ * executed on the provided list of elements, <code>
+ * false</code> otherwise.
+ * @throws RubyModelException
+ */
+ public boolean isValid(List elements, int[] types) throws RubyModelException {
+ return types.length == 1 && types[0] == DialogPackageExplorerActionGroup.RUBY_PROJECT;
+ }
+
+ /**
+ * Get a description for this operation.
+ *
+ * @param type the type of the selected object, must be a constant of
+ * <code>DialogPackageExplorerActionGroup</code>.
+ * @return a string describing the operation
+ */
+ public String getDescription(int type) {
+ return NewWizardMessages.PackageExplorerActionGroup_FormText_createLinkedFolder;
+ }
+
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LoadpathModifier.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LoadpathModifier.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/LoadpathModifier.java 2007-04-20 22:54:48 UTC (rev 2352)
@@ -0,0 +1,1270 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ *******************************************************************************
+ * 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
+ * Matt Chapman, mpc...@gm... - 89977 Make JDT .java agnostic
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.corext.buildpath;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyModelStatus;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.ISourceFolder;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.core.RubyConventions;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.corext.util.Messages;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
+import org.rubypeople.rdt.internal.ui.packageview.LoadPathContainer;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.BuildPathBasePage;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.CPListElement;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierQueries;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.LoadpathModifierQueries.IRemoveLinkedFolderQuery;
+
+public class LoadpathModifier {
+
+ /**
+ * Interface for listeners that want to receive a notification about
+ * changes on <code>ILoadpathEntry</code>. For example, if a source
+ * folder changes one of it's inclusion/exclusion filters, then
+ * this event will be fired.
+ */
+ public static interface ILoadpathModifierListener {
+ /**
+ * The new build path entry that was generated upon calling a method of
+ * <code>LoadpathModifier</code>. The type indicates which kind of
+ * interaction was executed on this entry.
+ *
+ * Note that the list does not contain elements of type
+ * <code>ILoadpathEntry</code>, but <code>CPListElement</code>
+ *
+ * @param newEntries list of <code>CPListElement</code>
+ */
+ public void classpathEntryChanged(List newEntries); // XXX Rename!
+ }
+
+ private ILoadpathModifierListener fListener;
+
+ public LoadpathModifier() {
+ this(null);
+ }
+
+ protected LoadpathModifier(ILoadpathModifierListener listener) {
+ fListener= listener;
+ }
+
+ /**
+ * Remove <code>path</code> from inclusion/exlusion filters in all <code>existingEntries</code>
+ *
+ * @param path the path to remove
+ * @param project the Java project
+ * @param existingEntries a list of <code>CPListElement</code> representing the build path
+ * entries of the project.
+ * @return returns a <code>List</code> of <code>CPListElement</code> of modified elements, not null.
+ */
+ public static List removeFilters(IPath path, IRubyProject project, List existingEntries) {
+ if (path == null)
+ return Collections.EMPTY_LIST;
+
+ IPath projPath= project.getPath();
+ if (projPath.isPrefixOf(path)) {
+ path= path.removeFirstSegments(projPath.segmentCount()).addTrailingSeparator();
+ }
+
+ List result= new ArrayList();
+ for (Iterator iter= existingEntries.iterator(); iter.hasNext();) {
+ CPListElement element= (CPListElement)iter.next();
+ boolean hasChange= false;
+ IPath[] exlusions= (IPath[])element.getAttribute(CPListElement.EXCLUSION);
+ if (exlusions != null) {
+ List exlusionList= new ArrayList(exlusions.length);
+ for (int i= 0; i < exlusions.length; i++) {
+ if (!exlusions[i].equals(path)) {
+ exlusionList.add(exlusions[i]);
+ } else {
+ hasChange= true;
+ }
+ }
+ element.setAttribute(CPListElement.EXCLUSION, exlusionList.toArray(new IPath[exlusionList.size()]));
+ }
+
+ IPath[] inclusion= (IPath[])element.getAttribute(CPListElement.INCLUSION);
+ if (inclusion != null) {
+ List inclusionList= new ArrayList(inclusion.length);
+ for (int i= 0; i < inclusion.length; i++) {
+ if (!inclusion[i].equals(path)) {
+ inclusionList.add(inclusion[i]);
+ } else {
+ hasChange= true;
+ }
+ }
+ element.setAttribute(CPListElement.INCLUSION, inclusionList.toArray(new IPath[inclusionList.size()]));
+ }
+ if (hasChange) {
+ result.add(element);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the <code>ILoadpathEntry</code> from the project and
+ * convert it into a list of <code>CPListElement</code>s.
+ *
+ * @param project the Ruby project to get it's build path entries from
+ * @return a list of <code>CPListElement</code>s corresponding to the
+ * build path entries of the project
+ * @throws RubyModelException
+ */
+ public static List getExistingEntries(IRubyProject project) throws RubyModelException {
+ ILoadpathEntry[] classpathEntries= project.getRawLoadpath();
+ ArrayList newClassPath= new ArrayList();
+ for (int i= 0; i < classpathEntries.length; i++) {
+ ILoadpathEntry curr= classpathEntries[i];
+ newClassPath.add(CPListElement.createFromExisting(curr, project));
+ }
+ return newClassPath;
+ }
+
+ /**
+ * Try to find the corresponding and modified <code>CPListElement</code> for the root
+ * in the list of elements and return it.
+ * If no one can be found, the roots <code>ClasspathEntry</code> is converted to a
+ * <code>CPListElement</code> and returned.
+ *
+ * @param elements a list of <code>CPListElements</code>
+ * @param root the root to find the <code>ClasspathEntry</code> for represented by
+ * a <code>CPListElement</code>
+ * @return the <code>CPListElement</code> found in the list (matching by using the path) or
+ * the roots own <code>IClasspathEntry</code> converted to a <code>CPListElement</code>.
+ * @throws RubyModelException
+ */
+ public static CPListElement getLoadpathEntry(List elements, ISourceFolderRoot root) throws RubyModelException {
+ ILoadpathEntry entry= root.getRawLoadpathEntry();
+ for (int i= 0; i < elements.size(); i++) {
+ CPListElement element= (CPListElement) elements.get(i);
+ if (element.getPath().equals(root.getPath()) && element.getEntryKind() == entry.getEntryKind())
+ return (CPListElement) elements.get(i);
+ }
+ CPListElement newElement= CPListElement.createFromExisting(entry, root.getRubyProject());
+ elements.add(newElement);
+ return newElement;
+ }
+
+ /**
+ * Get the <code>ILoadpathEntry</code> for the
+ * given path by looking up all
+ * build path entries on the project
+ *
+ * @param path the path to find a build path entry for
+ * @param project the Ruby project
+ * @return the <code>ILoadpathEntry</code> corresponding
+ * to the <code>path</code> or <code>null</code> if there
+ * is no such entry
+ * @throws RubyModelException
+ */
+ public static ILoadpathEntry getLoadpathEntryFor(IPath path, IRubyProject project, int entryKind) throws RubyModelException {
+ ILoadpathEntry[] entries= project.getRawLoadpath();
+ for (int i= 0; i < entries.length; i++) {
+ ILoadpathEntry entry= entries[i];
+ if (entry.getPath().equals(path) && equalEntryKind(entry, entryKind))
+ return entry;
+ }
+ return null;
+ }
+
+ /**
+ * Test if the provided kind is of type
+ * <code>ILoadpathEntry.CPE_SOURCE</code>
+ *
+ * @param entry the classpath entry to be compared with the provided type
+ * @param kind the kind to be checked
+ * @return <code>true</code> if kind equals
+ * <code>ILoadpathEntry.CPE_SOURCE</code>,
+ * <code>false</code> otherwise
+ */
+ private static boolean equalEntryKind(ILoadpathEntry entry, int kind) {
+ return entry.getEntryKind() == kind;
+ }
+
+ /**
+ * Check whether the input paramenter of type <code>
+ * ISourceFolderRoot</code> has either it's inclusion or
+ * exclusion filter or both set (that means they are
+ * not empty).
+ *
+ * @param root the fragment root to be inspected
+ * @return <code>true</code> inclusion or exclusion filter set,
+ * <code>false</code> otherwise.
+ */
+ public static boolean filtersSet(ISourceFolderRoot root) throws RubyModelException {
+ if (root == null)
+ return false;
+ ILoadpathEntry entry= root.getRawLoadpathEntry();
+ IPath[] inclusions= entry.getInclusionPatterns();
+ IPath[] exclusions= entry.getExclusionPatterns();
+ if (inclusions != null && inclusions.length > 0)
+ return true;
+ if (exclusions != null && exclusions.length > 0)
+ return true;
+ return false;
+ }
+
+ /**
+ * Find out whether the <code>IResource</code> excluded or not.
+ *
+ * @param resource the resource to be checked
+ * @param project the Ruby project
+ * @return <code>true</code> if the resource is excluded, <code>
+ * false</code> otherwise
+ * @throws RubyModelException
+ */
+ public static boolean isExcluded(IResource resource, IRubyProject project) throws RubyModelException {
+ ISourceFolderRoot root= getFolderRoot(resource, project, null);
+ if (root == null)
+ return false;
+ String fragmentName= getName(resource.getFullPath(), root.getPath());
+ fragmentName= completeName(fragmentName);
+ ILoadpathEntry entry= root.getRawLoadpathEntry();
+ return entry != null && contains(new Path(fragmentName), entry.getExclusionPatterns(), null);
+ }
+
+ /**
+ * Find out whether the provided path equals to one
+ * in the array.
+ *
+ * @param path path to find an equivalent for
+ * @param paths set of paths to compare with
+ * @param monitor progress monitor, can be <code>null</code>
+ * @return <code>true</code> if there is an occurrence, <code>
+ * false</code> otherwise
+ */
+ private static boolean contains(IPath path, IPath[] paths, IProgressMonitor monitor) {
+ if (monitor == null)
+ monitor= new NullProgressMonitor();
+ if (path == null)
+ return false;
+ try {
+ monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_ComparePaths, paths.length);
+ if (path.getFileExtension() == null)
+ path= new Path(completeName(path.toString()));
+ for (int i= 0; i < paths.length; i++) {
+ if (paths[i].equals(path))
+ return true;
+ monitor.worked(1);
+ }
+ } finally {
+ monitor.done();
+ }
+ return false;
+ }
+
+ /**
+ * Add a '/' at the end of the name if
+ * it does not end with '.rb', or other Ruby-like extension.
+ *
+ * @param name append '/' at the end if
+ * necessary
+ * @return modified string
+ */
+ private static String completeName(String name) {
+ if (!RubyCore.isRubyLikeFileName(name)) {
+ name= name + "/"; //$NON-NLS-1$
+ name= name.replace('.', '/');
+ return name;
+ }
+ return name;
+ }
+
+ /**
+ * Returns a string corresponding to the <code>path</code>
+ * with the <code>rootPath<code>'s number of segments
+ * removed
+ *
+ * @param path path to remove segments
+ * @param rootPath provides the number of segments to
+ * be removed
+ * @return a string corresponding to the mentioned
+ * action
+ */
+ private static String getName(IPath path, IPath rootPath) {
+ return path.removeFirstSegments(rootPath.segmentCount()).toString();
+ }
+
+ /**
+ * Get the source folder of a given <code>IResource</code> element,
+ * starting with the resource's parent.
+ *
+ * @param resource the resource to get the fragment root from
+ * @param project the Ruby project
+ * @param monitor progress monitor, can be <code>null</code>
+ * @return resolved fragment root
+ * @throws RubyModelException
+ */
+ public static ISourceFolderRoot getFolderRoot(IResource resource, IRubyProject project, IProgressMonitor monitor) throws RubyModelException {
+ if (monitor == null)
+ monitor= new NullProgressMonitor();
+ IRubyElement javaElem= null;
+ if (resource.getFullPath().equals(project.getPath()))
+ return project.getSourceFolderRoot(resource);
+ IContainer container= resource.getParent();
+ do {
+ if (container instanceof IFolder)
+ javaElem= RubyCore.create((IFolder) container);
+ if (container.getFullPath().equals(project.getPath())) {
+ javaElem= project;
+ break;
+ }
+ container= container.getParent();
+ if (container == null)
+ return null;
+ } while (javaElem == null || !(javaElem instanceof ISourceFolderRoot));
+ if (javaElem instanceof IRubyProject)
+ javaElem= project.getSourceFolderRoot(project.getResource());
+ return (ISourceFolderRoot) javaElem;
+ }
+
+ protected static String escapeSpecialChars(String value) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+
+ switch (c) {
+ case '&':
+ buf.append("&"); //$NON-NLS-1$
+ break;
+ case '<':
+ buf.append("<"); //$NON-NLS-1$
+ break;
+ case '>':
+ buf.append(">"); //$NON-NLS-1$
+ break;
+ case '\'':
+ buf.append("'"); //$NON-NLS-1$
+ break;
+ case '\"':
+ buf.append("""); //$NON-NLS-1$
+ break;
+ case 160:
+ buf.append(" "); //$NON-NLS-1$
+ break;
+ default:
+ buf.append(c);
+ break;
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Check whether the <code>IRubyProject</code>
+ * is a source folder
+ *
+ * @param project the project to test
+ * @return <code>true</code> if <code>project</code> is a source folder
+ * <code>false</code> otherwise.
+ */
+ public static boolean isSourceFolder(IRubyProject project) throws RubyModelException {
+ return LoadpathModifier.getLoadpathEntryFor(project.getPath(), project, ILoadpathEntry.CPE_SOURCE) != null;
+ }
+
+ /**
+ * Add a list of elements to the build path.
+ *
+ * @param elements a list of eleme...
[truncated message content] |
|
From: <caw...@us...> - 2007-04-20 22:48:33
|
Revision: 2351
http://svn.sourceforge.net/rubyeclipse/?rev=2351&view=rev
Author: cawilliams
Date: 2007-04-20 15:48:30 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
allow users to edit load paths of ruby projects, also begin quick fix processor infrastructure
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.ui/plugin.properties
trunk/org.rubypeople.rdt.ui/plugin.xml
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/IUIConstants.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/HTMLPrinter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/correction/CorrectionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/AbstractRubyEditorTextHover.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/ISharedImages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/icons/full/obj16/cp_order_obj.gif
trunk/org.rubypeople.rdt.ui/icons/full/obj16/jar_lsrc_obj.gif
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/correction/CUCorrectionProposal.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/SelectionUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/ViewerPane.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/viewsupport/ImageDisposer.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/LoadPathDetector.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/OpenNewRubyProjectWizardAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/OpenRubyProjectWizardToolbarAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardFirstPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardSecondPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/AddFolderToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/AddLibraryToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/AddSelectedLibraryToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/ConfigureBuildPathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/DialogPackageExplorer.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/DialogPackageExplorerActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/ExcludeFromBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/GenerateBuildPathActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/HelpAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/HintTextGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/IncludeToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LinkFolderDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierDropDownAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierQueries.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/NewSourceContainerWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/RemoveFromBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/RemoveLinkedFolderDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/workingsets/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/AbstractOpenWizardAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/ElementQuerySpecification.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/IMatchPresentation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/IQueryParticipant.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/ISearchRequestor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/PatternQuerySpecification.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/QuerySpecification.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/BuildPathDialogAccess.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/ILoadpathContainerPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/ILoadpathContainerPageExtension.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/ILoadpathContainerPageExtension2.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/RubyCapabilityConfigurationPage.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/OpenProjectWizardAction.java
Modified: trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-04-20 22:48:30 UTC (rev 2351)
@@ -56,6 +56,7 @@
org.eclipse.search,
org.jruby,
org.eclipse.compare,
+ org.eclipse.core.filesystem,
org.eclipse.core.expressions,
org.eclipse.ltk.core.refactoring
Eclipse-LazyStart: true
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/cp_order_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/cp_order_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/jar_lsrc_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/jar_lsrc_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-04-20 22:48:30 UTC (rev 2351)
@@ -55,6 +55,7 @@
preferenceKeywords.folding=Ruby editor folding section comment comments header method import inner type
preferenceKeywords.markoccurrences=Ruby editor occurrence mark highlight type method constant field exception
+buildPathPageName=Ruby Load Path
PerspectiveRuby.name=Ruby
ViewRubyResources.name=Ruby Resources
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-04-20 22:48:30 UTC (rev 2351)
@@ -7,7 +7,7 @@
<extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/>
<extension-point id="editorPopupExtender" name="%editorPopupExtender" schema="schema/org.rubypeople.rdt.ui.editorPopupExtender.exsd"/>
<extension-point id="rubyTemplateProvider" name="Ruby template provider" schema="schema/rubyTemplateProvider.exsd"/>
- <extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
+ <extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
<extension
point="org.eclipse.ui.preferencePages">
@@ -245,11 +245,11 @@
name="%NewWizardRubyProject.name"
icon="icons/full/etool16/newrprj_wiz.gif"
category="org.rubypeople.rdt.ui"
- class="org.rubypeople.rdt.internal.ui.wizards.NewProjectCreationWizard"
+ class="org.rubypeople.rdt.internal.ui.wizards.RubyProjectWizard"
preferredPerspectives="org.rubypeople.rdt.ui.PerspectiveRuby"
project="true"
finalPerspective="org.rubypeople.rdt.ui.PerspectiveRuby"
- id="org.rubypeople.rdt.ui.wizards.NewWizardProjectCreation">
+ id="org.rubypeople.rdt.ui.wizards.RubyProjectWizard">
<description>
Create a new Ruby project.
</description>
@@ -298,6 +298,28 @@
</enabledWhen>
<keywordReference id="org.rubypeople.rdt.ui.severities"/>
</page>
+ <page
+ objectClass="org.eclipse.core.resources.IProject"
+ name="%buildPathPageName"
+ class="org.rubypeople.rdt.internal.ui.preferences.BuildPathsPropertyPage"
+ id="org.rubypeople.rdt.ui.propertyPages.BuildPathsPropertyPage">
+ <filter
+ name="nature"
+ value="org.rubypeople.rdt.core.rubynature">
+ </filter>
+ <keywordReference id="org.rubypeople.rdt.ui.buildpath"/>
+ </page>
+ <page
+ objectClass="org.rubypeople.rdt.core.IRubyProject"
+ name="%buildPathPageName"
+ class="org.rubypeople.rdt.internal.ui.preferences.BuildPathsPropertyPage"
+ id="org.rubypeople.rdt.ui.propertyPages.BuildPathsPropertyPage">
+ <filter
+ name="nature"
+ value="org.rubypeople.rdt.core.rubynature">
+ </filter>
+ <keywordReference id="org.rubypeople.rdt.ui.buildpath"/>
+ </page>
</extension>
<extension
@@ -652,7 +674,7 @@
label="%OpenProjectWizardAction.label"
icon="icons/full/etool16/newrprj_wiz.gif"
tooltip="%OpenProjectWizardAction.tooltip"
- class="org.rubypeople.rdt.internal.ui.wizards.OpenProjectWizardAction"
+ class="org.rubypeople.rdt.internal.ui.wizards.OpenRubyProjectWizardToolbarAction"
toolbarPath="Normal/RubyWizards"
id="org.rubypeople.rdt.ui.actions.OpenProjectWizard">
</action>
@@ -975,6 +997,5 @@
<hyperlinkProvider
class="org.rubypeople.rdt.internal.ui.text.hyperlinks.RubyElementsHyperlinkProvider">
</hyperlinkProvider>
- </extension>
-
+ </extension>
</plugin>
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,142 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2005 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.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.swt.custom.BusyIndicator;
+
+/**
+ * A runnable context that shows the busy cursor instead of a progress
+ * monitor. Note, that the UI thread is blocked even if the runnable
+ * is executed in a separate thread by passing <code>fork= true</code>
+ * to the context's run method. Furthermore this context doesn't provide
+ * any UI to cancel the operation.
+ */
+public class BusyIndicatorRunnableContext implements IRunnableContext {
+
+ private static class BusyRunnable implements Runnable {
+
+ private static class ThreadContext extends Thread {
+ IRunnableWithProgress fRunnable;
+ Throwable fThrowable;
+
+ public ThreadContext(IRunnableWithProgress runnable) {
+ this(runnable, "BusyCursorRunnableContext-Thread"); //$NON-NLS-1$
+ }
+ protected ThreadContext(IRunnableWithProgress runnable, String name) {
+ super(name);
+ fRunnable= runnable;
+ }
+ public void run() {
+ try {
+ fRunnable.run(new NullProgressMonitor());
+ } catch (InvocationTargetException e) {
+ fThrowable= e;
+ } catch (InterruptedException e) {
+ fThrowable= e;
+ } catch (ThreadDeath e) {
+ fThrowable= e;
+ throw e;
+ } catch (RuntimeException e) {
+ fThrowable= e;
+ } catch (Error e) {
+ fThrowable= e;
+ }
+ }
+ void sync() {
+ try {
+ join();
+ } catch (InterruptedException e) {
+ // ok to ignore exception
+ }
+ }
+ }
+
+ public Throwable fThrowable;
+ private boolean fFork;
+ private IRunnableWithProgress fRunnable;
+ public BusyRunnable(boolean fork, IRunnableWithProgress runnable) {
+ fFork= fork;
+ fRunnable= runnable;
+ }
+ public void run() {
+ try {
+ internalRun(fFork, fRunnable);
+ } catch (InvocationTargetException e) {
+ fThrowable= e;
+ } catch (InterruptedException e) {
+ fThrowable= e;
+ }
+ }
+ private void internalRun(boolean fork, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ Thread thread= Thread.currentThread();
+ // Do not spawn another thread if we are already in a modal context
+ // thread or inside a busy context thread.
+ if (thread instanceof ThreadContext || ModalContext.isModalContextThread(thread))
+ fork= false;
+
+ if (fork) {
+ final ThreadContext t= new ThreadContext(runnable);
+ t.start();
+ t.sync();
+ // Check if the separate thread was terminated by an exception
+ Throwable throwable= t.fThrowable;
+ if (throwable != null) {
+ if (throwable instanceof InvocationTargetException) {
+ throw (InvocationTargetException) throwable;
+ } else if (throwable instanceof InterruptedException) {
+ throw (InterruptedException) throwable;
+ } else if (throwable instanceof OperationCanceledException) {
+ throw new InterruptedException();
+ } else {
+ throw new InvocationTargetException(throwable);
+ }
+ }
+ } else {
+ try {
+ runnable.run(new NullProgressMonitor());
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException();
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IRunnableContext.
+ */
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ BusyRunnable busyRunnable= new BusyRunnable(fork, runnable);
+ BusyIndicator.showWhile(null, busyRunnable);
+ Throwable throwable= busyRunnable.fThrowable;
+ if (throwable instanceof InvocationTargetException) {
+ throw (InvocationTargetException)throwable;
+ } else if (throwable instanceof InterruptedException) {
+ throw (InterruptedException)throwable;
+ }
+ }
+}
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-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -3,10 +3,12 @@
*/
package org.rubypeople.rdt.internal.corext.util;
+import org.eclipse.core.runtime.IPath;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.util.CharOperation;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
/**
@@ -69,4 +71,15 @@
public static ISourceFolderRoot getSourceFolderRoot(IRubyElement element) {
return (ISourceFolderRoot) element.getAncestor(IRubyElement.SOURCE_FOLDER_ROOT);
}
+
+ public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) {
+ char[] path = resourcePath.toString().toCharArray();
+ for (int i = 0, length = exclusionPatterns.length; i < length; i++) {
+ char[] pattern= exclusionPatterns[i].toString().toCharArray();
+ if (CharOperation.pathMatch(pattern, path, true, '/')) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -4,4 +4,5 @@
public interface IUIConstants {
public static final String DIALOGSTORE_TYPECOMMENT_DEPRECATED= RubyUI.ID_PLUGIN + ".typecomment.deprecated"; //$NON-NLS-1$
+ public static final String DIALOGSTORE_LASTEXTJAR= RubyUI.ID_PLUGIN + ".lastextjar"; //$NON-NLS-1$
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -30,19 +30,20 @@
private static final String T_DLCL= "dlcl16"; //$NON-NLS-1$
private static final String T_CTOOL = "ctool16"; //$NON-NLS-1$
private static final String T_WIZBAN= "wizban"; //$NON-NLS-1$
-
+ private static final String T_ETOOL= "etool16"; //$NON-NLS-1$
+
/*
* Keys for images available from the Ruby-UI plug-in image registry.
*/
public static final String IMG_MISC_PUBLIC= NAME_PREFIX + "methpub_obj.gif"; //$NON-NLS-1$
public static final String IMG_MISC_PROTECTED= NAME_PREFIX + "methpro_obj.gif"; //$NON-NLS-1$
public static final String IMG_MISC_PRIVATE= NAME_PREFIX + "methpri_obj.gif"; //$NON-NLS-1$
-
public static final String IMG_OBJS_ERROR = NAME_PREFIX + "error_obj.gif";
public static final String IMG_OBJS_WARNING = NAME_PREFIX + "warning_obj.gif";
public static final String IMG_OBJS_INFO = NAME_PREFIX + "info_obj.gif";
public static final String IMG_OBJS_HELP= NAME_PREFIX + "help.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_GHOST= NAME_PREFIX + "ghost.gif"; //$NON-NLS-1$
+
private static final String IMG_OBJS_CLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_INNER_CLASS= NAME_PREFIX + "innerclass_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_CLASSALT= NAME_PREFIX + "classfo_obj.gif"; //$NON-NLS-1$
@@ -50,12 +51,14 @@
private static final String IMG_OBJS_MODULEALT= NAME_PREFIX + "modulefo_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_RUBY_MODEL= NAME_PREFIX + "ruby_model_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_SOURCE_FOLDER= NAME_PREFIX + "fldr_obj.gif"; //$NON-NLS-1$
- private static final String IMG_OBJS_SOURCE_FOLDER_ROOT= NAME_PREFIX + "fldr_root_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_SOURCE_FOLDER_ROOT= NAME_PREFIX + "fldr_root_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_SCRIPT= NAME_PREFIX + "rscript_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_RUBY_RESOURCE= NAME_PREFIX + "rscript_resource_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_UNKNOWN= NAME_PREFIX + "unknown_obj.gif"; //$NON-NLS-1$
-
+ public static final String IMG_OBJS_ENV_VAR= NAME_PREFIX + "envvar_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_LIBRARY= NAME_PREFIX + "library_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXTJAR= NAME_PREFIX + "jar_l_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXTJAR_WSRC= NAME_PREFIX + "jar_lsrc_obj.gif"; //$NON-NLS-1$
private static final String IMG_CTOOLS_RUBY_IMPORT_CONTAINER = NAME_PREFIX + "imp_c.gif";
private static final String IMG_CTOOLS_RUBY_IMPORT = NAME_PREFIX + "imp_obj.gif";
@@ -80,14 +83,23 @@
public static final ImageDescriptor DESC_WIZBAN_NEWJPRJ = createUnManaged(T_WIZBAN, "newrprj_wiz.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_WIZBAN_NEWCLASS = createUnManaged(T_WIZBAN, "newclass_wiz.gif"); //$NON-NLS-1$
-
- // RI
- public static final ImageDescriptor TOOLBAR_REFRESH = createUnManaged(T_ELCL, "refresh.png");
+ public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR= createUnManaged(T_WIZBAN, "newsrcfldr_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY= createUnManaged(T_WIZBAN, "addlibrary_wiz.png");//$NON-NLS-1$
+ public static final ImageDescriptor TOOLBAR_REFRESH = createUnManaged(T_ELCL, "refresh.png");
+
+ public static final ImageDescriptor DESC_OBJS_HELP= createManagedFromKey(T_ELCL, IMG_OBJS_HELP);
+
public static final ImageDescriptor DESC_OBJ_OVERRIDES= createUnManaged(T_OBJ, "over_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJ_IMPLEMENTS= createUnManaged(T_OBJ, "implm_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJS_LIBRARY= createManagedFromKey(T_OBJ, IMG_OBJS_LIBRARY);
-
+ public static final ImageDescriptor DESC_OBJS_EXTJAR= createManagedFromKey(T_OBJ, IMG_OBJS_EXTJAR);
+ public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC= createManagedFromKey(T_OBJ, IMG_OBJS_EXTJAR_WSRC);
+ public static final ImageDescriptor DESC_OBJS_ENV_VAR= createManagedFromKey(T_OBJ, IMG_OBJS_ENV_VAR);
+
+ public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB= createUnManaged(T_OBJ, "exclusion_filter_attrib.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_INCLUSION_FILTER_ATTRIB= createUnManaged(T_OBJ, "inclusion_filter_attrib.gif"); //$NON-NLS-1$
+
public static final ImageDescriptor DESC_OVR_STATIC= createUnManaged(T_OVR, "static_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OVR_FINAL= createUnManaged(T_OVR, "final_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OVR_ABSTRACT= createUnManaged(T_OVR, "abstract_co.gif"); //$NON-NLS-1$
@@ -102,9 +114,6 @@
public static final ImageDescriptor DESC_OVR_CONSTRUCTOR= createUnManaged(T_OVR, "constr_ovr.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OVR_DEPRECATED= createUnManaged(T_OVR, "deprecated.gif");
- public static final ImageDescriptor DESC_ELCL_FILTER= createUnManaged(T_ELCL, "filter_ps.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_FILTER= createUnManaged(T_DLCL, "filter_ps.gif"); //$NON-NLS-1$
-
public static final ImageDescriptor DESC_OBJS_GHOST= createManagedFromKey(T_OBJ, IMG_OBJS_GHOST);
public static final ImageDescriptor DESC_OBJS_IMPDECL= createManagedFromKey(T_OBJ, IMG_CTOOLS_RUBY_IMPORT);
public static final ImageDescriptor DESC_OBJS_IMPCONT= createManagedFromKey(T_OBJ, IMG_CTOOLS_RUBY_IMPORT_CONTAINER);
@@ -122,18 +131,47 @@
public static final ImageDescriptor DESC_OBJS_CLASS= createManagedFromKey(T_OBJ, IMG_OBJS_CLASS);
public static final ImageDescriptor DESC_OBJS_CLASSALT= createManagedFromKey(T_OBJ, IMG_OBJS_CLASSALT);
public static final ImageDescriptor DESC_OBJS_INNER_CLASS= createManagedFromKey(T_OBJ, IMG_OBJS_INNER_CLASS);
- public static final ImageDescriptor DESC_OBJS_MODULEALT = createManagedFromKey(T_OBJ, IMG_OBJS_MODULEALT);
-
-
+ public static final ImageDescriptor DESC_OBJS_MODULEALT = createManagedFromKey(T_OBJ, IMG_OBJS_MODULEALT);
public static final ImageDescriptor DESC_OBJS_SCRIPT= createManagedFromKey(T_OBJ, IMG_OBJS_SCRIPT);
public static final ImageDescriptor DESC_OBJS_RUBY_RESOURCE= createManagedFromKey(T_OBJ, IMG_OBJS_RUBY_RESOURCE);
+ public static final ImageDescriptor DESC_OBJS_UNKNOWN= createManagedFromKey(T_OBJ, IMG_OBJS_UNKNOWN);
+ public static final ImageDescriptor DESC_TOOL_NEWPACKROOT= createUnManaged(T_ETOOL, "newpackfolder_wiz.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ELCL_FILTER= createUnManaged(T_ELCL, "filter_ps.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_FILTER= createUnManaged(T_DLCL, "filter_ps.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ELCL_REMOVE_FROM_BP= createUnManaged(T_ELCL, "remove_from_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_ADD_AS_SOURCE_FOLDER= createUnManaged(T_DLCL, "add_as_source_folder.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_ADD_AS_SOURCE_FOLDER= createUnManaged(T_ELCL, "add_as_source_folder.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_REMOVE_AS_SOURCE_FOLDER= createUnManaged(T_DLCL, "remove_as_source_folder.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_REMOVE_AS_SOURCE_FOLDER= createUnManaged(T_ELCL, "remove_as_source_folder.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_EXCLUDE_FROM_BUILDPATH= createUnManaged(T_DLCL, "exclude_from_buildpath.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_EXCLUDE_FROM_BUILDPATH= createUnManaged(T_ELCL, "exclude_from_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_INCLUDE_ON_BUILDPATH= createUnManaged(T_DLCL, "include_on_buildpath.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_INCLUDE_ON_BUILDPATH= createUnManaged(T_ELCL, "include_on_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS= createUnManaged(T_DLCL, "configure_buildpath_filters.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS= createUnManaged(T_ELCL, "configure_buildpath_filters.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_ADD_LINKED_SOURCE_TO_BUILDPATH= createUnManaged(T_DLCL, "add_linked_source_to_buildpath.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH= createUnManaged(T_ELCL, "add_linked_source_to_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ELCL_CLEAR= createUnManaged(T_ELCL, "clear_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CLEAR= createUnManaged(T_DLCL, "clear_co.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH= createUnManaged(T_DLCL, "configure_build_path.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH= createUnManaged(T_ELCL, "configure_build_path.gif"); //$NON-NLS-1$
+
public static final ImageDescriptor DESC_MISC_PUBLIC= createManagedFromKey(T_OBJ, IMG_MISC_PUBLIC);
public static final ImageDescriptor DESC_MISC_PROTECTED= createManagedFromKey(T_OBJ, IMG_MISC_PROTECTED);
public static final ImageDescriptor DESC_MISC_PRIVATE= createManagedFromKey(T_OBJ, IMG_MISC_PRIVATE);
-
- public static final ImageDescriptor DESC_OBJS_UNKNOWN= createManagedFromKey(T_OBJ, IMG_OBJS_UNKNOWN);
public static final String IMG_CORRECTION_CHANGE= NAME_PREFIX + "correction_change.gif"; //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_LOADPATH_ORDER= createUnManaged(T_OBJ, "cp_order_obj.gif"); //$NON-NLS-1$
static {
createManagedFromKey(T_OBJ, IMG_CORRECTION_CHANGE);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -51,6 +51,14 @@
public static String OpenTypeAction_error_title;
public static String OpenTypeAction_error_messageProblems;
public static String OpenTypeAction_message;
+ public static String OpenNewSourceFolderWizardAction_text2;
+ public static String OpenNewSourceFolderWizardAction_description;
+ public static String OpenNewSourceFolderWizardAction_tooltip;
+ public static String BuildPath_label;
+
+ public static String OpenNewRubyProjectWizardAction_text;
+ public static String OpenNewRubyProjectWizardAction_description;
+ public static String OpenNewRubyProjectWizardAction_tooltip;
static {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -68,7 +68,7 @@
layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
// new actions - Ruby project creation wizard
- layout.addNewWizardShortcut("org.rubypeople.rdt.ui.wizards.NewProjectCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.rubypeople.rdt.ui.wizards.RubyProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.rubypeople.rdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2005 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.filters;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.internal.ui.packageview.LoadPathContainer;
+
+
+/**
+ * The LibraryFilter is a filter used to determine whether
+ * a Java library is shown
+ */
+public class LibraryFilter extends ViewerFilter {
+
+ /* (non-Javadoc)
+ * Method declared on ViewerFilter.
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof LoadPathContainer)
+ return false;
+ if (element instanceof ISourceFolderRoot) {
+ ISourceFolderRoot root= (ISourceFolderRoot)element;
+ if (root.isArchive()) {
+ // don't filter out JARs contained in the project itself
+ IResource resource= root.getResource();
+ if (resource != null) {
+ IProject jarProject= resource.getProject();
+ IProject container= root.getRubyProject().getProject();
+ return container.equals(jarProject);
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -45,11 +45,11 @@
import org.rubypeople.rdt.internal.ui.util.PixelConverter;
/**
- * Configures Java Editor typing preferences.
+ * Configures Ruby Editor typing preferences.
*
* @since 3.1
*/
-abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlock {
+public abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlock {
/**
* Use as follows:
@@ -320,7 +320,10 @@
* @return the controls added
*/
protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
-
+ return addLabelledTextField(composite, label, key, textLimit, indentation, isNumber, SWT.BORDER | SWT.SINGLE, 1, textLimit);
+ }
+
+ protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber, int textStyle, int height, int width) {
PixelConverter pixelConverter= new PixelConverter(composite);
Label labelControl= new Label(composite, SWT.NONE);
@@ -329,11 +332,12 @@
gd.horizontalIndent= indentation;
labelControl.setLayoutData(gd);
- Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
+ Text textControl= new Text(composite, textStyle);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint= pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
+ gd.widthHint= pixelConverter.convertWidthInCharsToPixels(width + 1);
textControl.setLayoutData(gd);
textControl.setTextLimit(textLimit);
+ gd.heightHint = pixelConverter.convertHeightInCharsToPixels(height);
fTextFields.put(textControl, key);
if (isNumber) {
fNumberFields.add(textControl);
@@ -344,7 +348,7 @@
return new Control[]{labelControl, textControl};
}
-
+
protected void createDependency(final Button master, final Control slave) {
createDependency(master, new Control[] {slave});
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,270 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * 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.preferences;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.preference.IPreferencePageContainer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.corext.util.BusyIndicatorRunnableContext;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.WorkbenchRunnableAdapter;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusUtil;
+import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
+import org.rubypeople.rdt.internal.ui.wizards.IStatusChangeListener;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.BuildPathsBlock;
+
+/**
+ * Property page for configuring the Ruby build path
+ */
+public class BuildPathsPropertyPage extends PropertyPage implements IStatusChangeListener {
+
+ public static final String PROP_ID= "org.rubypeople.rdt.ui.propertyPages.BuildPathsPropertyPage"; //$NON-NLS-1$
+
+ private static final String PAGE_SETTINGS= "BuildPathsPropertyPage"; //$NON-NLS-1$
+ private static final String INDEX= "pageIndex"; //$NON-NLS-1$
+
+ public static final Object DATA_ADD_ENTRY= "add_classpath_entry"; //$NON-NLS-1$
+
+ public static final Object DATA_REVEAL_ENTRY= "select_classpath_entry"; //$NON-NLS-1$
+ public static final Object DATA_REVEAL_ATTRIBUTE_KEY= "select_classpath_attribute_key"; //$NON-NLS-1$
+
+ public static final Object DATA_BLOCK= "block_until_buildpath_applied"; //$NON-NLS-1$
+
+ private BuildPathsBlock fBuildPathsBlock;
+ private boolean fBlockOnApply= false;
+
+ /*
+ * @see PreferencePage#createControl(Composite)
+ */
+ protected Control createContents(Composite parent) {
+ // ensure the page has no special buttons
+ noDefaultAndApplyButton();
+
+ IProject project= getProject();
+ Control result;
+ if (project == null || !isRubyProject(project)) {
+ result= createWithoutRuby(parent);
+ } else if (!project.isOpen()) {
+ result= createForClosedProject(parent);
+ } else {
+ result= createWithRuby(parent, project);
+ }
+ Dialog.applyDialogFont(result);
+ return result;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IRubyHelpContextIds.BUILD_PATH_PROPERTY_PAGE);
+ }
+
+ private IDialogSettings getSettings() {
+ IDialogSettings javaSettings= RubyPlugin.getDefault().getDialogSettings();
+ IDialogSettings pageSettings= javaSettings.getSection(PAGE_SETTINGS);
+ if (pageSettings == null) {
+ pageSettings= javaSettings.addNewSection(PAGE_SETTINGS);
+ pageSettings.put(INDEX, 3);
+ }
+ return pageSettings;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
+ */
+ public void setVisible(boolean visible) {
+ if (fBuildPathsBlock != null) {
+ if (!visible) {
+ if (fBuildPathsBlock.hasChangesInDialog()) {
+ String title= PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_title;
+ String message= PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_message;
+ String[] buttonLabels= new String[] {
+ PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_save,
+ PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_discard,
+ PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_ignore
+ };
+ MessageDialog dialog= new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, buttonLabels, 0);
+ int res= dialog.open();
+ if (res == 0) {
+ performOk();
+ } else if (res == 1) {
+ fBuildPathsBlock.init(RubyCore.create(getProject()), null, null);
+ } else {
+ // keep unsaved
+ }
+ }
+ } else {
+ if (!fBuildPathsBlock.hasChangesInDialog() && fBuildPathsBlock.hasChangesInLoadpathFile()) {
+ fBuildPathsBlock.init(RubyCore.create(getProject()), null, null);
+ }
+ }
+ }
+ super.setVisible(visible);
+ }
+
+
+ /*
+ * Content for valid projects.
+ */
+ private Control createWithRuby(Composite parent, IProject project) {
+ IWorkbenchPreferenceContainer pageContainer= null;
+ IPreferencePageContainer container= getContainer();
+ if (container instanceof IWorkbenchPreferenceContainer) {
+ pageContainer= (IWorkbenchPreferenceContainer) container;
+ }
+
+ fBuildPathsBlock= new BuildPathsBlock(new BusyIndicatorRunnableContext(), this, getSettings().getInt(INDEX), false, pageContainer);
+ fBuildPathsBlock.init(RubyCore.create(project), null, null);
+ return fBuildPathsBlock.createControl(parent);
+ }
+
+ /*
+ * Content for non-Ruby projects.
+ */
+ private Control createWithoutRuby(Composite parent) {
+ Label label= new Label(parent, SWT.LEFT);
+ label.setText(PreferencesMessages.BuildPathsPropertyPage_no_java_project_message);
+
+ fBuildPathsBlock= null;
+ setValid(true);
+ return label;
+ }
+
+ /*
+ * Content for closed projects.
+ */
+ private Control createForClosedProject(Composite parent) {
+ Label label= new Label(parent, SWT.LEFT);
+ label.setText(PreferencesMessages.BuildPathsPropertyPage_closed_project_message);
+
+ fBuildPathsBlock= null;
+ setValid(true);
+ return label;
+ }
+
+ private IProject getProject() {
+ IAdaptable adaptable= getElement();
+ if (adaptable != null) {
+ IRubyElement elem= (IRubyElement) adaptable.getAdapter(IRubyElement.class);
+ if (elem instanceof IRubyProject) {
+ return ((IRubyProject) elem).getProject();
+ }
+ }
+ return null;
+ }
+
+ private boolean isRubyProject(IProject proj) {
+ try {
+ return proj.hasNature(RubyCore.NATURE_ID);
+ } catch (CoreException e) {
+ RubyPlugin.log(e);
+ }
+ return false;
+ }
+
+ /*
+ * @see IPreferencePage#performOk
+ */
+ public boolean performOk() {
+ if (fBuildPathsBlock != null) {
+ getSettings().put(INDEX, fBuildPathsBlock.getPageIndex());
+ if (fBuildPathsBlock.hasChangesInDialog()) {
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ fBuildPathsBlock.configureRubyProject(monitor);
+ }
+ };
+ WorkbenchRunnableAdapter op= new WorkbenchRunnableAdapter(runnable);
+ if (fBlockOnApply) {
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, true, op);
+ } catch (InvocationTargetException e) {
+ ExceptionHandler.handle(e, getShell(), PreferencesMessages.BuildPathsPropertyPage_error_title, PreferencesMessages.BuildPathsPropertyPage_error_message);
+ return false;
+ } catch (InterruptedException e) {
+ return false;
+ }
+ } else {
+ op.runAsUserJob(PreferencesMessages.BuildPathsPropertyPage_job_title, null);
+ }
+ }
+ }
+ return true;
+ }
+
+ /* (non-Rubydoc)
+ * @see IStatusChangeListener#statusChanged
+ */
+ public void statusChanged(IStatus status) {
+ setValid(!status.matches(IStatus.ERROR));
+ StatusUtil.applyToStatusLine(this, status);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.preference.PreferencePage#applyData(java.lang.Object)
+ */
+ public void applyData(Object data) {
+ if (data instanceof Map) {
+ Map map= (Map) data;
+ Object selectedLibrary= map.get(DATA_REVEAL_ENTRY);
+ if (selectedLibrary instanceof ILoadpathEntry) {
+ ILoadpathEntry entry= (ILoadpathEntry) selectedLibrary;
+ Object attr= map.get(DATA_REVEAL_ATTRIBUTE_KEY);
+ String attributeKey= attr instanceof String ? (String) attr : null;
+ if (fBuildPathsBlock != null) {
+ fBuildPathsBlock.setElementToReveal(entry, attributeKey);
+ }
+ }
+ Object entryToAdd= map.get(DATA_ADD_ENTRY);
+ if (entryToAdd instanceof ILoadpathEntry) {
+ if (fBuildPathsBlock != null) {
+ fBuildPathsBlock.addElement((ILoadpathEntry) entryToAdd);
+ }
+ }
+ fBlockOnApply= Boolean.TRUE.equals(map.get(DATA_BLOCK));
+ }
+ }
+
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,512 @@
+/**
+ * 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.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2005 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
+ *******************************************************************************/
+// AW
+package org.rubypeople.rdt.internal.ui.preferences;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.RubyConventions;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.core.util.Messages;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusUtil;
+import org.rubypeople.rdt.ui.PreferenceConstants;
+import org.rubypeople.rdt.ui.RubyUI;
+
+/*
+ * The page for defaults for loadpath entries in new ruby projects.
+ * See PreferenceConstants to access or change these values through public API.
+ */
+public class NewRubyProjectPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ public static final String ID= "org.rubypeople.rdt.ui.preferences.BuildPathPreferencePage"; //$NON-NLS-1$
+
+ private static final String SRCBIN_FOLDERS_IN_NEWPROJ= PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ;
+ private static final String SRCBIN_SRCNAME= PreferenceConstants.SRCBIN_SRCNAME;
+
+ private static final String LOADPATH_JRELIBRARY_INDEX= PreferenceConstants.NEWPROJECT_JRELIBRARY_INDEX;
+ private static final String LOADPATH_JRELIBRARY_LIST= PreferenceConstants.NEWPROJECT_JRELIBRARY_LIST;
+
+
+ private static String fgDefaultEncoding= System.getProperty("file.encoding"); //$NON-NLS-1$
+
+ public static ILoadpathEntry[] getDefaultJRELibrary() {
+ IPreferenceStore store= RubyPlugin.getDefault().getPreferenceStore();
+
+ String str= store.getString(LOADPATH_JRELIBRARY_LIST);
+ int index= store.getInt(LOADPATH_JRELIBRARY_INDEX);
+
+ StringTokenizer tok= new StringTokenizer(str, ";"); //$NON-NLS-1$
+ while (tok.hasMoreTokens() && index > 0) {
+ tok.nextToken();
+ index--;
+ }
+
+ if (tok.hasMoreTokens()) {
+ ILoadpathEntry[] res= decodeJRELibraryLoadpathEntries(tok.nextToken());
+ if (res.length > 0) {
+ return res;
+ }
+ }
+ return new ILoadpathEntry[] { getJREContainerEntry() };
+ }
+
+ // JRE Entry
+
+ public static String decodeJRELibraryDescription(String encoded) {
+ int end= encoded.indexOf(' ');
+ if (end != -1) {
+ return decode(encoded.substring(0, end));
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private static String decode(String str) {
+ try {
+ return URLDecoder.decode(str, fgDefaultEncoding);
+ } catch (UnsupportedEncodingException e) {
+ RubyPlugin.log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private static String encode(String str) {
+ try {
+ return URLEncoder.encode(str, fgDefaultEncoding);
+ } catch (UnsupportedEncodingException e) {
+ RubyPlugin.log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public static ILoadpathEntry[] decodeJRELibraryLoadpathEntries(String encoded) {
+ StringTokenizer tok= new StringTokenizer(encoded, " "); //$NON-NLS-1$
+ ArrayList res= new ArrayList();
+ while (tok.hasMoreTokens()) {
+ try {
+ tok.nextToken(); // desc: ignore
+ int kind= Integer.parseInt(tok.nextToken());
+ IPath path= decodePath(tok.nextToken());
+ boolean isExported= Boolean.valueOf(tok.nextToken()).booleanValue();
+ switch (kind) {
+ case ILoadpathEntry.CPE_SOURCE:
+ res.add(RubyCore.newSourceEntry(path));
+ break;
+ case ILoadpathEntry.CPE_LIBRARY:
+ res.add(RubyCore.newLibraryEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ res.add(RubyCore.newVariableEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_PROJECT:
+ res.add(RubyCore.newProjectEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ res.add(RubyCore.newContainerEntry(path, isExported));
+ break;
+ }
+ } catch (NumberFormatException e) {
+ String message= PreferencesMessages.NewRubyProjectPreferencePage_error_decode;
+ RubyPlugin.log(new Status(IStatus.ERROR, RubyUI.ID_PLUGIN, IStatus.ERROR, message, e));
+ } catch (NoSuchElementException e) {
+ String message= PreferencesMessages.NewRubyProjectPreferencePage_error_decode;
+ RubyPlugin.log(new Status(IStatus.ERROR, RubyUI.ID_PLUGIN, IStatus.ERROR, message, e));
+ }
+ }
+ return (ILoadpathEntry[]) res.toArray(new ILoadpathEntry[res.size()]);
+ }
+
+
+ public static String encodeJRELibrary(String desc, ILoadpathEntry[] cpentries) {
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < cpentries.length; i++) {
+ ILoadpathEntry entry= cpentries[i];
+ buf.append(encode(desc));
+ buf.append(' ');
+ buf.append(entry.getEntryKind());
+ buf.append(' ');
+ buf.append(encodePath(entry.getPath()));
+ buf.append(' ');
+ buf.append(entry.isExported());
+ buf.append(' ');
+ }
+ return buf.toString();
+ }
+
+ private static String encodePath(IPath path) {
+ if (path == null) {
+ return "#"; //$NON-NLS-1$
+ } else if (path.isEmpty()) {
+ return "&"; //$NON-NLS-1$
+ } else {
+ return encode(path.toPortableString());
+ }
+ }
+
+ private static IPath decodePath(String str) {
+ if ("#".equals(str)) { //$NON-NLS-1$
+ return null;
+ } else if ("&".equals(str)) { //$NON-NLS-1$
+ return Path.EMPTY;
+ } else {
+ return Path.fromPortableString(decode(str));
+ }
+ }
+
+
+ private ArrayList fCheckBoxes;
+ private ArrayList fRadioButtons;
+ private ArrayList fTextControls;
+
+ private SelectionListener fSelectionListener;
+ private ModifyListener fModifyListener;
+
+ private Text fSrcFolderNameText;
+
+ private Combo fJRECombo;
+
+ private Button fProjectAsSourceFolder;
+ private Button fFoldersAsSourceFolder;
+
+ private Label fSrcFolderNameLabel;
+
+ public NewRubyProjectPreferencePage() {
+ super();
+ setPreferenceStore(RubyPlugin.getDefault().getPreferenceStore());
+ setDescription(PreferencesMessages.NewRubyProjectPreferencePage_description);
+
+ // title used when opened programatically
+ setTitle(PreferencesMessages.NewRubyProjectPreferencePage_title);
+
+ fRadioButtons= new ArrayList();
+ fCheckBoxes= new ArrayList();
+ fTextControls= new ArrayList();
+
+ fSelectionListener= new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ public void widgetSelected(SelectionEvent e) {
+ controlChanged(e.widget);
+ }
+ };
+
+ fModifyListener= new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ controlModified(e.widget);
+ }
+ };
+
+ }
+
+ public static void initDefaults(IPreferenceStore store) {
+ store.setDefault(SRCBIN_FOLDERS_IN_NEWPROJ, false);
+ store.setDefault(SRCBIN_SRCNAME, "src"); //$NON-NLS-1$
+
+ store.setDefault(LOADPATH_JRELIBRARY_LIST, getDefaultJRELibraries());
+ store.setDefault(LOADPATH_JRELIBRARY_INDEX, 0);
+ }
+
+ private static String getDefaultJRELibraries() {
+ StringBuffer buf= new StringBuffer();
+ ILoadpathEntry cntentry= getJREContainerEntry();
+ buf.append(encodeJRELibrary(PreferencesMessages.NewRubyProjectPreferencePage_jre_container_description, new ILoadpathEntry[] { cntentry} ));
+ buf.append(';');
+ ILoadpathEntry varentry= getJREVariableEntry();
+ buf.append(encodeJRELibrary(PreferencesMessages.NewRubyProjectPreferencePage_jre_variable_description, new ILoadpathEntry[] { varentry }));
+ buf.append(';');
+ return buf.toString();
+ }
+
+ private static ILoadpathEntry getJREContainerEntry() {
+ return RubyCore.newContainerEntry(new Path("org.rubypeople.rdt.launching.RUBY_CONTAINER")); //$NON-NLS-1$
+ }
+
+ private static ILoadpathEntry getJREVariableEntry() {
+ return RubyCore.newVariableEntry(new Path("RUBY_LIB")); //$NON-NLS-1$
+ }
+
+ /*
+ * @see IWorkbenchPreferencePage#init(IWorkbench)
+ */
+ pub...
[truncated message content] |
|
From: <caw...@us...> - 2007-04-20 22:12:28
|
Revision: 2350
http://svn.sourceforge.net/rubyeclipse/?rev=2350&view=rev
Author: cawilliams
Date: 2007-04-20 15:12:26 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
when we infer the type of an instance variable, check for any assignments to the variable, not just the first assignment
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java 2007-04-20 22:11:45 UTC (rev 2349)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java 2007-04-20 22:12:26 UTC (rev 2350)
@@ -1,5 +1,6 @@
package org.rubypeople.rdt.internal.ti;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -28,6 +29,7 @@
import org.rubypeople.rdt.internal.ti.util.FirstPrecursorNodeLocator;
import org.rubypeople.rdt.internal.ti.util.INodeAcceptor;
import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator;
+import org.rubypeople.rdt.internal.ti.util.ScopedNodeLocator;
public class DefaultTypeInferrer implements ITypeInferrer {
@@ -132,7 +134,6 @@
if (!(node instanceof InstVarNode))
return;
final InstVarNode instVarNode = (InstVarNode) node;
- int nodeStart = node.getPosition().getStartOffset();
// TODO: see if there is attr_reader/attr_writer, maybe?
// TODO: find calls to the reader/writers
@@ -141,30 +142,22 @@
// Find first assignment to this var name that occurs before the
// reference
- // todo: This will find assignments in other local scopes that
+ // TODO: This will find assignments in other local scopes that
// precede this reference but have the same variable name.
// To mitigate, ensure that the closest spanning ScopeNode for both
// this LocalVarNode and the AsgnNode are the name ScopeNode.
// Or scopingNode. Still not sure whether IterNodes count or not...
// silly block-local-var ambiguity ;)
- Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor() {
+
+ // CHRIS - Changed to just grab all assignments to this instance variable, not just first assignment
+ List<Node> assignments = new ArrayList<Node>();
+ assignments.addAll(ScopedNodeLocator.Instance().findNodesInScope(rootNode, new INodeAcceptor() {
public boolean doesAccept(Node node) {
- String name = null;
- if (node instanceof LocalAsgnNode)
- name = ((LocalAsgnNode) node).getName();
- if (node instanceof InstAsgnNode)
- name = ((InstAsgnNode) node).getName();
- if (node instanceof GlobalAsgnNode)
- name = ((GlobalAsgnNode) node).getName();
- return (name != null && name.equals(instVarNode.getName()));
- /**
- * refactor to common INodeAcceptor for
- * instVarName,localVarName,globalVarName
- */
+ return (node instanceof InstAsgnNode) && (((InstAsgnNode)node).getName().equals(instVarNode.getName()));
}
- });
- if (initialAssignmentNode != null) {
- tryAsgnNode(initialAssignmentNode, guesses);
+ }));
+ for (Node assignNode : assignments) {
+ tryAsgnNode(assignNode, guesses);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 22:11:46
|
Revision: 2349
http://svn.sourceforge.net/rubyeclipse/?rev=2349&view=rev
Author: cawilliams
Date: 2007-04-20 15:11:45 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
if we can't parse the file and get and AST, try the last known good AST
Modified Paths:
--------------
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/SelectionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2007-04-20 22:11:11 UTC (rev 2348)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2007-04-20 22:11:45 UTC (rev 2349)
@@ -20,6 +20,7 @@
import org.jruby.ast.Node;
import org.jruby.ast.VCallNode;
import org.jruby.ast.types.INameNode;
+import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
@@ -27,6 +28,7 @@
import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.RubyScript;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.core.util.ASTUtil;
import org.rubypeople.rdt.internal.core.util.Util;
@@ -40,9 +42,14 @@
public IRubyElement[] select(IRubyScript script, int start, int end)
throws RubyModelException {
String source = script.getSource();
- RubyParser parser = new RubyParser();
- Node root = parser.parse((IFile) script.getResource(),
- new StringReader(source));
+ Node root;
+ try {
+ RubyParser parser = new RubyParser();
+ root = parser.parse((IFile) script.getResource(),
+ new StringReader(source));
+ } catch (SyntaxException e) {
+ root = ((RubyScript)script).lastGoodAST;
+ }
Node selected = OffsetNodeLocator.Instance().getNodeAtOffset(root,
start);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 22:11:19
|
Revision: 2348
http://svn.sourceforge.net/rubyeclipse/?rev=2348&view=rev
Author: cawilliams
Date: 2007-04-20 15:11:11 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
If we don't have any type inferrence guesses, use Object
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-04-20 17:18:15 UTC (rev 2347)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-04-20 22:11:11 UTC (rev 2348)
@@ -54,6 +54,7 @@
import org.rubypeople.rdt.internal.core.search.BasicSearchEngine;
import org.rubypeople.rdt.internal.core.search.CollectingSearchRequestor;
import org.rubypeople.rdt.internal.core.util.ASTUtil;
+import org.rubypeople.rdt.internal.ti.BasicTypeGuess;
import org.rubypeople.rdt.internal.ti.DefaultTypeInferrer;
import org.rubypeople.rdt.internal.ti.ITypeGuess;
import org.rubypeople.rdt.internal.ti.ITypeInferrer;
@@ -88,6 +89,9 @@
if (fContext.isExplicitMethodInvokation()) {
ITypeInferrer inferrer = new DefaultTypeInferrer();
List<ITypeGuess> guesses = inferrer.infer(fContext.getCorrectedSource(), fContext.getOffset());
+ if (guesses.isEmpty()) {
+ guesses.add(new BasicTypeGuess(OBJECT, 100));
+ }
RubyElementRequestor requestor = new RubyElementRequestor(script);
for (ITypeGuess guess : guesses) {
String name = guess.getType();
@@ -99,6 +103,7 @@
}
}
}
+
} else {
// FIXME If we're invoked on the class declaration (it's super class) don't do this!
// FIXME Traverse the IRubyElement model, not nodes (and don't reparse)?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|