-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the outline page overload methods now have a different decoration …
…and it's possible to hide them.
- Loading branch information
Showing
6 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+298 Bytes
plugins/org.python.pydev.shared_ui/icons/decoration_overload_obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions
64
plugins/org.python.pydev/src/org/python/pydev/outline/OutlineHideOverloadsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Licensed under the terms of the Eclipse Public License (EPL). | ||
* Please see the license.txt included with this distribution for details. | ||
* Any modifications to this file must keep this entire header intact. | ||
*/ | ||
package org.python.pydev.outline; | ||
|
||
import org.eclipse.jface.viewers.Viewer; | ||
import org.eclipse.jface.viewers.ViewerFilter; | ||
import org.python.pydev.parser.jython.SimpleNode; | ||
import org.python.pydev.parser.jython.ast.FunctionDef; | ||
import org.python.pydev.parser.jython.ast.Name; | ||
import org.python.pydev.parser.jython.ast.decoratorsType; | ||
import org.python.pydev.parser.visitors.scope.ASTEntryWithChildren; | ||
import org.python.pydev.shared_core.image.IImageCache; | ||
import org.python.pydev.shared_core.image.UIConstants; | ||
import org.python.pydev.shared_ui.outline.AbstractOutlineFilterAction; | ||
|
||
public class OutlineHideOverloadsAction extends AbstractOutlineFilterAction { | ||
|
||
private static final String PREF_HIDE_OVERLOADS = "org.python.pydev.OUTLINE_HIDE_OVERLOADS"; | ||
|
||
public OutlineHideOverloadsAction(PyOutlinePage page, IImageCache imageCache) { | ||
super("Hide overload Methods", page, imageCache, PREF_HIDE_OVERLOADS, | ||
UIConstants.STATIC_MEMBER_HIDE_OVERLOADS); | ||
} | ||
|
||
/** | ||
* @return the filter used to hide comments | ||
*/ | ||
@Override | ||
protected ViewerFilter createFilter() { | ||
return new ViewerFilter() { | ||
|
||
@Override | ||
public boolean select(Viewer viewer, Object parentElement, Object element) { | ||
if (element instanceof ParsedItem) { | ||
ParsedItem item = (ParsedItem) element; | ||
|
||
ASTEntryWithChildren astThis = item.getAstThis(); | ||
if (astThis == null) { | ||
return true; | ||
} | ||
SimpleNode token = astThis.node; | ||
|
||
if (token instanceof FunctionDef) { | ||
FunctionDef functionDefToken = (FunctionDef) token; | ||
if (functionDefToken.decs != null) { | ||
for (decoratorsType decorator : functionDefToken.decs) { | ||
if (decorator.func instanceof Name) { | ||
Name decoratorFuncName = (Name) decorator.func; | ||
if (decoratorFuncName.id.equals("overload")) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters