mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.diff.DiffDialogHints;
|
||||
import com.intellij.diff.DiffManager;
|
||||
import com.intellij.diff.DiffRequestFactory;
|
||||
import com.intellij.diff.requests.DiffRequest;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
/**
|
||||
* @author Jeka
|
||||
*/
|
||||
public class CompareValueWithClipboardAction extends BaseValueAction {
|
||||
protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
|
||||
DiffRequest request = DiffRequestFactory.getInstance().createClipboardVsValue(text);
|
||||
DiffManager.getInstance().showDiff(project, request);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
|
||||
/*
|
||||
* @author Jeka
|
||||
*/
|
||||
public class CopyValueAction extends BaseValueAction {
|
||||
protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
|
||||
CopyPasteManager.getInstance().setContents(new StringSelection(text));
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.ui.DebuggerPanelsManager;
|
||||
import com.intellij.debugger.ui.impl.MainWatchPanel;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
/**
|
||||
* User: lex
|
||||
* Date: Sep 26, 2003
|
||||
* Time: 8:34:01 PM
|
||||
*/
|
||||
public class EditWatchAction extends DebuggerAction {
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
|
||||
if(selectedNode == null || !(selectedNode.getDescriptor() instanceof WatchItemDescriptor)) return;
|
||||
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
|
||||
MainWatchPanel watchPanel = DebuggerPanelsManager.getInstance(project).getWatchPanel();
|
||||
if(watchPanel != null) {
|
||||
watchPanel.editNode(selectedNode);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
|
||||
|
||||
e.getPresentation().setVisible(selectedNode != null && selectedNode.getDescriptor() instanceof WatchItemDescriptor);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class NewWatchAction
|
||||
* @author Jeka
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.ui.DebuggerPanelsManager;
|
||||
import com.intellij.debugger.ui.impl.MainWatchPanel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NewWatchAction extends DebuggerAction {
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
getWatchPanel(e).newWatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(getWatchPanel(e) != null);
|
||||
}
|
||||
|
||||
private static MainWatchPanel getWatchPanel(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
return project != null ? DebuggerPanelsManager.getInstance(project).getWatchPanel() : null;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* User: lex
|
||||
* Date: Sep 26, 2003
|
||||
* Time: 6:24:44 PM
|
||||
*/
|
||||
public class RemoveAllWatchesAction extends RemoveWatchAction {
|
||||
protected DebuggerTreeNodeImpl[] getNodesToDelete(AnActionEvent e) {
|
||||
DebuggerTree tree = getTree(e.getDataContext());
|
||||
if(tree == null) return null;
|
||||
DebuggerTreeNodeImpl root = (DebuggerTreeNodeImpl)tree.getModel().getRoot();
|
||||
DebuggerTreeNodeImpl [] result = new DebuggerTreeNodeImpl[root.getChildCount()];
|
||||
int i = 0;
|
||||
for(Enumeration enumeration = root.children(); enumeration.hasMoreElements(); i++) {
|
||||
DebuggerTreeNodeImpl node = (DebuggerTreeNodeImpl)enumeration.nextElement();
|
||||
result[i] = node;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void updatePresentation(Presentation presentation, int watchesCount) {
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.ui.impl.MainWatchPanel;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RemoveWatchAction extends DebuggerAction {
|
||||
protected DebuggerTreeNodeImpl[] getNodesToDelete(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
|
||||
if(selectedNodes == null) return null;
|
||||
ArrayList<DebuggerTreeNodeImpl> selectedWatches = new ArrayList<DebuggerTreeNodeImpl>();
|
||||
for (int i = 0; i < selectedNodes.length; i++) {
|
||||
if(selectedNodes[i].getDescriptor() instanceof WatchItemDescriptor) {
|
||||
selectedWatches.add(selectedNodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return selectedWatches.toArray(new DebuggerTreeNodeImpl[selectedWatches.size()]);
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl [] nodes = getNodesToDelete(e);
|
||||
if (nodes == null || nodes.length == 0) return;
|
||||
|
||||
MainWatchPanel watchPanel = (MainWatchPanel)getPanel(e.getDataContext());
|
||||
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
DebuggerTreeNodeImpl node = nodes[i];
|
||||
watchPanel.getWatchTree().removeWatch(node);
|
||||
}
|
||||
}
|
||||
|
||||
protected void updatePresentation(Presentation presentation, int watchesCount) {
|
||||
presentation.setText(DebuggerBundle.message("action.remove.watch.text", watchesCount));
|
||||
}
|
||||
|
||||
public void update(AnActionEvent event) {
|
||||
Presentation presentation = event.getPresentation();
|
||||
DebuggerTreeNodeImpl[] nodes = getNodesToDelete(event);
|
||||
if (nodes != null && nodes.length > 0) {
|
||||
presentation.setEnabled(true);
|
||||
}
|
||||
else {
|
||||
presentation.setEnabled(false);
|
||||
}
|
||||
updatePresentation(presentation, nodes != null? nodes.length : 0);
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ShowExecutionPointActionHandler extends DebuggerActionHandler {
|
||||
public void perform(@NotNull final Project project, final AnActionEvent event) {
|
||||
final DebuggerSession session = (DebuggerManagerEx.getInstanceEx(project)).getContext().getDebuggerSession();
|
||||
if (session != null) {
|
||||
session.showExecutionPoint();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
|
||||
DebuggerSession debuggerSession = (DebuggerManagerEx.getInstanceEx(project)).getContext().getDebuggerSession();
|
||||
return debuggerSession != null && debuggerSession.isPaused() &&
|
||||
debuggerSession.getContextManager().getContext().getSuspendContext().getThread() != null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
@@ -36,10 +37,10 @@ public class ShowLibraryFramesAction extends ToggleAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,11 +137,7 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
myNodeManager = new NodeManagerImpl(session.getProject(), null) {
|
||||
@Override
|
||||
public DebuggerTreeNodeImpl createNode(final NodeDescriptor descriptor, EvaluationContext evaluationContext) {
|
||||
// value gathered here is required for correct renderers work. e.g. array renderer
|
||||
//((NodeDescriptorImpl)descriptor).setContext((EvaluationContextImpl)evaluationContext);
|
||||
final DebuggerTreeNodeImpl node = new DebuggerTreeNodeImpl(null, descriptor);
|
||||
//((NodeDescriptorImpl)descriptor).updateRepresentation((EvaluationContextImpl)evaluationContext, DescriptorLabelListener.DUMMY_LISTENER);
|
||||
return node;
|
||||
return new DebuggerTreeNodeImpl(null, descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,7 +318,6 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) {
|
||||
Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout");
|
||||
leftToolbar.add(Separator.getInstance(), beforeRunner);
|
||||
//leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.EXPORT_THREADS), beforeRunner);
|
||||
leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
|
||||
leftToolbar.add(Separator.getInstance(), beforeRunner);
|
||||
|
||||
@@ -339,10 +334,10 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean autoModeEnabled = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
final boolean autoModeEnabled = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
presentation.setText(autoModeEnabled ? "All-Variables Mode" : "Auto-Variables Mode");
|
||||
}
|
||||
|
||||
@@ -374,10 +369,10 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean watchValues = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
final boolean watchValues = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
DebugProcessImpl process = getCurrentDebugProcess(e.getProject());
|
||||
final String actionText = watchValues ? myMyTextDisable : myTextEnable;
|
||||
if (process == null || process.canGetMethodReturnValue()) {
|
||||
|
||||
+5
@@ -46,4 +46,9 @@ public class DisableGC implements Evaluator{
|
||||
public Modifier getModifier() {
|
||||
return myDelegate.getModifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NoGC -> " + myDelegate;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -952,11 +952,10 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
}
|
||||
|
||||
if (qualifier instanceof PsiReferenceExpression && ((PsiReferenceExpression)qualifier).resolve() instanceof PsiClass) {
|
||||
// this is a call to a 'static' method
|
||||
if (contextClass == null && type == null) {
|
||||
throwEvaluateException(DebuggerBundle.message("evaluation.error.qualifier.type.unknown", qualifier.getText()));
|
||||
// this is a call to a 'static' method but class is not available, try to evaluate by qname
|
||||
if (contextClass == null) {
|
||||
contextClass = JVMNameUtil.getJVMRawText(((PsiReferenceExpression)qualifier).getQualifiedName());
|
||||
}
|
||||
assert contextClass != null;
|
||||
objectEvaluator = new TypeEvaluator(contextClass);
|
||||
}
|
||||
else {
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,4 +66,9 @@ class LiteralEvaluator implements Evaluator {
|
||||
throw EvaluateExceptionUtil
|
||||
.createEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", myExpectedType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myValue.toString();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -156,4 +156,9 @@ class LocalVariableEvaluator implements Evaluator {
|
||||
}
|
||||
return modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myLocalVariableName;
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -211,4 +211,9 @@ public class MethodEvaluator implements Evaluator {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "call " + myMethodName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,8 @@ import java.util.Map;
|
||||
|
||||
@State(
|
||||
name = "DebuggerSettings",
|
||||
storages = {
|
||||
@Storage(
|
||||
file = StoragePathMacros.APP_CONFIG + "/other.xml"
|
||||
)}
|
||||
defaultStateAsResource = true,
|
||||
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml")
|
||||
)
|
||||
public class DebuggerSettings implements Cloneable, PersistentStateComponent<Element> {
|
||||
private static final Logger LOG = Logger.getInstance(DebuggerSettings.class);
|
||||
|
||||
@@ -287,7 +287,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
|
||||
leftToolbar.addSeparator();
|
||||
//addAction(leftToolbar, DebuggerActions.EXPORT_THREADS);
|
||||
addAction(leftToolbar, DebuggerActions.DUMP_THREADS);
|
||||
leftToolbar.addSeparator();
|
||||
|
||||
@@ -523,10 +522,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean autoModeEnabled = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
final boolean autoModeEnabled = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
presentation.setText(autoModeEnabled ? "All-Variables Mode" : "Auto-Variables Mode");
|
||||
}
|
||||
|
||||
@@ -558,10 +557,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean watchValues = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
final boolean watchValues = Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
final DebugProcessImpl process = getDebugProcess();
|
||||
final String actionText = watchValues ? myMyTextDisable : myTextEnable;
|
||||
if (process != null && process.canGetMethodReturnValue()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -710,10 +710,10 @@ public class FramesPanel extends UpdatableDebuggerView implements DataProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<AttachSourcesAction> getActions(List<LibraryOrderEntry> orderEntries, final PsiFile psiFile) {
|
||||
VirtualFile jar = getJarByPsiFile(psiFile);
|
||||
final VirtualFile jar = getJarByPsiFile(psiFile);
|
||||
if (jar == null) return Collections.emptyList();
|
||||
|
||||
final String jarName = jar.getNameWithoutExtension();
|
||||
@@ -145,7 +145,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
|
||||
SourceSearcher[] searchers = {new MavenCentralSourceSearcher(), new SonatypeSourceSearcher()};
|
||||
for (SourceSearcher searcher : searchers) {
|
||||
try {
|
||||
artifactUrl = searcher.findSourceJar(indicator, artifactId, version);
|
||||
artifactUrl = searcher.findSourceJar(indicator, artifactId, version, jar);
|
||||
}
|
||||
catch (SourceSearchException e) {
|
||||
LOG.warn(e);
|
||||
|
||||
+17
-4
@@ -36,6 +36,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packageDependencies.DependencyRule;
|
||||
import com.intellij.packageDependencies.DependencyValidationManager;
|
||||
import com.intellij.psi.*;
|
||||
@@ -51,10 +52,7 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
@@ -149,9 +147,24 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
|
||||
}
|
||||
|
||||
filterAlreadyImportedButUnresolved(classList);
|
||||
filerByPackageName(classList, file);
|
||||
return classList;
|
||||
}
|
||||
|
||||
protected void filerByPackageName(List<PsiClass> classList, PsiFile file) {
|
||||
final String packageName = StringUtil.getPackageName(getQualifiedName(myElement));
|
||||
if (!packageName.isEmpty() &&
|
||||
file instanceof PsiJavaFile &&
|
||||
Arrays.binarySearch(((PsiJavaFile)file).getImplicitlyImportedPackages(), packageName) < 0) {
|
||||
for (Iterator<PsiClass> iterator = classList.iterator(); iterator.hasNext(); ) {
|
||||
final String classQualifiedName = iterator.next().getQualifiedName();
|
||||
if (classQualifiedName != null && !packageName.equals(StringUtil.getPackageName(classQualifiedName))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canReferenceClass(R ref) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ static void ##
|
||||
#else
|
||||
$classname ##
|
||||
#end
|
||||
set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($field.name))($field.type $paramName) {
|
||||
set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
|
||||
#if ($field.name == $paramName)
|
||||
#if (!$field.modifierStatic)
|
||||
this.##
|
||||
|
||||
@@ -3,7 +3,7 @@ public ##
|
||||
static ##
|
||||
#end
|
||||
$field.type ##
|
||||
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($field.name)))
|
||||
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
|
||||
#if ($field.boolean)
|
||||
#if ($StringUtil.startsWithIgnoreCase($name, 'is'))
|
||||
#set($name = $StringUtil.decapitalize($name))
|
||||
|
||||
@@ -3,7 +3,7 @@ public ##
|
||||
#if($field.modifierStatic)
|
||||
static ##
|
||||
#end
|
||||
void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($field.name))($field.type $paramName) {
|
||||
void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
|
||||
#if ($field.name == $paramName)
|
||||
#if (!$field.modifierStatic)
|
||||
this.##
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.intellij.jarFinder;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jdom.xpath.XPath;
|
||||
@@ -21,13 +22,19 @@ public class MavenCentralSourceSearcher extends SourceSearcher {
|
||||
@Override
|
||||
protected String findSourceJar(@NotNull ProgressIndicator indicator,
|
||||
@NotNull String artifactId,
|
||||
@NotNull String version) throws SourceSearchException {
|
||||
@NotNull String version,
|
||||
@NotNull VirtualFile classesJar) throws SourceSearchException {
|
||||
try {
|
||||
indicator.setText("Connecting to https://search.maven.org");
|
||||
|
||||
indicator.checkCanceled();
|
||||
|
||||
String url = "https://search.maven.org/solrsearch/select?rows=3&wt=xml&q=a:%22" + artifactId + "%22%20AND%20v:%22" + version + "%22%20AND%20l:%22sources%22";
|
||||
String url = "https://search.maven.org/solrsearch/select?rows=3&wt=xml&q=";
|
||||
final String groupId = findMavenGroupId(classesJar, artifactId);
|
||||
if (groupId != null) {
|
||||
url += "g:%22" + groupId + "%22%20AND%20";
|
||||
}
|
||||
url += "a:%22" + artifactId + "%22%20AND%20v:%22" + version + "%22%20AND%20l:%22sources%22";
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Element> artifactList = (List<Element>)XPath.newInstance("/response/result/doc/str[@name='g']").selectNodes(readDocumentCancelable(indicator, url));
|
||||
if (artifactList.isEmpty()) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.intellij.jarFinder;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jdom.xpath.XPath;
|
||||
@@ -19,7 +20,10 @@ public class SonatypeSourceSearcher extends SourceSearcher {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version)
|
||||
public String findSourceJar(@NotNull final ProgressIndicator indicator,
|
||||
@NotNull String artifactId,
|
||||
@NotNull String version,
|
||||
@NotNull VirtualFile classesJar)
|
||||
throws SourceSearchException {
|
||||
try {
|
||||
indicator.setIndeterminate(true);
|
||||
@@ -28,6 +32,11 @@ public class SonatypeSourceSearcher extends SourceSearcher {
|
||||
indicator.checkCanceled();
|
||||
|
||||
String url = "https://oss.sonatype.org/service/local/lucene/search?collapseresults=true&c=sources&a=" + artifactId + "&v=" + version;
|
||||
String groupId = findMavenGroupId(classesJar, artifactId);
|
||||
if(groupId != null) {
|
||||
url += ("&g=" + groupId);
|
||||
}
|
||||
|
||||
List<Element> artifactList = (List<Element>)XPath.newInstance("/searchNGResponse/data/artifact").selectNodes(readDocumentCancelable(indicator, url));
|
||||
if (artifactList.isEmpty()) {
|
||||
return null;
|
||||
@@ -50,7 +59,7 @@ public class SonatypeSourceSearcher extends SourceSearcher {
|
||||
return null;
|
||||
}
|
||||
|
||||
String groupId = element.getChildTextTrim("groupId");
|
||||
groupId = element.getChildTextTrim("groupId");
|
||||
String repositoryId = artifactHintList.get(0).getChildTextTrim("repositoryId");
|
||||
|
||||
return "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=" +
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.intellij.jarFinder;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.io.HttpRequests;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.JDOMException;
|
||||
@@ -9,19 +13,43 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public abstract class SourceSearcher {
|
||||
|
||||
private static final String MAVEN_POM_ENTRY_PREFIX = "META-INF/maven/";
|
||||
|
||||
/**
|
||||
* @param indicator
|
||||
* @param artifactId
|
||||
* @param version
|
||||
* @return groupId of found artifact and url.
|
||||
* @return url of found artifact
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version) throws SourceSearchException;
|
||||
protected String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version)
|
||||
throws SourceSearchException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param indicator
|
||||
* @param artifactId
|
||||
* @param version
|
||||
* @param classesJar classes jar
|
||||
* @return url of found artifact
|
||||
*/
|
||||
@Nullable
|
||||
protected String findSourceJar(@NotNull final ProgressIndicator indicator,
|
||||
@NotNull String artifactId,
|
||||
@NotNull String version,
|
||||
@NotNull VirtualFile classesJar) throws SourceSearchException {
|
||||
return findSourceJar(indicator, artifactId, version);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static Document readDocumentCancelable(final ProgressIndicator indicator, String url) throws IOException {
|
||||
@@ -39,6 +67,34 @@ public abstract class SourceSearcher {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected static String findMavenGroupId(@NotNull VirtualFile classesJar, String artifactId) {
|
||||
try {
|
||||
JarFile jarFile = new JarFile(VfsUtilCore.virtualToIoFile(classesJar));
|
||||
try {
|
||||
final Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry entry = entries.nextElement();
|
||||
final String name = entry.getName();
|
||||
if (StringUtil.startsWith(name, MAVEN_POM_ENTRY_PREFIX) && StringUtil.endsWith(name, "/" + artifactId + "/pom.xml")) {
|
||||
final int index = name.indexOf('/', MAVEN_POM_ENTRY_PREFIX.length());
|
||||
return index != -1 ? name.substring(MAVEN_POM_ENTRY_PREFIX.length(), index) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
jarFile.close();
|
||||
}
|
||||
catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException ignore) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SourceSearchException extends Exception {
|
||||
|
||||
@@ -203,8 +203,8 @@ public class CreateTestDialog extends DialogWrapper {
|
||||
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)),
|
||||
myTargetPackageField.getChildComponent());
|
||||
|
||||
myGenerateBeforeBox = new JCheckBox("setUp/@Before");
|
||||
myGenerateAfterBox = new JCheckBox("tearDown/@After");
|
||||
myGenerateBeforeBox = new JCheckBox(CodeInsightBundle.message("intention.create.test.dialog.setUp"));
|
||||
myGenerateAfterBox = new JCheckBox(CodeInsightBundle.message("intention.create.test.dialog.tearDown"));
|
||||
|
||||
myShowInheritedMethodsBox = new JCheckBox(CodeInsightBundle.message("intention.create.test.dialog.show.inherited"));
|
||||
myShowInheritedMethodsBox.addActionListener(new ActionListener() {
|
||||
@@ -411,7 +411,9 @@ public class CreateTestDialog extends DialogWrapper {
|
||||
constr.gridy = gridy++;
|
||||
constr.gridx = 0;
|
||||
constr.weightx = 0;
|
||||
panel.add(new JLabel(CodeInsightBundle.message("intention.create.test.dialog.select.methods")), constr);
|
||||
final JLabel membersLabel = new JLabel(CodeInsightBundle.message("intention.create.test.dialog.select.methods"));
|
||||
membersLabel.setLabelFor(myMethodsTable);
|
||||
panel.add(membersLabel, constr);
|
||||
|
||||
constr.gridx = 1;
|
||||
constr.weightx = 1;
|
||||
|
||||
@@ -403,6 +403,7 @@ public class TypeConversionUtil {
|
||||
final PsiClass class1 = PsiUtil.resolveClassInType(typeArg1);
|
||||
if (class1 instanceof PsiTypeParameter) {
|
||||
for (PsiType type : class1.getExtendsListTypes()) {
|
||||
type = substitutor1.substitute(type);
|
||||
if (TypesDistinctProver.provablyDistinct(type, typeArg2) && !isAssignable(type, typeArg2)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,13 @@ public class TypesDistinctProver {
|
||||
final PsiType boundBound = ((PsiWildcardType)bound).getBound();
|
||||
if (boundBound != null && !boundBound.equals(type)) {
|
||||
final PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(boundBound);
|
||||
return psiClass == null || !(((PsiWildcardType)bound).isExtends() && possibleClasses.contains(psiClass));
|
||||
if (psiClass == null) {
|
||||
return true;
|
||||
}
|
||||
if (psiClass instanceof PsiTypeParameter) {
|
||||
return try2ProveTypeParameterDistinct(type, psiClass);
|
||||
}
|
||||
return !(((PsiWildcardType)bound).isExtends() && possibleClasses.contains(psiClass));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,10 +41,13 @@ import com.intellij.psi.impl.LanguageConstantExpressionEvaluator;
|
||||
import com.intellij.psi.impl.PsiExpressionEvaluator;
|
||||
import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
|
||||
import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
|
||||
import com.intellij.psi.impl.search.MethodSuperSearcher;
|
||||
import com.intellij.psi.impl.source.tree.CoreJavaASTFactory;
|
||||
import com.intellij.psi.impl.source.tree.PlainTextASTFactory;
|
||||
import com.intellij.psi.presentation.java.*;
|
||||
import com.intellij.psi.search.searches.SuperMethodsSearch;
|
||||
import com.intellij.psi.stubs.BinaryFileStubBuilders;
|
||||
import com.intellij.util.QueryExecutor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -98,6 +101,8 @@ public class JavaCoreApplicationEnvironment extends CoreApplicationEnvironment {
|
||||
}
|
||||
});
|
||||
|
||||
registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class);
|
||||
addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher());
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodMayBeStatic") // overridden in upsource
|
||||
|
||||
@@ -83,4 +83,14 @@ public class LightFieldBuilder extends LightVariableBuilder<LightFieldBuilder> i
|
||||
public PsiClass getContainingClass() {
|
||||
return myContainingClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalentTo(PsiElement another) {
|
||||
if (!(another instanceof PsiField)) return false;
|
||||
if (!((PsiField)another).getName().equals(getName())) return false;
|
||||
if (hasModifierProperty(PsiModifier.STATIC) != ((PsiField)another).hasModifierProperty(PsiModifier.STATIC)) return false;
|
||||
final PsiClass containingClass = getContainingClass();
|
||||
final PsiClass anotherClass = ((PsiField)another).getContainingClass();
|
||||
return containingClass == null && anotherClass == null || getManager().areElementsEquivalent(containingClass, anotherClass);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import java.util.List;
|
||||
|
||||
abstract class Test implements List<Test> {
|
||||
private <T extends List<T>> T foo() {
|
||||
return (T)this;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
abstract class Test {
|
||||
interface Selection<A> {}
|
||||
interface CriteriaQuery<T> {
|
||||
void select(Selection<? extends T> selection);
|
||||
}
|
||||
|
||||
private <N> void foo(CriteriaQuery<N> criteria, Selection<String[]> array) {
|
||||
criteria.select((Selection<? extends N>)array);
|
||||
}
|
||||
|
||||
private <N extends Integer> void foo1(CriteriaQuery<N> criteria, Selection<String[]> array) {
|
||||
criteria.select(<error descr="Inconvertible types; cannot cast 'Test.Selection<java.lang.String[]>' to 'Test.Selection<? extends N>'">(Selection<? extends N>)array</error>);
|
||||
}
|
||||
|
||||
private <N extends Integer> void foo2(CriteriaQuery<N> criteria, Selection<Object> array) {
|
||||
criteria.select(<error descr="Inconvertible types; cannot cast 'Test.Selection<java.lang.Object>' to 'Test.Selection<? extends N>'">(Selection<? extends N>)array</error>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
void m() {
|
||||
try (<caret>){
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
void m() {
|
||||
try <caret>{
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,9 @@ import com.intellij.codeInsight.generation.GenerateSetterHandler
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.siyeh.ig.style.UnqualifiedFieldAccessInspection
|
||||
@@ -70,6 +73,34 @@ class Foo {
|
||||
'''
|
||||
}
|
||||
|
||||
public void "test strip field prefix"() {
|
||||
def settings = CodeStyleSettingsManager.getInstance(getProject()).currentSettings
|
||||
String oldPrefix = settings.FIELD_NAME_PREFIX
|
||||
try {
|
||||
settings.FIELD_NAME_PREFIX = "my"
|
||||
myFixture.configureByText 'a.java', '''
|
||||
class Foo {
|
||||
String myName;
|
||||
|
||||
<caret>
|
||||
}
|
||||
'''
|
||||
generateGetter()
|
||||
myFixture.checkResult '''
|
||||
class Foo {
|
||||
String myName;
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
finally {
|
||||
settings.FIELD_NAME_PREFIX = oldPrefix
|
||||
}
|
||||
}
|
||||
|
||||
public void "test qualified this"() {
|
||||
myFixture.enableInspections(UnqualifiedFieldAccessInspection.class)
|
||||
myFixture.configureByText 'a.java', '''
|
||||
|
||||
@@ -90,6 +90,10 @@ public class JavaTypingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
doTest('{');
|
||||
}
|
||||
|
||||
public void testInsertPairParenBeforeTryBlock() {
|
||||
doTest('(');
|
||||
}
|
||||
|
||||
private void doTest(char c) {
|
||||
myFixture.configureByFile(getTestName(true) + "_before.java");
|
||||
myFixture.type(c);
|
||||
|
||||
@@ -455,6 +455,14 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testCastConversionToTypeParameter() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testTypeDistinctProverForWildcardAndTypeParameter() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
assertNotNull(collectionsClass);
|
||||
|
||||
@@ -296,6 +296,19 @@ class Test {
|
||||
Test.Te<caret>st
|
||||
}
|
||||
}
|
||||
'''
|
||||
assert !myFixture.filterAvailableIntentions("Import class")
|
||||
}
|
||||
|
||||
public void "test don't import class in qualified reference at foreign place"() {
|
||||
myFixture.configureByText 'a.java', '''
|
||||
class Test {
|
||||
{
|
||||
String s = "";
|
||||
s.<caret>
|
||||
String p = "";
|
||||
}
|
||||
}
|
||||
'''
|
||||
assert !myFixture.filterAvailableIntentions("Import class")
|
||||
}
|
||||
|
||||
+2
-1
@@ -446,7 +446,8 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
|
||||
ParameterInfo nameInfo = builder.findParameterization(name);
|
||||
ParameterInfo typeInfo = builder.findParameterization(type);
|
||||
|
||||
if (nameInfo != null && typeInfo != null && !(parameter.getParent() instanceof PsiCatchSection)) {
|
||||
final PsiElement scope = parameter.getDeclarationScope();
|
||||
if (nameInfo != null && typeInfo != null && !(scope instanceof PsiCatchSection) && !(scope instanceof PsiForeachStatement)) {
|
||||
nameInfo.setArgumentContext(false);
|
||||
typeInfo.setArgumentContext(false);
|
||||
typeInfo.setMethodParameterContext(true);
|
||||
|
||||
Reference in New Issue
Block a user