Skip to content

Commit 1534ffd

Browse files
authored
Merge pull request #49 from unv-unv/overrides-3
Adding missing @OverRide annotations (part 3). Adding RRA/RWA/RUI annotations. Some localization and refactoring
2 parents 341fc72 + 2319349 commit 1534ffd

51 files changed

Lines changed: 839 additions & 738 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.consulo/runConfigurations/consulo_run_desktop_awt.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</option>
2525
</MavenSettings>
2626
<ConfigurationWrapper RunnerId="Debug" />
27+
<ConfigurationWrapper RunnerId="Run" />
2728
<method>
2829
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/pom.xml" goal="package" />
2930
</method>

‎python-debugger/src/main/java/com/jetbrains/python/console/pydev/PydevXmlRpcClient.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323
public class PydevXmlRpcClient implements IPydevXmlRpcClient
2424
{
25-
2625
/**
2726
* Internal xml-rpc client (responsible for the actual communication with the server)
2827
*/
@@ -40,7 +39,6 @@ public class PydevXmlRpcClient implements IPydevXmlRpcClient
4039

4140
private static final long TIME_LIMIT = 60000;
4241

43-
4442
/**
4543
* Constructor (see fields description)
4644
*/
@@ -51,7 +49,7 @@ public PydevXmlRpcClient(ProcessHandler process, int port) throws MalformedURLEx
5149
URL url = new URL("http://" + hostname + ':' + port + "/RPC2");
5250

5351
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
54-
config.setEncoding("UTF8"); //eventhough it uses UTF anyway
52+
config.setEncoding("UTF8"); //even though it uses UTF anyway
5553
config.setServerURL(url);
5654

5755
this.impl = new XmlRpcClient();
@@ -73,18 +71,18 @@ public Object execute(String command, Object[] args) throws XmlRpcException
7371
*
7472
* @return the result from executing the given command in the server.
7573
*/
76-
public Object execute(String command, Object[] args, long timeout) throws XmlRpcException
74+
@Override
75+
public Object execute(String command, Object[] args, long timeout) throws XmlRpcException
7776
{
7877
final Object[] result = new Object[]{null};
7978

8079
//make an async call so that we can keep track of not actually having an answer.
8180
this.impl.executeAsync(command, new Vector(Arrays.asList(args)), new AsyncCallback()
8281
{
83-
8482
@Override
85-
public void handleResult(XmlRpcRequest pRequest, Object recievedResult)
83+
public void handleResult(XmlRpcRequest pRequest, Object receivedResult)
8684
{
87-
result[0] = recievedResult;
85+
result[0] = receivedResult;
8886
}
8987

9088
@Override

‎python-debugger/src/main/java/com/jetbrains/python/debugger/PydevXmlUtils.java‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*
2323
*/
2424
public class PydevXmlUtils {
25-
2625
static SAXParserFactory parserFactory = SAXParserFactory.newInstance();
2726

2827
private PydevXmlUtils() {
@@ -52,7 +51,7 @@ private static String decode(String value) {
5251
}
5352

5453
public static List<PydevCompletionVariant> decodeCompletions(Object fromServer, String actTok) {
55-
List<PydevCompletionVariant> ret = new ArrayList<PydevCompletionVariant>();
54+
List<PydevCompletionVariant> ret = new ArrayList<>();
5655

5756
List completionList = objectToList(fromServer);
5857

@@ -109,14 +108,13 @@ static class XMLToCompletionsInfo extends DefaultHandler {
109108
private List<Object[]> completions;
110109

111110
public XMLToCompletionsInfo() {
112-
completions = new ArrayList<Object[]>();
111+
completions = new ArrayList<>();
113112
}
114113

115-
public void startElement(String uri, String localName, String qName,
116-
Attributes attributes) throws SAXException {
114+
@Override
115+
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
117116
// <comp p0="%s" p1="%s" p2="%s" p3="%s"/>
118117
if (qName.equals("comp")) {
119-
120118
Object[] comp = new Object[]{
121119
decode(attributes.getValue("p0")),
122120
decode(attributes.getValue("p1")),
@@ -133,7 +131,6 @@ public List<Object[]> getCompletions() {
133131
}
134132
}
135133

136-
137134
public static List<PydevCompletionVariant> xmlToCompletions(String payload, String actionToken) throws Exception {
138135
SAXParser parser = getSAXParser();
139136
XMLToCompletionsInfo info = new XMLToCompletionsInfo();

‎python-impl/src/main/java/com/jetbrains/python/impl/codeInsight/PyCodeInsightSettings.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl.codeInsight;
1817

1918
import consulo.annotation.component.ComponentScope;
@@ -67,10 +66,12 @@ public static PyCodeInsightSettings getInstance() {
6766

6867
public boolean INSERT_TYPE_DOCSTUB = false;
6968

69+
@Override
7070
public PyCodeInsightSettings getState() {
7171
return this;
7272
}
7373

74+
@Override
7475
public void loadState(PyCodeInsightSettings state) {
7576
XmlSerializerUtil.copyBean(state, this);
7677
}

‎python-impl/src/main/java/com/jetbrains/python/impl/codeInsight/PyElementListCellRenderer.java‎

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl.codeInsight;
1817

18+
import consulo.annotation.access.RequiredReadAction;
1919
import consulo.language.editor.ui.PsiElementListCellRenderer;
2020
import consulo.navigation.ItemPresentation;
2121
import consulo.navigation.NavigationItem;
@@ -25,27 +25,30 @@
2525
/**
2626
* @author yole
2727
*/
28-
public class PyElementListCellRenderer extends PsiElementListCellRenderer
29-
{
30-
public String getElementText(PsiElement element) {
31-
if (element instanceof PsiNamedElement) {
32-
String name = ((PsiNamedElement)element).getName();
33-
return name == null ? "" : name;
28+
public class PyElementListCellRenderer extends PsiElementListCellRenderer {
29+
@Override
30+
@RequiredReadAction
31+
public String getElementText(PsiElement element) {
32+
if (element instanceof PsiNamedElement namedElem) {
33+
String name = namedElem.getName();
34+
return name == null ? "" : name;
35+
}
36+
return element.getText();
3437
}
35-
return element.getText();
36-
}
3738

38-
protected String getContainerText(PsiElement element, String name) {
39-
if (element instanceof NavigationItem) {
40-
ItemPresentation presentation = ((NavigationItem)element).getPresentation();
41-
if (presentation != null) {
42-
return presentation.getLocationString();
43-
}
39+
@Override
40+
protected String getContainerText(PsiElement element, String name) {
41+
if (element instanceof NavigationItem navItem) {
42+
ItemPresentation presentation = navItem.getPresentation();
43+
if (presentation != null) {
44+
return presentation.getLocationString();
45+
}
46+
}
47+
return null;
4448
}
45-
return null;
46-
}
4749

48-
protected int getIconFlags() {
49-
return 0;
50-
}
50+
@Override
51+
protected int getIconFlags() {
52+
return 0;
53+
}
5154
}

‎python-impl/src/main/java/com/jetbrains/python/impl/codeInsight/completion/PyClassInsertHandler.java‎

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,36 @@
2424
import com.jetbrains.python.impl.psi.PyUtil;
2525
import consulo.language.editor.completion.lookup.InsertHandler;
2626
import consulo.language.editor.completion.lookup.InsertionContext;
27+
import consulo.ui.annotation.RequiredUIAccess;
2728

2829
/**
2930
* @author yole
3031
*/
31-
public class PyClassInsertHandler implements InsertHandler<LookupElement>
32-
{
33-
public static PyClassInsertHandler INSTANCE = new PyClassInsertHandler();
32+
public class PyClassInsertHandler implements InsertHandler<LookupElement> {
33+
public static PyClassInsertHandler INSTANCE = new PyClassInsertHandler();
3434

35-
private PyClassInsertHandler()
36-
{
37-
}
35+
private PyClassInsertHandler() {
36+
}
3837

39-
public void handleInsert(InsertionContext context, LookupElement item)
40-
{
41-
Editor editor = context.getEditor();
42-
Document document = editor.getDocument();
43-
if(context.getCompletionChar() == '(')
44-
{
45-
context.setAddCompletionChar(false);
46-
int offset = context.getTailOffset();
47-
document.insertString(offset, "()");
38+
@Override
39+
@RequiredUIAccess
40+
public void handleInsert(InsertionContext context, LookupElement item) {
41+
Editor editor = context.getEditor();
42+
Document document = editor.getDocument();
43+
if (context.getCompletionChar() == '(') {
44+
context.setAddCompletionChar(false);
45+
int offset = context.getTailOffset();
46+
document.insertString(offset, "()");
4847

49-
PyClass pyClass = PyUtil.as(item.getPsiElement(), PyClass.class);
50-
PyFunction init = pyClass != null ? pyClass.findInitOrNew(true, null) : null;
51-
if(init != null && PyFunctionInsertHandler.hasParams(context, init))
52-
{
53-
editor.getCaretModel().moveToOffset(offset + 1);
54-
AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), init);
55-
}
56-
else
57-
{
58-
editor.getCaretModel().moveToOffset(offset + 2);
59-
}
60-
}
61-
}
48+
PyClass pyClass = PyUtil.as(item.getPsiElement(), PyClass.class);
49+
PyFunction init = pyClass != null ? pyClass.findInitOrNew(true, null) : null;
50+
if (init != null && PyFunctionInsertHandler.hasParams(context, init)) {
51+
editor.getCaretModel().moveToOffset(offset + 1);
52+
AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), init);
53+
}
54+
else {
55+
editor.getCaretModel().moveToOffset(offset + 2);
56+
}
57+
}
58+
}
6259
}

0 commit comments

Comments
 (0)