summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-05-07 20:09:46 -0700
committerTor Norbye <tnorbye@google.com>2013-05-07 20:09:46 -0700
commit934b9431b0b827a132df794e307fe5a2b70de00b (patch)
treedadfd1ccaeb2ce0403d306a59b35711531481e2b /plugins
parentf56a0fff1a336635c966bffc25e16af9a4e6e988 (diff)
downloadidea-934b9431b0b827a132df794e307fe5a2b70de00b.tar.gz
Snapshot 5220ac5242aadc343c995ec9a49d09765db4a0c7 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I2494d92b34f89102885b2f39d7552747fafdafec
Diffstat (limited to 'plugins')
-rw-r--r--plugins/InspectionGadgets/src/com/intellij/codeInspection/booleanIsAlwaysInverted/BooleanMethodIsAlwaysInvertedInspection.java13
-rw-r--r--plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java2
-rw-r--r--plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java4
-rw-r--r--plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java8
-rw-r--r--plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/common/CvsOperation.java74
-rw-r--r--plugins/devkit/src/actions/ShowSerializedXmlAction.java3
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java199
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovySmartCompletionTest.groovy4
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/GroovyOverrideImplementTest.groovy12
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveMembersTest.groovy2
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveScriptTest.java2
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy2
-rw-r--r--plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/All_after.groovy6
-rw-r--r--plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/Next_after.groovy2
-rw-r--r--plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/NotComparable_after.groovy2
-rw-r--r--plugins/groovy/testdata/refactoring/changeSignature/AddException_after.java2
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java20
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java25
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java4
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java9
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeJspHandlerProvider.java4
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java9
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/InconsistentResourceBundleInspection.java5
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java5
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java6
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java5
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java1
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/I18nMessageGotoDeclarationHandler.java1
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java5
-rw-r--r--plugins/javaFX/testData/quickfix/CreateControllerMethodInGroovy_after.groovy2
-rw-r--r--plugins/javaFX/testData/quickfix/CreateControllerMethod_after.java2
-rw-r--r--plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java14
-rw-r--r--plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java2
-rw-r--r--plugins/terminal/lib/JPty.jarbin0 -> 1585315 bytes
-rw-r--r--plugins/terminal/lib/jediterm-pty-0.03.jarbin0 -> 66497 bytes
-rw-r--r--plugins/terminal/lib/jna.jarbin0 -> 1369421 bytes
-rw-r--r--plugins/terminal/lib/purejavacomm-0.0.16.jarbin0 -> 185977 bytes
-rw-r--r--plugins/terminal/resources/META-INF/plugin.xml13
-rw-r--r--plugins/terminal/resources/META-INF/terminal.xml9
-rw-r--r--plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java130
-rw-r--r--plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminal.java269
-rw-r--r--plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java101
-rw-r--r--plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java48
-rw-r--r--plugins/terminal/src/org/jetbrains/plugins/terminal/RunLocalTerminalAction.java37
-rw-r--r--plugins/terminal/terminal.iml19
45 files changed, 820 insertions, 262 deletions
diff --git a/plugins/InspectionGadgets/src/com/intellij/codeInspection/booleanIsAlwaysInverted/BooleanMethodIsAlwaysInvertedInspection.java b/plugins/InspectionGadgets/src/com/intellij/codeInspection/booleanIsAlwaysInverted/BooleanMethodIsAlwaysInvertedInspection.java
index dcd264d51d52..e0396ee6d402 100644
--- a/plugins/InspectionGadgets/src/com/intellij/codeInspection/booleanIsAlwaysInverted/BooleanMethodIsAlwaysInvertedInspection.java
+++ b/plugins/InspectionGadgets/src/com/intellij/codeInspection/booleanIsAlwaysInverted/BooleanMethodIsAlwaysInvertedInspection.java
@@ -26,27 +26,32 @@ import java.util.Collection;
public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectionTool {
private static final Key<Boolean> ALWAYS_INVERTED = Key.create("ALWAYS_INVERTED_METHOD");
+ @Override
@NotNull
public String getDisplayName() {
return InspectionsBundle.message("boolean.method.is.always.inverted.display.name");
}
+ @Override
@NotNull
public String getGroupDisplayName() {
return GroupNames.DATA_FLOW_ISSUES;
}
+ @Override
@NotNull
@NonNls
public String getShortName() {
return "BooleanMethodIsAlwaysInverted";
}
+ @Override
@Nullable
public RefGraphAnnotator getAnnotator(final RefManager refManager) {
return new BooleanInvertedAnnotator();
}
+ @Override
public CommonProblemDescriptor[] checkElement(RefEntity refEntity,
AnalysisScope scope,
final InspectionManager manager,
@@ -81,6 +86,7 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
return false;
}
+ @Override
protected boolean queryExternalUsagesRequests(final RefManager manager, final GlobalJavaInspectionContext context,
final ProblemDescriptionsProcessor descriptionsProcessor) {
manager.iterate(new RefJavaVisitor() {
@@ -88,6 +94,7 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
public void visitMethod(@NotNull final RefMethod refMethod) {
if (descriptionsProcessor.getDescriptions(refMethod) != null) { //suspicious method -> need to check external usages
final GlobalJavaInspectionContext.UsagesProcessor usagesProcessor = new GlobalJavaInspectionContext.UsagesProcessor() {
+ @Override
public boolean process(PsiReference psiReference) {
final PsiElement psiReferenceExpression = psiReference.getElement();
if (psiReferenceExpression instanceof PsiReferenceExpression &&
@@ -147,6 +154,7 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
}
private static class BooleanInvertedAnnotator extends RefGraphAnnotator {
+ @Override
public void onInitialize(RefElement refElement) {
if (refElement instanceof RefMethod) {
final PsiElement element = refElement.getElement();
@@ -156,6 +164,7 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
}
}
+ @Override
public void onMarkReferenced(RefElement refWhat, RefElement refFrom, boolean referencedFromClassInitializer) {
checkMethodCall(refWhat, refFrom.getElement());
}
@@ -168,22 +177,26 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
private static class InvertMethodFix implements LocalQuickFix {
+ @Override
@NotNull
public String getName() {
return "Invert method";
}
+ @Override
@NotNull
public String getFamilyName() {
return getName();
}
+ @Override
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
final PsiElement element = descriptor.getPsiElement();
final PsiMethod psiMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
assert psiMethod != null;
final RefactoringActionHandler invertBooleanHandler = JavaRefactoringActionHandlerFactory.getInstance().createInvertBooleanHandler();
final Runnable runnable = new Runnable() {
+ @Override
public void run() {
invertBooleanHandler.invoke(project, new PsiElement[]{psiMethod}, DataManager.getInstance().getDataContext());
}
diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java
index 0e50c94e7df5..d280511a9d22 100644
--- a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java
+++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntCommandLineBuilder.java
@@ -106,6 +106,8 @@ public class AntCommandLineBuilder {
final String antHome = AntInstallation.HOME_DIR.get(antInstallation.getProperties());
vmParametersList.add("-Dant.home=" + antHome);
+ final String libraryDir = antHome + (antHome.endsWith("/") || antHome.endsWith(File.separator) ? "" : File.separator) + "lib";
+ vmParametersList.add("-Dant.library.dir=" + libraryDir);
String[] urls = jdk.getRootProvider().getUrls(OrderRootType.CLASSES);
final String jdkHome = homeDirectory.getPath().replace('/', File.separatorChar);
diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java
index b866d1cd9136..69110fc00c0a 100644
--- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java
+++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java
@@ -21,7 +21,6 @@ import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.vfs.encoding.EncodingManager;
-import com.intellij.util.EnvironmentUtil;
import com.intellij.util.concurrency.Semaphore;
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
import org.netbeans.lib.cvsclient.connection.IConnection;
@@ -142,8 +141,7 @@ public abstract class ConnectionOnProcess implements IConnection {
protected synchronized void execute(GeneralCommandLine commandLine) throws AuthenticationException {
try {
- commandLine.getEnvironment().clear();
- commandLine.getEnvironment().putAll(EnvironmentUtil.getEnvironmentProperties());
+ commandLine.setPassParentEnvironment(true);
myProcess = commandLine.createProcess();
myErrThread = new ReadProcessThread(
diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java
index 3ce20c706b55..f9b797cd1c58 100644
--- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java
+++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -64,11 +64,7 @@ public class ExtConnection extends ConnectionOnProcess {
if (isOpen()) throw new RuntimeException(CvsBundle.message("error.message.connection.already.open"));
GeneralCommandLine command = createRshCommand(myHost, myUserName, myConfiguration);
-
- for (String command1 : commands) {
- command.addParameter(command1);
- }
-
+ command.addParameters(commands);
execute(command);
if (expectedResult != null) {
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/common/CvsOperation.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/common/CvsOperation.java
index 7c779f40f915..57d000b54171 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/common/CvsOperation.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/common/CvsOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -19,6 +19,8 @@ import com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration;
import com.intellij.cvsSupport2.connections.CvsEnvironment;
import com.intellij.cvsSupport2.cvshandlers.CvsHandler;
import com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException;
+import com.intellij.openapi.util.AtomicNotNullLazyValue;
+import com.intellij.openapi.util.NotNullLazyValue;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.EnvironmentUtil;
import org.jetbrains.annotations.NotNull;
@@ -32,54 +34,30 @@ import java.util.HashMap;
import java.util.Map;
public abstract class CvsOperation {
- private final static String[] ourKnownToCvs = {"CVSIGNORE",
- "CVSWRAPPERS",
- "CVSREAD",
- "CVSREADONLYFS",
- "CVSUMASK",
-
- "CVSROOT",
- "CVSEDITOR",
- "EDITOR",
- "VISUAL",
- "PATH",
- //10
- "HOME",
- "HOMEPATH",
- "HOMEDRIVE",
- "CVS_RSH",
- "CVS_SERVER",
-
- "CVS_PASSFILE",
- "CVS_CLIENT_PORT",
- "CVS_PROXY_PORT",
- "CVS_RCMD_PORT",
- "CVS_CLIENT_LOG",
-
- "CVS_SERVER_SLEEP",
- "CVS_IGNORE_REMOTE_ROOT",
- "CVS_LOCAL_BRANCH_NUM",
- "COMSPEC",
- "TMPDIR",
-
- "CVS_PID",
- "COMSPEC",
- "CVS_VERIFY_TEMPLATE",
- "CVS_NOBASES",
- "CVS_SIGN_COMMITS",
-
- "CVS_VERIFY_CHECKOUTS"
- };
- private final static Map<String, String> ourEnvironmentVariablesMap = new HashMap<String, String>();
- static {
- final Map<String, String> environmentProperties = EnvironmentUtil.getEnvironmentProperties();
- for (String name : ourKnownToCvs) {
- final String value = environmentProperties.get(name);
- if (value != null) {
- ourEnvironmentVariablesMap.put(name, value);
+ private static final NotNullLazyValue<Map<String, String>> ourCvsEnvironment = new AtomicNotNullLazyValue<Map<String, String>>() {
+ @NotNull
+ @Override
+ protected Map<String, String> compute() {
+ Map<String, String> cvsEnv = new HashMap<String, String>();
+
+ Map<String, String> knownToCvs = EnvironmentUtil.getEnvironmentMap();
+ @SuppressWarnings("SpellCheckingInspection") String[] toCvs = {
+ "CVSIGNORE", "CVSWRAPPERS", "CVSREAD", "CVSREADONLYFS", "CVSUMASK",
+ "CVSROOT", "CVSEDITOR", "EDITOR", "VISUAL", "PATH", "HOME", "HOMEPATH", "HOMEDRIVE", "CVS_RSH", "CVS_SERVER",
+ "CVS_PASSFILE", "CVS_CLIENT_PORT", "CVS_PROXY_PORT", "CVS_RCMD_PORT", "CVS_CLIENT_LOG",
+ "CVS_SERVER_SLEEP", "CVS_IGNORE_REMOTE_ROOT", "CVS_LOCAL_BRANCH_NUM", "COMSPEC", "TMPDIR",
+ "CVS_PID", "COMSPEC", "CVS_VERIFY_TEMPLATE", "CVS_NOBASES", "CVS_SIGN_COMMITS", "CVS_VERIFY_CHECKOUTS"
+ };
+ for (String name : toCvs) {
+ String value = knownToCvs.get(name);
+ if (value != null) {
+ cvsEnv.put(name, value);
+ }
}
+
+ return cvsEnv;
}
- }
+ };
private final Collection<Runnable> myFinishActions = new ArrayList<Runnable>();
@@ -100,7 +78,7 @@ public abstract class CvsOperation {
protected void modifyOptions(GlobalOptions options) {
options.setUseGzip(CvsApplicationLevelConfiguration.getInstance().USE_GZIP);
if (CvsApplicationLevelConfiguration.getInstance().SEND_ENVIRONMENT_VARIABLES_TO_SERVER) {
- options.setEnvVariables(ourEnvironmentVariablesMap);
+ options.setEnvVariables(ourCvsEnvironment.getValue());
}
}
diff --git a/plugins/devkit/src/actions/ShowSerializedXmlAction.java b/plugins/devkit/src/actions/ShowSerializedXmlAction.java
index 9ef05e35f014..e6280912535c 100644
--- a/plugins/devkit/src/actions/ShowSerializedXmlAction.java
+++ b/plugins/devkit/src/actions/ShowSerializedXmlAction.java
@@ -124,7 +124,8 @@ public class ShowSerializedXmlAction extends DumbAwareAction {
final Element element = XmlSerializer.serialize(o);
final String text = JDOMUtil.writeElement(element, "\n");
- Messages.showInfoMessage(project, text, "Serialized XML for '" + className + "'");
+ Messages.showIdeaMessageDialog(project, text, "Serialized XML for '" + className + "'",
+ new String[]{CommonBundle.getOkButtonText()}, 0, Messages.getInformationIcon(), null);
}
@Nullable
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java
index 66481489f66a..dc6ec8466ee0 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java
@@ -15,8 +15,6 @@
*/
package org.jetbrains.plugins.groovy.compiler;
-import com.intellij.compiler.CompilerManagerImpl;
-import com.intellij.compiler.CompilerTestUtil;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.application.ApplicationConfiguration;
@@ -30,32 +28,25 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.Disposable;
-import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.Result;
-import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.command.WriteCommandAction;
-import com.intellij.openapi.compiler.*;
+import com.intellij.openapi.compiler.CompilerMessage;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.StdModuleTypes;
-import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
+import com.intellij.testFramework.CompilerTester;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
-import com.intellij.testFramework.fixtures.TempDirTestFixture;
-import com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl;
-import com.intellij.util.Consumer;
-import com.intellij.util.ObjectUtils;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
@@ -63,10 +54,8 @@ import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfiguration;
import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfigurationType;
import org.jetbrains.plugins.groovy.util.GroovyUtils;
-import javax.swing.*;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@@ -75,32 +64,15 @@ import java.util.concurrent.atomic.AtomicReference;
* @author peter
*/
public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestCase {
- private TempDirTestFixture myMainOutput;
+ @SuppressWarnings("AbstractMethodCallInConstructor") private CompilerTester myCompilerTester;
protected abstract boolean useJps();
@Override
protected void setUp() throws Exception {
- myMainOutput = new TempDirTestFixtureImpl();
- myMainOutput.setUp();
super.setUp();
getProject().getComponent(GroovyCompilerLoader.class).projectOpened();
- CompilerManagerImpl.testSetup();
-
- new WriteCommandAction(getProject()) {
- @Override
- protected void run(Result result) throws Throwable {
- //noinspection ConstantConditions
- CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
- if (useJps()) {
- CompilerTestUtil.enableExternalCompiler(getProject());
- ModuleRootModificationUtil.setModuleSdk(myModule, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
- }
- else {
- CompilerTestUtil.disableExternalCompiler(getProject());
- }
- }
- }.execute();
+ myCompilerTester = new CompilerTester(useJps(), myModule);
}
@Override
@@ -121,12 +93,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
@Override
public void run() {
try {
- if (useJps()) {
- CompilerTestUtil.disableExternalCompiler(getProject());
- }
-
- myMainOutput.tearDown();
- myMainOutput = null;
+ myCompilerTester.tearDown();
GroovyCompilerTestCase.super.tearDown();
}
catch (Exception e) {
@@ -182,20 +149,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
}
protected void deleteClassFile(final String className) throws IOException {
- AccessToken token = WriteAction.start();
- try {
- if (useJps()) {
- //noinspection ConstantConditions
- touch(myFixture.getJavaFacade().findClass(className).getContainingFile().getVirtualFile());
- }
- else {
- //noinspection ConstantConditions
- findClassFile(className).delete(this);
- }
- }
- finally {
- token.finish();
- }
+ myCompilerTester.deleteClassFile(className);
}
@Nullable
@@ -205,115 +159,35 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
@Nullable
protected VirtualFile findClassFile(String className, Module module) {
- //noinspection ConstantConditions
- VirtualFile path = ModuleRootManager.getInstance(module).getModuleExtension(CompilerModuleExtension.class).getCompilerOutputPath();
- path.getChildren();
- assert path != null;
- path.refresh(false, true);
- return path.findChild(className + ".class");
+ return myCompilerTester.findClassFile(className, module);
}
- protected static void touch(VirtualFile file) throws IOException {
- file.setBinaryContent(file.contentsToByteArray(), -1, file.getTimeStamp() + 1);
- File ioFile = VfsUtil.virtualToIoFile(file);
- assert ioFile.setLastModified(ioFile.lastModified() - 100000);
- file.refresh(false, false);
+ protected void touch(VirtualFile file) throws IOException {
+ myCompilerTester.touch(file);
}
- protected static void setFileText(final PsiFile file, final String barText) throws IOException {
- UIUtil.invokeAndWaitIfNeeded(new Runnable() {
- @Override
- public void run() {
- try {
- final VirtualFile virtualFile = file.getVirtualFile();
- VfsUtil.saveText(ObjectUtils.assertNotNull(virtualFile), barText);
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- });
- touch(file.getVirtualFile());
+ protected void setFileText(final PsiFile file, final String barText) throws IOException {
+ myCompilerTester.setFileText(file, barText);
}
protected void setFileName(final PsiFile bar, final String name) {
- new WriteCommandAction(getProject()) {
- @Override
- protected void run(Result result) throws Throwable {
- bar.setName(name);
- }
- }.execute();
+ myCompilerTester.setFileName(bar, name);
}
protected List<CompilerMessage> make() {
- return runCompiler(new Consumer<ErrorReportingCallback>() {
- @Override
- public void consume(ErrorReportingCallback callback) {
- CompilerManager.getInstance(getProject()).make(callback);
- }
- });
+ return myCompilerTester.make();
}
protected List<CompilerMessage> rebuild() {
- return runCompiler(new Consumer<ErrorReportingCallback>() {
- @Override
- public void consume(ErrorReportingCallback callback) {
- CompilerManager.getInstance(getProject()).rebuild(callback);
- }
- });
+ return myCompilerTester.rebuild();
}
protected List<CompilerMessage> compileModule(final Module module) {
- return runCompiler(new Consumer<ErrorReportingCallback>() {
- @Override
- public void consume(ErrorReportingCallback callback) {
- CompilerManager.getInstance(getProject()).compile(module, callback);
- }
- });
+ return myCompilerTester.compileModule(module);
}
protected List<CompilerMessage> compileFiles(final VirtualFile... files) {
- return runCompiler(new Consumer<ErrorReportingCallback>() {
- @Override
- public void consume(ErrorReportingCallback callback) {
- CompilerManager.getInstance(getProject()).compile(files, callback);
- }
- });
- }
-
- private List<CompilerMessage> runCompiler(final Consumer<ErrorReportingCallback> runnable) {
- final Semaphore semaphore = new Semaphore();
- semaphore.down();
- final ErrorReportingCallback callback = new ErrorReportingCallback(semaphore);
- UIUtil.invokeAndWaitIfNeeded(new Runnable() {
- @Override
- public void run() {
- try {
- if (useJps()) {
- getProject().save();
- CompilerTestUtil.saveApplicationSettings();
- File ioFile = VfsUtil.virtualToIoFile(myModule.getModuleFile());
- if (!ioFile.exists()) {
- getProject().save();
- assert ioFile.exists() : "File does not exist: " + ioFile.getPath();
- }
- }
- runnable.consume(callback);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- });
-
- //tests run in awt
- while (!semaphore.waitFor(100)) {
- if (SwingUtilities.isEventDispatchThread()) {
- UIUtil.dispatchAllInvocationEvents();
- }
- }
- callback.throwException();
- return callback.getMessages();
+ return myCompilerTester.compileFiles(files);
}
protected void assertOutput(String className, String output) throws ExecutionException {
@@ -389,45 +263,4 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
return configuration;
}
- private static class ErrorReportingCallback implements CompileStatusNotification {
- private final Semaphore mySemaphore;
- private Throwable myError;
- private final List<CompilerMessage> myMessages = new ArrayList<CompilerMessage>();
-
- public ErrorReportingCallback(Semaphore semaphore) {
- mySemaphore = semaphore;
- }
-
- @Override
- public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
- try {
- for (CompilerMessageCategory category : CompilerMessageCategory.values()) {
- CompilerMessage[] messages = compileContext.getMessages(category);
- for (CompilerMessage message : messages) {
- final String text = message.getMessage();
- if (category != CompilerMessageCategory.INFORMATION || !(text.startsWith("Compilation completed successfully") || text.startsWith("Using javac"))) {
- myMessages.add(message);
- }
- }
- }
- assertFalse("Code did not compile!", aborted);
- }
- catch (Throwable t) {
- myError = t;
- }
- finally {
- mySemaphore.up();
- }
- }
-
- void throwException() {
- if (myError != null) {
- throw new RuntimeException(myError);
- }
- }
-
- public List<CompilerMessage> getMessages() {
- return myMessages;
- }
- }
}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovySmartCompletionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovySmartCompletionTest.groovy
index c600a4afd775..aeb318e6a027 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovySmartCompletionTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovySmartCompletionTest.groovy
@@ -155,8 +155,8 @@ Runnable r = new Run<caret>
''', '''\
Runnable r = new Runnable() {
@Override
- void run() {
- <caret><selection>//To change body of implemented methods use File | Settings | File Templates.</selection>
+ void run() {<caret><selection></selection>
+
}
}
''')
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/GroovyOverrideImplementTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/GroovyOverrideImplementTest.groovy
index e1663e0ca40a..eac9da9f564e 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/GroovyOverrideImplementTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/GroovyOverrideImplementTest.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -37,7 +37,7 @@ class Test {<caret>}
class Test {
@Override
boolean equals(Object obj) {
- return super.equals(obj) //To change body of overridden methods use File | Settings | File Templates.
+ return super.equals(obj)
}
}
"""
@@ -51,7 +51,7 @@ class Test {<caret>}
myFixture.checkResult """
class Test {
Test() {
- super() //To change body of overridden methods use File | Settings | File Templates.
+ super()
}
}
"""
@@ -73,7 +73,7 @@ class Test {<caret>}
class Test {
@Override
def foo() {
- return super.foo() //To change body of overridden methods use File | Settings | File Templates.
+ return super.foo()
}
}
"""
@@ -93,7 +93,7 @@ class Test<T> extends Base<T> {<caret>}
class Test<T> extends Base<T> {
@Override
def <T> T[] toArray(T[] t) {
- return super.toArray(t) //To change body of overridden methods use File | Settings | File Templates.
+ return super.toArray(t)
}
}
"""
@@ -117,7 +117,7 @@ class X implements I {
@Override
void foo() throws RuntimeException {
- //To change body of implemented methods use File | Settings | File Templates.
+
}
}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveMembersTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveMembersTest.groovy
index 76abb878aa72..014a799aebf8 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveMembersTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveMembersTest.groovy
@@ -107,7 +107,7 @@ public class GroovyMoveMembersTest extends LightCodeInsightFixtureTestCase {
//final File expectedDir = new File(getTestDataPath() + getTestName(true) + "/after");
performAction(sourceClassName, targetClassName, memberIndices);
try {
- PlatformTestUtil.assertDirectoriesEqual(expectedDir, actualDir, VirtualFileFilter.ALL);
+ PlatformTestUtil.assertDirectoriesEqual(expectedDir, actualDir);
}
catch (IOException e) {
throw new RuntimeException(e);
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveScriptTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveScriptTest.java
index f37d061f8bd0..84cbb69ec4d0 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveScriptTest.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveScriptTest.java
@@ -113,7 +113,7 @@ public class GroovyMoveScriptTest extends LightCodeInsightFixtureTestCase {
VirtualFileManager.getInstance().syncRefresh();
try {
- PlatformTestUtil.assertDirectoriesEqual(expectedRoot, actualRoot, VirtualFileFilter.ALL);
+ PlatformTestUtil.assertDirectoriesEqual(expectedRoot, actualRoot);
}
catch (IOException e) {
throw new RuntimeException(e);
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy
index 0e12f9a2c8db..4f6bdabfa7ef 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy
@@ -43,7 +43,7 @@ public abstract class GroovyMoveTestBase extends JavaCodeInsightFixtureTestCase
VirtualFile rootDir2 = localFileSystem.findFileByPath(rootAfter.replace(File.separatorChar, '/' as char));
PostprocessReformattingAspect.getInstance(myFixture.project).doPostponedFormatting();
localFileSystem.refresh(false)
- PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir, PlatformTestUtil.CVS_FILE_FILTER);
+ PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
abstract boolean perform(VirtualFile root, String moveTo, String... names)
diff --git a/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/All_after.groovy b/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/All_after.groovy
index 1106a1868530..7926e42248d6 100644
--- a/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/All_after.groovy
+++ b/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/All_after.groovy
@@ -1,16 +1,16 @@
class Foo implements Comparable<Foo> {
def Foo next() {
- return null //To change body of implemented methods use File | Settings | File Templates.
+ return null
}
def Foo previous() {
- return null //To change body of implemented methods use File | Settings | File Templates.
+ return null
}
@Override
int compareTo(Foo o) {
- <selection>return 0 //To change body of implemented methods use File | Settings | File Templates.</selection>
+ <selection>return 0</selection>
}
}
diff --git a/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/Next_after.groovy b/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/Next_after.groovy
index d19e61c89d54..cb721d5e47a7 100644
--- a/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/Next_after.groovy
+++ b/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/Next_after.groovy
@@ -9,7 +9,7 @@ class Foo implements Comparable<Foo> {
}
def Foo next() {
- return null //To change body of implemented methods use File | Settings | File Templates.
+ return null
}
}
diff --git a/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/NotComparable_after.groovy b/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/NotComparable_after.groovy
index c34954dc3c1e..abe77012de57 100644
--- a/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/NotComparable_after.groovy
+++ b/plugins/groovy/testdata/groovy/inspections/rangeTypeCheck/NotComparable_after.groovy
@@ -4,7 +4,7 @@ class Foo implements Comparable<Foo> {
@Override
int compareTo(Foo o) {
- <selection>return 0 //To change body of implemented methods use File | Settings | File Templates.</selection>
+ <selection>return 0</selection>
}
}
diff --git a/plugins/groovy/testdata/refactoring/changeSignature/AddException_after.java b/plugins/groovy/testdata/refactoring/changeSignature/AddException_after.java
index 37316f1632c3..f7ebcf0b152d 100644
--- a/plugins/groovy/testdata/refactoring/changeSignature/AddException_after.java
+++ b/plugins/groovy/testdata/refactoring/changeSignature/AddException_after.java
@@ -3,7 +3,7 @@ class Foo {
try {
new AddException().foo();
} catch (java.io.IOException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ e.printStackTrace();
}
}
} \ No newline at end of file
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
index 681ab2124298..eae515b2323e 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
@@ -63,6 +63,7 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
@SuppressWarnings({"WeakerAccess"}) public boolean IGNORE_PROPERTY_KEYS = false;
@NonNls private static final String BR = "<br>";
+ @Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
return new JavaElementVisitor() {
@@ -76,16 +77,19 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
};
}
+ @Override
@NotNull
public String getDisplayName() {
return InspectionsBundle.message("inspection.duplicates.display.name");
}
+ @Override
@NotNull
public String getGroupDisplayName() {
return GroupNames.INTERNATIONALIZATION_GROUP_NAME;
}
+ @Override
@NotNull
public String getShortName() {
return "DuplicateStringLiteralInspection";
@@ -106,6 +110,7 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
if (words.isEmpty()) return;
// put longer strings first
Collections.sort(words, new Comparator<String>() {
+ @Override
public int compare(final String o1, final String o2) {
return o2.length() - o1.length();
}
@@ -170,6 +175,7 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
String classList;
if (isOnTheFly) {
classList = StringUtil.join(tenClassesMost, new Function<PsiClass, String>() {
+ @Override
public String fun(final PsiClass aClass) {
final boolean thisFile = aClass.getContainingFile() == originalExpression.getContainingFile();
//noinspection HardCodedStringLiteral
@@ -180,6 +186,7 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
}
else {
classList = StringUtil.join(tenClassesMost, new Function<PsiClass, String>() {
+ @Override
public String fun(final PsiClass aClass) {
return "'" + aClass.getQualifiedName() + "'";
}
@@ -254,18 +261,22 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
return null;
}
+ @Override
public boolean isEnabledByDefault() {
return false;
}
+ @Override
public JComponent createOptionsPanel() {
final OptionsPanel optionsPanel = new OptionsPanel();
optionsPanel.myIgnorePropertyKeyExpressions.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent e) {
IGNORE_PROPERTY_KEYS = optionsPanel.myIgnorePropertyKeyExpressions.isSelected();
}
});
optionsPanel.myMinStringLengthField.getDocument().addDocumentListener(new DocumentAdapter() {
+ @Override
protected void textChanged(final DocumentEvent e) {
try {
MIN_STRING_LENGTH = Integer.parseInt(optionsPanel.myMinStringLengthField.getText());
@@ -296,13 +307,16 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
}
}
+ @Override
@NotNull
public String getName() {
return InspectionsBundle.message("introduce.constant.across.the.project");
}
+ @Override
public void applyFix(@NotNull final Project project, @NotNull ProblemDescriptor descriptor) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
if (project.isDisposed()) return;
final List<PsiExpression> expressions = new ArrayList<PsiExpression>();
@@ -314,17 +328,21 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
}
final PsiExpression[] expressionArray = expressions.toArray(new PsiExpression[expressions.size()]);
final IntroduceConstantHandler handler = new IntroduceConstantHandler() {
+ @Override
protected OccurrenceManager createOccurrenceManager(PsiExpression selectedExpr, PsiClass parentClass) {
final OccurrenceFilter filter = new OccurrenceFilter() {
+ @Override
public boolean isOK(PsiExpression occurrence) {
return true;
}
};
return new BaseOccurrenceManager(filter) {
+ @Override
protected PsiExpression[] defaultOccurrences() {
return expressionArray;
}
+ @Override
protected PsiExpression[] findOccurrences() {
return expressionArray;
}
@@ -336,6 +354,7 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
});
}
+ @Override
@NotNull
public String getFamilyName() {
return getName();
@@ -383,6 +402,7 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
}
}
+ @Override
@NotNull
public String getFamilyName() {
return InspectionsBundle.message("inspection.duplicates.replace.family.quickfix");
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java
index cd3ab4bc0a1d..45da972b97f5 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java
@@ -117,6 +117,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
}
}
+ @Override
public void readSettings(@NotNull Element node) throws InvalidDataException {
super.readSettings(node);
for (Object o : node.getChildren()) {
@@ -131,26 +132,31 @@ public class I18nInspection extends BaseLocalInspectionTool {
cacheNonNlsCommentPattern();
}
+ @Override
@NotNull
public String getGroupDisplayName() {
return GroupNames.INTERNATIONALIZATION_GROUP_NAME;
}
+ @Override
@NotNull
public String getDisplayName() {
return CodeInsightBundle.message("inspection.i18n.display.name");
}
+ @Override
@NotNull
public String getShortName() {
return "HardCodedStringLiteral";
}
+ @Override
public JComponent createOptionsPanel() {
final GridBagLayout layout = new GridBagLayout();
final JPanel panel = new JPanel(layout);
final JCheckBox assertStatementsCheckbox = new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.assert"), ignoreForAssertStatements);
assertStatementsCheckbox.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForAssertStatements = assertStatementsCheckbox.isSelected();
}
@@ -159,6 +165,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.for.exception.constructor.arguments"),
ignoreForExceptionConstructors);
exceptionConstructorCheck.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForExceptionConstructors = exceptionConstructorCheck.isSelected();
}
@@ -166,6 +173,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
final JTextField specifiedExceptions = new JTextField(ignoreForSpecifiedExceptionConstructors);
specifiedExceptions.getDocument().addDocumentListener(new DocumentAdapter(){
+ @Override
protected void textChanged(DocumentEvent e) {
ignoreForSpecifiedExceptionConstructors = specifiedExceptions.getText();
}
@@ -174,36 +182,42 @@ public class I18nInspection extends BaseLocalInspectionTool {
final JCheckBox junitAssertCheckbox = new JCheckBox(
CodeInsightBundle.message("inspection.i18n.option.ignore.for.junit.assert.arguments"), ignoreForJUnitAsserts);
junitAssertCheckbox.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForJUnitAsserts = junitAssertCheckbox.isSelected();
}
});
final JCheckBox classRef = new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.qualified.class.names"), ignoreForClassReferences);
classRef.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForClassReferences = classRef.isSelected();
}
});
final JCheckBox propertyRef = new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.property.keys"), ignoreForPropertyKeyReferences);
propertyRef.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForPropertyKeyReferences = propertyRef.isSelected();
}
});
final JCheckBox nonAlpha = new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.nonalphanumerics"), ignoreForNonAlpha);
nonAlpha.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForNonAlpha = nonAlpha.isSelected();
}
});
final JCheckBox assignedToConstants = new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.assigned.to.constants"), ignoreAssignedToConstants);
assignedToConstants.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreAssignedToConstants = assignedToConstants.isSelected();
}
});
final JCheckBox chkToString = new JCheckBox(CodeInsightBundle.message("inspection.i18n.option.ignore.tostring"), ignoreToString);
chkToString.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreToString = chkToString.isSelected();
}
@@ -211,6 +225,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
final JCheckBox ignoreEnumConstants = new JCheckBox("Ignore enum constants", ignoreForEnumConstants);
ignoreEnumConstants.addChangeListener(new ChangeListener() {
+ @Override
public void stateChanged(ChangeEvent e) {
ignoreForEnumConstants = ignoreEnumConstants.isSelected();
}
@@ -239,6 +254,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
CodeInsightBundle.message("inspection.i18n.option.ignore.for.specified.exception.constructor.arguments"),
openProjects.length == 0 ? null :
new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
createIgnoreExceptionsConfigurationDialog(openProjects[0], specifiedExceptions).show();
}
@@ -270,6 +286,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
final FieldPanel nonNlsCommentPatternComponent =
new FieldPanel(text, CodeInsightBundle.message("inspection.i18n.option.ignore.comment.pattern"),
CodeInsightBundle.message("inspection.i18n.option.ignore.comment.title"), null, new Runnable() {
+ @Override
public void run() {
nonNlsCommentPattern = text.getText();
cacheNonNlsCommentPattern();
@@ -297,6 +314,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
init();
}
+ @Override
protected JComponent createCenterPanel() {
final String[] ignored = ignoreForSpecifiedExceptionConstructors.split(",");
final List<String> initialList = new ArrayList<String>();
@@ -306,6 +324,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
}
}
myPanel = new AddDeleteListPanel<String>(null, initialList) {
+ @Override
protected String findItemToAdd() {
final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project).
@@ -320,6 +339,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
return myPanel;
}
+ @Override
protected void doOKAction() {
StringBuilder buf = new StringBuilder();
final Object[] exceptions = myPanel.getListItems();
@@ -407,14 +427,17 @@ public class I18nInspection extends BaseLocalInspectionTool {
private static LocalQuickFix createIntroduceConstantFix() {
return new LocalQuickFix() {
+ @Override
@NotNull
public String getName() {
return IntroduceConstantHandler.REFACTORING_NAME;
}
+ @Override
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
//do it later because it is invoked from write action
ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
public void run() {
PsiElement element = descriptor.getPsiElement();
if (!(element instanceof PsiExpression)) return;
@@ -425,6 +448,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
}, project.getDisposed());
}
+ @Override
@NotNull
public String getFamilyName() {
return getName();
@@ -618,6 +642,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
return JavaPsiFacade.getInstance(expression.getProject()).findClass(value, GlobalSearchScope.allScope(expression.getProject())) != null;
}
+ @Override
public boolean isEnabledByDefault() {
return false;
}
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java
index 301e66b1b273..43a649181141 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java
@@ -40,6 +40,7 @@ import java.util.Collection;
public class I18nizeAction extends AnAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.i18n.I18nizeAction");
+ @Override
public void update(AnActionEvent e) {
boolean active = getHandler(e) != null;
if (ActionPlaces.isPopupPlace(e.getPlace())) {
@@ -119,8 +120,10 @@ public class I18nizeAction extends AnAction {
}
ApplicationManager.getApplication().runWriteAction(new Runnable(){
+ @Override
public void run() {
CommandProcessor.getInstance().executeCommand(project, new Runnable(){
+ @Override
public void run() {
try {
handler.performI18nization(psiFile, editor, dialog.getLiteralExpression(), propertiesFiles, dialog.getKey(), StringUtil.unescapeStringCharacters(dialog.getValue()),
@@ -136,6 +139,7 @@ public class I18nizeAction extends AnAction {
});
}
+ @Override
public void actionPerformed(AnActionEvent e) {
final Editor editor = getEditor(e);
final Project project = editor.getProject();
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java
index 0bd365da2f3f..7775d941fc35 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java
@@ -38,6 +38,7 @@ public class I18nizeConcatenationQuickFix extends I18nizeQuickFix{
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.i18n.I18nizeConcatenationQuickFix");
@NonNls private static final String PARAMETERS_OPTION_KEY = "PARAMETERS";
+ @Override
public void checkApplicability(final PsiFile psiFile, final Editor editor) throws IncorrectOperationException {
PsiPolyadicExpression concatenation = getEnclosingLiteralConcatenation(psiFile, editor);
if (concatenation != null) return;
@@ -45,6 +46,7 @@ public class I18nizeConcatenationQuickFix extends I18nizeQuickFix{
throw new IncorrectOperationException(message);
}
+ @Override
public JavaI18nizeQuickFixDialog createDialog(Project project, Editor editor, PsiFile psiFile) {
PsiPolyadicExpression concatenation = getEnclosingLiteralConcatenation(psiFile, editor);
PsiLiteralExpression literalExpression = getContainingLiteral(concatenation);
@@ -52,11 +54,13 @@ public class I18nizeConcatenationQuickFix extends I18nizeQuickFix{
return createDialog(project, psiFile, literalExpression);
}
+ @Override
@NotNull
public String getName() {
return CodeInsightBundle.message("quickfix.i18n.concatentation");
}
+ @Override
protected PsiElement doReplacementInJava(@NotNull final PsiFile psiFile,
@NotNull final Editor editor,
@Nullable PsiLiteralExpression literalExpression,
@@ -78,6 +82,7 @@ public class I18nizeConcatenationQuickFix extends I18nizeQuickFix{
return result.toString();
}
+ @Override
protected JavaI18nizeQuickFixDialog createDialog(final Project project, final PsiFile context, final PsiLiteralExpression literalExpression) {
PsiPolyadicExpression concatenation = getEnclosingLiteralConcatenation(literalExpression);
StringBuilder formatString = new StringBuilder();
@@ -90,20 +95,24 @@ public class I18nizeConcatenationQuickFix extends I18nizeQuickFix{
}
return new JavaI18nizeQuickFixDialog(project, context, literalExpression, formatString.toString(), null, true, true) {
+ @Override
@Nullable
protected String getTemplateName() {
return myResourceBundleManager.getConcatenationTemplateName();
}
+ @Override
protected String generateText(final I18nizedTextGenerator textGenerator, final String propertyKey, final PropertiesFile propertiesFile,
final PsiLiteralExpression literalExpression) {
return textGenerator.getI18nizedConcatenationText(propertyKey, composeParametersText(args), propertiesFile, literalExpression);
}
+ @Override
public PsiExpression[] getParameters() {
return args.toArray(new PsiExpression[args.size()]);
}
+ @Override
protected void addAdditionalAttributes(final Map<String, String> attributes) {
attributes.put(PARAMETERS_OPTION_KEY, composeParametersText(args));
}
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeJspHandlerProvider.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeJspHandlerProvider.java
index 1553ec50decb..916330bedf6f 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeJspHandlerProvider.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeJspHandlerProvider.java
@@ -38,6 +38,7 @@ import java.util.Collection;
public class I18nizeJspHandlerProvider extends I18nizeHandlerProvider {
private static final I18nQuickFixHandler HADLER = new I18nQuickFixHandler() {
+ @Override
public void checkApplicability(final PsiFile psiFile, final Editor editor) throws IncorrectOperationException {
final JspFile jspFile = (JspFile)psiFile;
@@ -63,6 +64,7 @@ public class I18nizeJspHandlerProvider extends I18nizeHandlerProvider {
});
}
+ @Override
public void performI18nization(final PsiFile psiFile,
final Editor editor,
PsiLiteralExpression literalExpression,
@@ -77,6 +79,7 @@ public class I18nizeJspHandlerProvider extends I18nizeHandlerProvider {
editor.getDocument().replaceString(selectedText.getStartOffset(), selectedText.getEndOffset(), i18nizedText);
}
+ @Override
public JavaI18nizeQuickFixDialog createDialog(final Project project, final Editor editor, final PsiFile psiFile) {
JspFile jspFile = (JspFile)psiFile;
@@ -84,6 +87,7 @@ public class I18nizeJspHandlerProvider extends I18nizeHandlerProvider {
if (selectedRange == null) return null;
String text = editor.getDocument().getText(selectedRange);
return new JavaI18nizeQuickFixDialog(project, jspFile, null, text, null, false, true){
+ @Override
protected String getTemplateName() {
return JavaTemplateUtil.TEMPLATE_I18NIZED_JSP_EXPRESSION;
}
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java
index 5d3eef4afe9d..44514c9dadf6 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java
@@ -48,25 +48,30 @@ public class I18nizeQuickFix implements LocalQuickFix, I18nQuickFixHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.i18n.I18nizeQuickFix");
private TextRange mySelectionRange;
+ @Override
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
// do it later because the fix was called inside writeAction
ApplicationManager.getApplication().invokeLater(new Runnable(){
+ @Override
public void run() {
doFix(descriptor, project);
}
});
}
+ @Override
@NotNull
public String getName() {
return CodeInsightBundle.message("inspection.i18n.quickfix");
}
+ @Override
@NotNull
public String getFamilyName() {
return getName();
}
+ @Override
public void checkApplicability(final PsiFile psiFile, final Editor editor) throws IncorrectOperationException {
PsiLiteralExpression literalExpression = I18nizeAction.getEnclosingStringLiteral(psiFile, editor);
if (literalExpression != null) {
@@ -84,6 +89,7 @@ public class I18nizeQuickFix implements LocalQuickFix, I18nQuickFixHandler {
throw new IncorrectOperationException(message);
}
+ @Override
public void performI18nization(final PsiFile psiFile,
final Editor editor,
PsiLiteralExpression literalExpression,
@@ -103,6 +109,7 @@ public class I18nizeQuickFix implements LocalQuickFix, I18nQuickFixHandler {
}
}
+ @Override
public JavaI18nizeQuickFixDialog createDialog(Project project, Editor editor, PsiFile psiFile) {
final PsiLiteralExpression literalExpression = I18nizeAction.getEnclosingStringLiteral(psiFile, editor);
return createDialog(project, psiFile, literalExpression);
@@ -126,8 +133,10 @@ public class I18nizeQuickFix implements LocalQuickFix, I18nQuickFixHandler {
}
CommandProcessor.getInstance().executeCommand(project, new Runnable(){
+ @Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable(){
+ @Override
public void run() {
try {
performI18nization(psiFile, PsiUtilBase.findEditor(psiFile), dialog.getLiteralExpression(), propertiesFiles, dialog.getKey(),
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InconsistentResourceBundleInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InconsistentResourceBundleInspection.java
index 337dd6e2c2e1..f04eac725116 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InconsistentResourceBundleInspection.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InconsistentResourceBundleInspection.java
@@ -43,26 +43,31 @@ public class InconsistentResourceBundleInspection extends GlobalSimpleInspection
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_INCONSISTENT_PROPERTIES = true;
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_DUPLICATED_PROPERTIES = true;
+ @Override
@NotNull
public String getGroupDisplayName() {
return PropertiesBundle.message("properties.files.inspection.group.display.name");
}
+ @Override
@NotNull
public String getDisplayName() {
return InspectionsBundle.message("inconsistent.resource.bundle.display.name");
}
+ @Override
@NotNull
public String getShortName() {
return "InconsistentResourceBundle";
}
+ @Override
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.ERROR;
}
+ @Override
@Nullable
public JComponent createOptionsPanel() {
final MultipleCheckboxOptionsPanel panel = new MultipleCheckboxOptionsPanel(this);
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java
index 2629df214dee..0686a42a2930 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java
@@ -45,26 +45,31 @@ import java.util.*;
*/
public class InvalidPropertyKeyInspection extends BaseJavaLocalInspectionTool {
+ @Override
@NotNull
public String getGroupDisplayName() {
return GroupNames.PROPERTIES_GROUP_NAME;
}
+ @Override
@NotNull
public String getDisplayName() {
return CodeInsightBundle.message("inspection.unresolved.property.key.reference.name");
}
+ @Override
@NotNull
public String getShortName() {
return "UnresolvedPropertyKey";
}
+ @Override
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.ERROR;
}
+ @Override
public boolean isEnabledByDefault() {
return true;
}
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java
index ed3ea59391d2..327aad8a6dde 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java
@@ -46,6 +46,7 @@ import java.util.*;
*/
public class JavaI18nUtil extends I18nUtil {
public static final PropertyCreationHandler DEFAULT_PROPERTY_CREATION_HANDLER = new PropertyCreationHandler() {
+ @Override
public void createProperty(final Project project, final Collection<PropertiesFile> propertiesFiles, final String key, final String value,
final PsiExpression[] parameters) throws IncorrectOperationException {
JavaI18nUtil.createProperty(project, propertiesFiles, key, value);
@@ -74,7 +75,7 @@ public class JavaI18nUtil extends I18nUtil {
if (parent instanceof PsiVariable) {
final PsiAnnotation annotation = AnnotationUtil.findAnnotation((PsiVariable)parent, AnnotationUtil.PROPERTY_KEY);
if (annotation != null) {
- return processAnnotationAttributes(annotationAttributeValues, annotation);
+ return processAnnotationAttributes(annotationAttributeValues, annotation);
}
}
return isPassedToAnnotatedParam(project, expression, AnnotationUtil.PROPERTY_KEY, annotationAttributeValues, null);
@@ -285,6 +286,7 @@ public class JavaI18nUtil extends I18nUtil {
private static void addAvailableMethodsOfType(final PsiClassType type, final PsiLiteralExpression context, final Collection<String> result) {
PsiScopesUtil.treeWalkUp(new PsiScopeProcessor() {
+ @Override
public boolean execute(@NotNull PsiElement element, ResolveState state) {
if (element instanceof PsiMethod) {
PsiMethod method = (PsiMethod)element;
@@ -297,10 +299,12 @@ public class JavaI18nUtil extends I18nUtil {
return true;
}
+ @Override
public <T> T getHint(@NotNull Key<T> hintKey) {
return null;
}
+ @Override
public void handleEvent(Event event, Object associated) {
}
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java
index a26f4d610fcd..f7040bef5c14 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java
@@ -123,6 +123,7 @@ public class JavaI18nizeQuickFixDialog extends I18nizeQuickFixDialog {
myResourceBundleSuggester.add(myRBEditorTextField, BorderLayout.CENTER);
suggestAvailableResourceBundleExpressions();
myRBEditorTextField.addDocumentListener(new DocumentAdapter() {
+ @Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
somethingChanged();
}
@@ -135,10 +136,12 @@ public class JavaI18nizeQuickFixDialog extends I18nizeQuickFixDialog {
if (templateName != null) {
HyperlinkLabel link = new HyperlinkLabel(CodeInsightBundle.message("i18nize.dialog.template.link.label"));
link.addHyperlinkListener(new HyperlinkListener() {
+ @Override
public void hyperlinkUpdate(HyperlinkEvent e) {
final FileTemplateConfigurable configurable = new FileTemplateConfigurable();
final FileTemplate template = FileTemplateManager.getInstance().getCodeTemplate(templateName);
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
configurable.setTemplate(template, null);
}
@@ -210,12 +213,14 @@ public class JavaI18nizeQuickFixDialog extends I18nizeQuickFixDialog {
myRBEditorTextField.setHistory(ArrayUtil.toStringArray(result));
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
myRBEditorTextField.setSelectedIndex(0);
}
});
}
+ @Override
protected void somethingChanged() {
if (myShowPreview) {
myPreviewLabel.setText(getI18nizedText());
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java
index ec5d46147c36..4b7f1bdaa37c 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java
@@ -88,6 +88,7 @@ class SuppressByCommentOutAction extends SuppressIntentionAction {
return null;
}
+ @Override
@NotNull
public String getFamilyName() {
return InspectionsBundle.message("suppress.inspection.family");
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/I18nMessageGotoDeclarationHandler.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/I18nMessageGotoDeclarationHandler.java
index f959676daadf..b70466396284 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/I18nMessageGotoDeclarationHandler.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/I18nMessageGotoDeclarationHandler.java
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable;
public class I18nMessageGotoDeclarationHandler extends GotoDeclarationHandlerBase {
private static final Key<FoldingBuilder> KEY = CompositeFoldingBuilder.FOLDING_BUILDER;
+ @Override
public PsiElement getGotoDeclarationTarget(PsiElement element, Editor editor) {
if (!(element instanceof PsiJavaToken)) return null;
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java
index 59d56b4ddeb0..51dc0a7daaa3 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java
@@ -49,6 +49,7 @@ public class PropertyFoldingBuilder extends FoldingBuilderEx {
private static final Key<IProperty> CACHE = Key.create("i18n.property.cache");
public static final IProperty NULL = new PropertyImpl(new PropertyStubImpl(null, null), PropertiesElementTypes.PROPERTY);
+ @Override
@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement element, @NotNull Document document, boolean quick) {
if (!(element instanceof PsiJavaFile) || quick || !isFoldingsOn()) {
@@ -115,6 +116,7 @@ public class PropertyFoldingBuilder extends FoldingBuilderEx {
}
+ @Override
public String getPlaceholderText(@NotNull ASTNode node) {
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(node);
if (element instanceof PsiLiteralExpression) {
@@ -197,7 +199,7 @@ public class PropertyFoldingBuilder extends FoldingBuilderEx {
private static boolean isValid(Property property, PsiLiteralExpression literal) {
if (literal == null || property == null || !property.isValid()) return false;
- return StringUtil.unquoteString(literal.getText()).equals(property.getKey());
+ return StringUtil.unquoteString(literal.getText()).equals(property.getKey());
}
private static String formatI18nProperty(PsiLiteralExpression literal, IProperty property) {
@@ -205,6 +207,7 @@ public class PropertyFoldingBuilder extends FoldingBuilderEx {
literal.getText() : "\"" + property.getValue() + "\"";
}
+ @Override
public boolean isCollapsedByDefault(@NotNull ASTNode node) {
return isFoldingsOn();
}
diff --git a/plugins/javaFX/testData/quickfix/CreateControllerMethodInGroovy_after.groovy b/plugins/javaFX/testData/quickfix/CreateControllerMethodInGroovy_after.groovy
index 0d4740e36633..62ebbfc476a1 100644
--- a/plugins/javaFX/testData/quickfix/CreateControllerMethodInGroovy_after.groovy
+++ b/plugins/javaFX/testData/quickfix/CreateControllerMethodInGroovy_after.groovy
@@ -1,5 +1,5 @@
public class CreateControllerMethodInGroovy {
public void bar(ActionEvent actionEvent) {
- //To change body of created methods use File | Settings | File Templates.
+
}
} \ No newline at end of file
diff --git a/plugins/javaFX/testData/quickfix/CreateControllerMethod_after.java b/plugins/javaFX/testData/quickfix/CreateControllerMethod_after.java
index cdf4f4d6d1a5..d410e79b41fe 100644
--- a/plugins/javaFX/testData/quickfix/CreateControllerMethod_after.java
+++ b/plugins/javaFX/testData/quickfix/CreateControllerMethod_after.java
@@ -2,6 +2,6 @@ import javafx.event.ActionEvent;
public class CreateControllerMethod {
public void bar(ActionEvent actionEvent) {
- //To change body of created methods use File | Settings | File Templates.
+
}
} \ No newline at end of file
diff --git a/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java b/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
index 837383eb5480..501c2dfa68d9 100644
--- a/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
+++ b/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
@@ -161,8 +161,10 @@ public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
final ProgressIndicator original = ProgressManager.getInstance().getProgressIndicator();
final ProgressIndicator progress = ProgressWrapper.wrap(original);
ProgressManager.getInstance().runProcess(new Runnable() {
+ @Override
public void run() {
if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(properties, progress, false, new Processor<IProperty>() {
+ @Override
public boolean process(final IProperty property) {
if (original != null) {
if (original.isCanceled()) return false;
@@ -338,6 +340,7 @@ public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
final List<String> words = StringUtil.getWordsIn(stringToFind);
if (words.isEmpty()) return;
Collections.sort(words, new Comparator<String>() {
+ @Override
public int compare(final String o1, final String o2) {
return o2.length() - o1.length();
}
@@ -355,25 +358,30 @@ public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
}
}
+ @Override
@NotNull
public String getDisplayName() {
return InspectionsBundle.message("duplicate.property.display.name");
}
+ @Override
@NotNull
public String getGroupDisplayName() {
return InspectionsBundle.message("group.names.properties.files");
}
+ @Override
@NotNull
public String getShortName() {
return "DuplicatePropertyInspection";
}
+ @Override
public boolean isEnabledByDefault() {
return false;
}
+ @Override
public JComponent createOptionsPanel() {
return new OptionsPanel().myWholePanel;
}
@@ -398,11 +406,13 @@ public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
myProjectScope.setSelected(!(CURRENT_FILE || MODULE_WITH_DEPENDENCIES));
myFileScope.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
CURRENT_FILE = myFileScope.isSelected();
}
});
myModuleScope.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
MODULE_WITH_DEPENDENCIES = myModuleScope.isSelected();
if (MODULE_WITH_DEPENDENCIES) {
@@ -411,6 +421,7 @@ public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
}
});
myProjectScope.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
if (myProjectScope.isSelected()) {
CURRENT_FILE = false;
@@ -424,16 +435,19 @@ public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
myDuplicateBoth.setSelected(CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES);
myDuplicateKeys.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
CHECK_DUPLICATE_KEYS = myDuplicateKeys.isSelected();
}
});
myDuplicateValues.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
CHECK_DUPLICATE_VALUES = myDuplicateValues.isSelected();
}
});
myDuplicateBoth.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES = myDuplicateBoth.isSelected();
}
diff --git a/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java b/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
index 86d58988e5fe..2f8370defdba 100644
--- a/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
+++ b/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
@@ -43,11 +43,13 @@ import org.jetbrains.annotations.NotNull;
* @author cdr
*/
public class UnusedPropertyInspection extends PropertySuppressableInspectionBase {
+ @Override
@NotNull
public String getDisplayName() {
return PropertiesBundle.message("unused.property.inspection.display.name");
}
+ @Override
@NotNull
public String getShortName() {
return "UnusedProperty";
diff --git a/plugins/terminal/lib/JPty.jar b/plugins/terminal/lib/JPty.jar
new file mode 100644
index 000000000000..1859fcfe3343
--- /dev/null
+++ b/plugins/terminal/lib/JPty.jar
Binary files differ
diff --git a/plugins/terminal/lib/jediterm-pty-0.03.jar b/plugins/terminal/lib/jediterm-pty-0.03.jar
new file mode 100644
index 000000000000..bd3fbb5990b7
--- /dev/null
+++ b/plugins/terminal/lib/jediterm-pty-0.03.jar
Binary files differ
diff --git a/plugins/terminal/lib/jna.jar b/plugins/terminal/lib/jna.jar
new file mode 100644
index 000000000000..4e05a4aba748
--- /dev/null
+++ b/plugins/terminal/lib/jna.jar
Binary files differ
diff --git a/plugins/terminal/lib/purejavacomm-0.0.16.jar b/plugins/terminal/lib/purejavacomm-0.0.16.jar
new file mode 100644
index 000000000000..dc41f6e444b8
--- /dev/null
+++ b/plugins/terminal/lib/purejavacomm-0.0.16.jar
Binary files differ
diff --git a/plugins/terminal/resources/META-INF/plugin.xml b/plugins/terminal/resources/META-INF/plugin.xml
new file mode 100644
index 000000000000..0d6ad053a0f9
--- /dev/null
+++ b/plugins/terminal/resources/META-INF/plugin.xml
@@ -0,0 +1,13 @@
+<idea-plugin version="2" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <name>Terminal</name>
+ <id>org.jetbrains.plugins.terminal</id>
+ <version>0.1</version>
+ <vendor>JetBrains</vendor>
+ <description>Embedded Terminal</description>
+
+ <xi:include href="/META-INF/terminal.xml" xpointer="xpointer(/idea-plugin/*)"/>
+
+ <extensions defaultExtensionNs="com.intellij">
+ <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+ </extensions>
+</idea-plugin>
diff --git a/plugins/terminal/resources/META-INF/terminal.xml b/plugins/terminal/resources/META-INF/terminal.xml
new file mode 100644
index 000000000000..9e9addb6fe2a
--- /dev/null
+++ b/plugins/terminal/resources/META-INF/terminal.xml
@@ -0,0 +1,9 @@
+<idea-plugin version="2">
+ <actions>
+ <action id="org.jetbrains.plugins.terminal.RunLocalTerminalAction"
+ class="org.jetbrains.plugins.terminal.RunLocalTerminalAction"
+ text="Open Terminal..." description="Open terminal locally">
+ <add-to-group group-id="ToolsMenu" anchor="last"/>
+ </action>
+ </actions>
+</idea-plugin>
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
new file mode 100644
index 000000000000..4de14e4464d3
--- /dev/null
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
@@ -0,0 +1,130 @@
+package org.jetbrains.plugins.terminal;
+
+import com.intellij.execution.ExecutionManager;
+import com.intellij.execution.Executor;
+import com.intellij.execution.ExecutorRegistry;
+import com.intellij.execution.executors.DefaultRunExecutor;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.execution.ui.RunContentDescriptor;
+import com.intellij.execution.ui.actions.CloseAction;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.progress.Task;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.openapi.wm.ToolWindow;
+import com.intellij.openapi.wm.ToolWindowManager;
+import com.intellij.util.ui.UIUtil;
+import com.jediterm.emulator.TtyConnector;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * @author traff
+ */
+public abstract class AbstractTerminalRunner<T extends Process> {
+ private static final Logger LOG = Logger.getInstance(AbstractTerminalRunner.class.getName());
+ @NotNull
+ protected final Project myProject;
+
+ public AbstractTerminalRunner(@NotNull Project project) {
+ myProject = project;
+ }
+
+ public void run() {
+ ProgressManager.getInstance().run(new Task.Backgroundable(myProject, "Connecting to terminal", false) {
+ public void run(@NotNull final ProgressIndicator indicator) {
+ indicator.setText("Connecting to terminal...");
+ try {
+ doRun();
+ }
+ catch (Exception e) {
+ LOG.warn("Error running terminal", e);
+ Messages.showErrorDialog(AbstractTerminalRunner.this.getProject(), getTitle(), e.getMessage());
+ }
+ }
+ });
+ }
+
+ private void doRun() {
+ // Create Server process
+ try {
+ final T process = createProcess();
+
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ @Override
+ public void run() {
+ initConsoleUI(process);
+ }
+ });
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ protected abstract T createProcess() throws ExecutionException;
+
+ protected abstract ProcessHandler createProcessHandler(T process);
+
+ private void initConsoleUI(final T process) {
+ final Executor defaultExecutor = ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID);
+ final DefaultActionGroup toolbarActions = new DefaultActionGroup();
+ final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
+
+ final JBTerminal term = new JBTerminal();
+
+ term.setTtyConnector(createTtyConnector(process));
+
+ final JPanel panel = new JPanel(new BorderLayout());
+ panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
+
+ panel.add(term, BorderLayout.CENTER);
+ term.start();
+
+ actionToolbar.setTargetComponent(panel);
+
+ ProcessHandler processHandler = createProcessHandler(process);
+
+ final RunContentDescriptor contentDescriptor =
+ new RunContentDescriptor(null, processHandler, panel, getTerminalConnectionName(process));
+
+ toolbarActions.add(createCloseAction(defaultExecutor, contentDescriptor));
+
+ showConsole(defaultExecutor, contentDescriptor, term.getTermPanel());
+
+ processHandler.startNotify();
+ }
+
+ protected abstract String getTerminalConnectionName(T process);
+
+ protected abstract TtyConnector createTtyConnector(T process);
+
+ protected AnAction createCloseAction(final Executor defaultExecutor, final RunContentDescriptor myDescriptor) {
+ return new CloseAction(defaultExecutor, myDescriptor, myProject);
+ }
+
+
+ protected void showConsole(Executor defaultExecutor, RunContentDescriptor myDescriptor, final Component toFocus) {
+ // Show in run toolwindow
+ ExecutionManager.getInstance(myProject).getContentManager().showRunContent(defaultExecutor, myDescriptor);
+
+// Request focus
+ final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(defaultExecutor.getId());
+ window.activate(new Runnable() {
+ public void run() {
+ IdeFocusManager.getInstance(myProject).requestFocus(toFocus, true);
+ }
+ });
+ }
+
+ protected Project getProject() {
+ return myProject;
+ }
+}
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminal.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminal.java
new file mode 100644
index 000000000000..982c06bd0f9f
--- /dev/null
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminal.java
@@ -0,0 +1,269 @@
+package org.jetbrains.plugins.terminal;
+
+import com.intellij.application.options.OptionsConstants;
+import com.intellij.openapi.editor.colors.*;
+import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.options.FontSize;
+import com.intellij.openapi.util.InvalidDataException;
+import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.ui.components.JBScrollBar;
+import com.intellij.util.containers.HashMap;
+import com.jediterm.emulator.display.BackBuffer;
+import com.jediterm.emulator.display.LinesBuffer;
+import com.jediterm.emulator.display.StyleState;
+import com.jediterm.emulator.ui.SwingJediTerminal;
+import com.jediterm.emulator.ui.SwingTerminalPanel;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.EnumMap;
+import java.util.Map;
+
+public class JBTerminal extends SwingJediTerminal {
+ public JBTerminal() {
+ }
+
+ @Override
+ protected SwingTerminalPanel createTerminalPanel(StyleState styleState, BackBuffer backBuffer, LinesBuffer scrollBuffer) {
+ return new JBTerminalPanel(backBuffer, scrollBuffer, styleState, createBoundColorSchemeDelegate(null));
+ }
+
+ @Override
+ protected JScrollBar createScrollBar() {
+ return new JBScrollBar();
+ }
+
+ @NotNull
+ public EditorColorsScheme createBoundColorSchemeDelegate(@Nullable final EditorColorsScheme customGlobalScheme) {
+ return new MyColorSchemeDelegate(customGlobalScheme);
+ }
+
+ private static class MyColorSchemeDelegate implements EditorColorsScheme {
+
+ private final FontPreferences myFontPreferences = new FontPreferences();
+ private final HashMap<TextAttributesKey, TextAttributes> myOwnAttributes = new HashMap<TextAttributesKey, TextAttributes>();
+ private final HashMap<ColorKey, Color> myOwnColors = new HashMap<ColorKey, Color>();
+ private final EditorColorsScheme myCustomGlobalScheme;
+ private Map<EditorFontType, Font> myFontsMap = null;
+ private int myMaxFontSize = OptionsConstants.MAX_EDITOR_FONT_SIZE;
+ private int myFontSize = -1;
+ private String myFaceName = null;
+ private EditorColorsScheme myGlobalScheme;
+
+ private MyColorSchemeDelegate(@Nullable final EditorColorsScheme globalScheme) {
+ myCustomGlobalScheme = globalScheme;
+ updateGlobalScheme();
+ }
+
+ private EditorColorsScheme getGlobal() {
+ return myGlobalScheme;
+ }
+
+ @Override
+ public String getName() {
+ return getGlobal().getName();
+ }
+
+
+ protected void initFonts() {
+ String editorFontName = getEditorFontName();
+ int editorFontSize = getEditorFontSize();
+ myFontPreferences.clear();
+ myFontPreferences.register(editorFontName, editorFontSize);
+
+ myFontsMap = new EnumMap<EditorFontType, Font>(EditorFontType.class);
+
+ Font plainFont = new Font(editorFontName, Font.PLAIN, editorFontSize);
+ Font boldFont = new Font(editorFontName, Font.BOLD, editorFontSize);
+ Font italicFont = new Font(editorFontName, Font.ITALIC, editorFontSize);
+ Font boldItalicFont = new Font(editorFontName, Font.BOLD | Font.ITALIC, editorFontSize);
+
+ myFontsMap.put(EditorFontType.PLAIN, plainFont);
+ myFontsMap.put(EditorFontType.BOLD, boldFont);
+ myFontsMap.put(EditorFontType.ITALIC, italicFont);
+ myFontsMap.put(EditorFontType.BOLD_ITALIC, boldItalicFont);
+ }
+
+ @Override
+ public void setName(String name) {
+ getGlobal().setName(name);
+ }
+
+ @Override
+ public TextAttributes getAttributes(TextAttributesKey key) {
+ if (myOwnAttributes.containsKey(key)) return myOwnAttributes.get(key);
+ return getGlobal().getAttributes(key);
+ }
+
+ @Override
+ public void setAttributes(TextAttributesKey key, TextAttributes attributes) {
+ myOwnAttributes.put(key, attributes);
+ }
+
+ @NotNull
+ @Override
+ public Color getDefaultBackground() {
+ return getGlobal().getDefaultBackground();
+ }
+
+ @NotNull
+ @Override
+ public Color getDefaultForeground() {
+ return getGlobal().getDefaultForeground();
+ }
+
+ @Override
+ public Color getColor(ColorKey key) {
+ if (myOwnColors.containsKey(key)) return myOwnColors.get(key);
+ return getGlobal().getColor(key);
+ }
+
+ @Override
+ public void setColor(ColorKey key, Color color) {
+ myOwnColors.put(key, color);
+ }
+
+ @NotNull
+ @Override
+ public FontPreferences getFontPreferences() {
+ return myFontPreferences;
+ }
+
+ @Override
+ public void setFontPreferences(@NotNull FontPreferences preferences) {
+ preferences.copyTo(myFontPreferences);
+ initFonts();
+ }
+
+ @Override
+ public int getEditorFontSize() {
+ if (myFontSize == -1) {
+ return getGlobal().getEditorFontSize();
+ }
+ return myFontSize;
+ }
+
+ @Override
+ public void setEditorFontSize(int fontSize) {
+ if (fontSize < 8) fontSize = 8;
+ if (fontSize > myMaxFontSize) fontSize = myMaxFontSize;
+ myFontSize = fontSize;
+ initFonts();
+ }
+
+ @Override
+ public FontSize getQuickDocFontSize() {
+ return myGlobalScheme.getQuickDocFontSize();
+ }
+
+ @Override
+ public void setQuickDocFontSize(@NotNull FontSize fontSize) {
+ myGlobalScheme.setQuickDocFontSize(fontSize);
+ }
+
+ @Override
+ public String getEditorFontName() {
+ if (myFaceName == null) {
+ return getGlobal().getEditorFontName();
+ }
+ return myFaceName;
+ }
+
+ @Override
+ public void setEditorFontName(String fontName) {
+ myFaceName = fontName;
+ initFonts();
+ }
+
+ @Override
+ public Font getFont(EditorFontType key) {
+ if (myFontsMap != null) {
+ Font font = myFontsMap.get(key);
+ if (font != null) return font;
+ }
+ return getGlobal().getFont(key);
+ }
+
+ @Override
+ public void setFont(EditorFontType key, Font font) {
+ if (myFontsMap == null) {
+ initFonts();
+ }
+ myFontsMap.put(key, font);
+ }
+
+ @Override
+ public float getLineSpacing() {
+ return getGlobal().getLineSpacing();
+ }
+
+ @Override
+ public void setLineSpacing(float lineSpacing) {
+ getGlobal().setLineSpacing(lineSpacing);
+ }
+
+ @Override
+ @Nullable
+ public Object clone() {
+ return null;
+ }
+
+ @Override
+ public void readExternal(Element element) throws InvalidDataException {
+ }
+
+ @Override
+ public void writeExternal(Element element) throws WriteExternalException {
+ }
+
+ public void updateGlobalScheme() {
+ myGlobalScheme = myCustomGlobalScheme == null ? EditorColorsManager.getInstance().getGlobalScheme() : myCustomGlobalScheme;
+ int globalFontSize = getGlobal().getEditorFontSize();
+ myMaxFontSize = Math.max(OptionsConstants.MAX_EDITOR_FONT_SIZE, globalFontSize);
+ }
+
+ @NotNull
+ @Override
+ public FontPreferences getConsoleFontPreferences() {
+ return getGlobal().getConsoleFontPreferences();
+ }
+
+ @Override
+ public void setConsoleFontPreferences(@NotNull FontPreferences preferences) {
+ getGlobal().setConsoleFontPreferences(preferences);
+ }
+
+ @Override
+ public String getConsoleFontName() {
+ return getGlobal().getConsoleFontName();
+ }
+
+ @Override
+ public void setConsoleFontName(String fontName) {
+ getGlobal().setConsoleFontName(fontName);
+ }
+
+ @Override
+ public int getConsoleFontSize() {
+ return getGlobal().getConsoleFontSize();
+ }
+
+ @Override
+ public void setConsoleFontSize(int fontSize) {
+ getGlobal().setConsoleFontSize(fontSize);
+ }
+
+ @Override
+ public float getConsoleLineSpacing() {
+ return getGlobal().getConsoleLineSpacing();
+ }
+
+ @Override
+ public void setConsoleLineSpacing(float lineSpacing) {
+ getGlobal().setConsoleLineSpacing(lineSpacing);
+ }
+ }
+}
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java
new file mode 100644
index 000000000000..0c8cfea1ab0c
--- /dev/null
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java
@@ -0,0 +1,101 @@
+/* -*-mode:java; c-basic-offset:2; -*- */
+/* JCTerm
+ * Copyright (C) 2002-2004 ymnk, JCraft,Inc.
+ *
+ * Written by: 2002 ymnk<ymnk@jcaft.com>
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.jetbrains.plugins.terminal;
+
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.openapi.ide.CopyPasteManager;
+import com.intellij.util.ui.GraphicsUtil;
+import com.intellij.util.ui.UIUtil;
+import com.jediterm.emulator.TextStyle;
+import com.jediterm.emulator.display.BackBuffer;
+import com.jediterm.emulator.display.LinesBuffer;
+import com.jediterm.emulator.display.StyleState;
+import com.jediterm.emulator.ui.SwingTerminalPanel;
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+
+public class JBTerminalPanel extends SwingTerminalPanel {
+ private final EditorColorsScheme myColorScheme;
+
+ public JBTerminalPanel(BackBuffer backBuffer, LinesBuffer scrollBuffer, StyleState styleState, EditorColorsScheme scheme) {
+ super(backBuffer, scrollBuffer, styleState);
+ myColorScheme = scheme;
+
+ styleState.setDefaultStyle(new TextStyle(myColorScheme.getDefaultForeground(), myColorScheme.getDefaultBackground()));
+ }
+
+ @Override
+ protected BufferedImage createBufferedImage(int width, int height) {
+ return UIUtil.createImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ }
+
+ protected Font createFont() {
+ Font normalFont = Font.decode(myColorScheme.getConsoleFontName());
+ if (normalFont == null) {
+ return super.createFont();
+ }
+ return normalFont;
+ }
+
+ protected void setupAntialiasing(Graphics graphics, boolean antialiasing) {
+ GraphicsUtil.setupAntialiasing(graphics, antialiasing, false);
+ }
+
+ @Override
+ public Color getBackground() {
+ if (myColorScheme != null) {
+ return myColorScheme.getDefaultBackground();
+ }
+ return super.getBackground();
+ }
+
+ @Override
+ public Color getForeground() {
+ if (myColorScheme != null) {
+ return myColorScheme.getDefaultForeground();
+ }
+ return super.getBackground();
+ }
+
+ @Override
+ protected void setCopyContents(StringSelection selection) {
+ CopyPasteManager.getInstance().setContents(selection);
+ }
+
+
+ @Override
+ protected String getClipboardContent() throws IOException, UnsupportedFlavorException {
+ Transferable contents = CopyPasteManager.getInstance().getContents();
+ if (contents == null) {
+ return null;
+ }
+ return (String)contents.getTransferData(DataFlavor.stringFlavor);
+ }
+}
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
new file mode 100644
index 000000000000..05d120f15a8e
--- /dev/null
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
@@ -0,0 +1,48 @@
+package org.jetbrains.plugins.terminal;
+
+import com.intellij.execution.process.OSProcessHandler;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.openapi.project.Project;
+import com.jediterm.emulator.TtyConnector;
+import com.jediterm.pty.PtyProcess;
+import com.jediterm.pty.PtyProcessTtyConnector;
+
+import java.nio.charset.Charset;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * @author traff
+ */
+public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess> {
+
+ private final Charset myDefaultCharset;
+ private final String myCommand;
+ private final String[] myArguments;
+
+ public LocalTerminalDirectRunner(Project project, Charset charset, String command, String[] arguments) {
+ super(project);
+ myDefaultCharset = charset;
+ myCommand = command;
+ myArguments = arguments;
+ }
+
+ @Override
+ protected PtyProcess createProcess() throws ExecutionException {
+ return new PtyProcess(myCommand, myArguments);
+ }
+
+ @Override
+ protected ProcessHandler createProcessHandler(PtyProcess process) {
+ return new OSProcessHandler(process);
+ }
+
+ @Override
+ protected TtyConnector createTtyConnector(PtyProcess process) {
+ return new PtyProcessTtyConnector(process, myDefaultCharset);
+ }
+
+ @Override
+ protected String getTerminalConnectionName(PtyProcess process) {
+ return process.getCommandLineString();
+ }
+}
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/RunLocalTerminalAction.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/RunLocalTerminalAction.java
new file mode 100644
index 000000000000..b288c2e6cb5d
--- /dev/null
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/RunLocalTerminalAction.java
@@ -0,0 +1,37 @@
+package org.jetbrains.plugins.terminal;
+
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
+
+import java.nio.charset.Charset;
+
+/**
+ * @author traff
+ */
+public class RunLocalTerminalAction extends AnAction implements DumbAware {
+ public RunLocalTerminalAction() {
+ super();
+ }
+
+ @Override
+ public void update(final AnActionEvent e) {
+ e.getPresentation().setVisible(true);
+ e.getPresentation().setEnabled(true);
+ }
+
+ public void actionPerformed(final AnActionEvent e) {
+ runLocalTerminal(e);
+ }
+
+ public void runLocalTerminal(AnActionEvent event) {
+ final Project project = event.getData(PlatformDataKeys.PROJECT);
+ setupRemoteCredentialsAndRunTerminal(project);
+ }
+
+ public static void setupRemoteCredentialsAndRunTerminal(final Project project) {
+ new LocalTerminalDirectRunner(project, Charset.defaultCharset(), "/bin/bash", new String[]{"/bin/bash"}).run();
+ }
+}
diff --git a/plugins/terminal/terminal.iml b/plugins/terminal/terminal.iml
new file mode 100644
index 000000000000..b1b2aa940a47
--- /dev/null
+++ b/plugins/terminal/terminal.iml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="lang-api" />
+ <orderEntry type="library" name="jna" level="project" />
+ <orderEntry type="library" name="jediterm-pty" level="project" />
+ <orderEntry type="library" name="jpty" level="project" />
+ <orderEntry type="library" name="purejavacomm" level="project" />
+ <orderEntry type="module" module-name="platform-impl" />
+ </component>
+</module>
+