mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
Generated
+2
-1
@@ -6,7 +6,8 @@
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<excludeFromCompile>
|
||||
<file url="file://$PROJECT_DIR$/jps/jps-builders/src/org/jetbrains/jps/incremental/java/OptimizedFileManager.java" />
|
||||
<file url="file://$PROJECT_DIR$/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java" />
|
||||
<file url="file://$PROJECT_DIR$/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager.java" />
|
||||
</excludeFromCompile>
|
||||
<resourceExtensions>
|
||||
<entry name=".+\.(properties|xml|html|dtd|tld)" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,149 @@
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.sun.tools.javac.file.*;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.tools.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* WARNING: Loaded via reflection, do not delete
|
||||
*
|
||||
* @noinspection UnusedDeclaration
|
||||
*/
|
||||
class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
private boolean myUseZipFileIndex;
|
||||
private final Map<File, Archive> myArchives;
|
||||
private final Map<File, Boolean> myIsFile = new ConcurrentHashMap<File, Boolean>();
|
||||
|
||||
public OptimizedFileManager17() throws Throwable {
|
||||
super(new Context(), true, null);
|
||||
final Field archivesField = com.sun.tools.javac.file.JavacFileManager.class.getDeclaredField("archives");
|
||||
archivesField.setAccessible(true);
|
||||
myArchives = (Map<File, Archive>) archivesField.get(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<JavaFileObject> list(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException {
|
||||
Iterable<? extends File> path = getLocation(location);
|
||||
if (path == null) {
|
||||
return List.nil();
|
||||
}
|
||||
|
||||
RelativePath.RelativeDirectory subdirectory = new RelativePath.RelativeDirectory(packageName.replace('.', '/'));
|
||||
|
||||
ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
|
||||
|
||||
for (File file : path) {
|
||||
Archive archive = myArchives.get(file);
|
||||
|
||||
final boolean isFile;
|
||||
if (archive != null) {
|
||||
isFile = true;
|
||||
}
|
||||
else {
|
||||
isFile = isFile(file);
|
||||
}
|
||||
|
||||
if (isFile) {
|
||||
// Not a directory; either a file or non-existant, create the archive
|
||||
try {
|
||||
if (archive == null) {
|
||||
archive = openArchive(file);
|
||||
}
|
||||
listArchive(archive, subdirectory, kinds, recurse, results);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
log.error("error.reading.file", file, getMessage(ex));
|
||||
}
|
||||
}
|
||||
else {
|
||||
listDirectory(file, subdirectory, kinds, recurse, results);
|
||||
}
|
||||
|
||||
}
|
||||
return results.toList();
|
||||
}
|
||||
|
||||
private static void listArchive(Archive archive, RelativePath.RelativeDirectory subdirectory, Set<JavaFileObject.Kind> fileKinds, boolean recurse, ListBuffer<JavaFileObject> resultList) {
|
||||
// Get the files directly in the subdir
|
||||
List<String> files = archive.getFiles(subdirectory);
|
||||
if (files != null) {
|
||||
for (; !files.isEmpty(); files = files.tail) {
|
||||
String file = files.head;
|
||||
if (isValidFile(file, fileKinds)) {
|
||||
resultList.append(archive.getFileObject(subdirectory, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recurse) {
|
||||
for (RelativePath.RelativeDirectory s: archive.getSubdirectories()) {
|
||||
if (contains(subdirectory, s)) {
|
||||
// Because the archive map is a flat list of directories,
|
||||
// the enclosing loop will pick up all child subdirectories.
|
||||
// Therefore, there is no need to recurse deeper.
|
||||
listArchive(archive, s, fileKinds, false, resultList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listDirectory(File directory, RelativePath.RelativeDirectory subdirectory, Set<JavaFileObject.Kind> fileKinds, boolean recurse, ListBuffer<JavaFileObject> resultList) {
|
||||
File d = subdirectory.getFile(directory);
|
||||
|
||||
File[] files = d.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sortFiles != null) {
|
||||
Arrays.sort(files, sortFiles);
|
||||
}
|
||||
|
||||
for (File f: files) {
|
||||
String fileName = f.getName();
|
||||
if (f.isDirectory()) {
|
||||
if (recurse && SourceVersion.isIdentifier(fileName)) {
|
||||
listDirectory(directory, new RelativePath.RelativeDirectory(subdirectory, fileName), fileKinds, recurse, resultList);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isValidFile(fileName, fileKinds)) {
|
||||
//JavaFileObject fe = new RegularFileObject(this, fname, new File(d, fname));
|
||||
JavaFileObject fe = getRegularFile(f);
|
||||
resultList.append(fe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFile(File root) {
|
||||
Boolean cachedIsFile = myIsFile.get(root);
|
||||
if (cachedIsFile == null) {
|
||||
cachedIsFile = root.isFile();
|
||||
myIsFile.put(root, cachedIsFile);
|
||||
}
|
||||
return cachedIsFile.booleanValue();
|
||||
}
|
||||
|
||||
private static boolean contains(RelativePath.RelativeDirectory subdirectory, RelativePath.RelativeDirectory other) {
|
||||
final String subdirPath = subdirectory.getPath();
|
||||
final String otherPath = other.getPath();
|
||||
return otherPath.length() > subdirPath.length() && otherPath.startsWith(subdirPath);
|
||||
}
|
||||
|
||||
private static boolean isValidFile(String name, Set<JavaFileObject.Kind> fileKinds) {
|
||||
JavaFileObject.Kind kind = getKind(name);
|
||||
return fileKinds.contains(kind);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,6 +64,24 @@ public class ClasspathBootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
private static class OptimizedFileManager17ClassHolder {
|
||||
static final String CLASS_NAME = "org.jetbrains.jps.javac.OptimizedFileManager17";
|
||||
static final Class<StandardJavaFileManager> managerClass;
|
||||
static {
|
||||
Class<StandardJavaFileManager> aClass = null;
|
||||
try {
|
||||
aClass = (Class<StandardJavaFileManager>)Class.forName(CLASS_NAME);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
aClass = null;
|
||||
}
|
||||
managerClass = aClass;
|
||||
}
|
||||
|
||||
private OptimizedFileManager17ClassHolder() {
|
||||
}
|
||||
}
|
||||
|
||||
private ClasspathBootstrap() {
|
||||
}
|
||||
|
||||
@@ -150,7 +168,11 @@ public class ClasspathBootstrap {
|
||||
|
||||
@Nullable
|
||||
public static Class<StandardJavaFileManager> getOptimizedFileManagerClass() {
|
||||
return OptimizedFileManagerClassHolder.managerClass;
|
||||
final Class<StandardJavaFileManager> aClass = OptimizedFileManagerClassHolder.managerClass;
|
||||
if (aClass != null) {
|
||||
return aClass;
|
||||
}
|
||||
return OptimizedFileManager17ClassHolder.managerClass;
|
||||
}
|
||||
|
||||
public static File getResourcePath(Class aClass) {
|
||||
|
||||
Binary file not shown.
@@ -25,11 +25,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
|
||||
public class IndentOptionsEditor extends OptionGroup {
|
||||
private JTextField myIndentField;
|
||||
protected JTextField myIndentField;
|
||||
protected JCheckBox myCbUseTab;
|
||||
private JTextField myTabSizeField;
|
||||
private JLabel myTabSizeLabel;
|
||||
private JLabel myIndentLabel;
|
||||
protected JTextField myTabSizeField;
|
||||
protected JLabel myTabSizeLabel;
|
||||
protected JLabel myIndentLabel;
|
||||
|
||||
public JPanel createPanel() {
|
||||
addComponents();
|
||||
|
||||
+2
-3
@@ -125,14 +125,13 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
|
||||
final Container component = (Container)e;
|
||||
final Component[] components = component.getComponents();
|
||||
final Component last = components[components.length - 1];
|
||||
initCopyFromMenu(last);
|
||||
initCopyFromMenu();
|
||||
myCopyFromMenu.show(last, 0, last.getHeight() + 3);
|
||||
}
|
||||
|
||||
private void initCopyFromMenu(Component component) {
|
||||
private void initCopyFromMenu() {
|
||||
if (myCopyFromMenu == null) {
|
||||
myCopyFromMenu = new JPopupMenu();
|
||||
//component.add(myCopyFromMenu);
|
||||
setupCopyFromMenu(myCopyFromMenu);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-8
@@ -16,9 +16,9 @@
|
||||
|
||||
package com.intellij.application.options.codeStyle;
|
||||
|
||||
import com.intellij.application.options.CodeStyleAbstractPanel;
|
||||
import com.intellij.ide.ui.ListCellRendererWrapper;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.psi.codeStyle.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleScheme;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CodeStyleSchemesPanel{
|
||||
@@ -58,10 +58,9 @@ public class CodeStyleSchemesPanel{
|
||||
}
|
||||
}
|
||||
});
|
||||
myCombo.setRenderer(new DefaultListCellRenderer() {
|
||||
myCombo.setRenderer(new ListCellRendererWrapper(myCombo.getRenderer()) {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
|
||||
Font font = myDefaultComboFont;
|
||||
if (value instanceof CodeStyleScheme) {
|
||||
CodeStyleScheme scheme = (CodeStyleScheme)value;
|
||||
@@ -69,8 +68,7 @@ public class CodeStyleSchemesPanel{
|
||||
font = myBoldComboFont;
|
||||
}
|
||||
}
|
||||
component.setFont(font);
|
||||
return component;
|
||||
setFont(font);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.intellij.codeInsight.dataflow;
|
||||
|
||||
import com.intellij.codeInsight.controlflow.ControlFlowUtil;
|
||||
import com.intellij.codeInsight.controlflow.Instruction;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
|
||||
@@ -24,7 +23,7 @@ import java.util.*;
|
||||
|
||||
public class DFAEngine<E> {
|
||||
private static final Logger LOG = Logger.getInstance(DFAEngine.class.getName());
|
||||
private static final double TIME_LIMIT = 3 * 10e9;
|
||||
private static final double TIME_LIMIT = 10e9; // In nanoseconds, 10e9 = 1 sec
|
||||
|
||||
private final Instruction[] myFlow;
|
||||
|
||||
@@ -47,7 +46,7 @@ public class DFAEngine<E> {
|
||||
|
||||
public List<E> performDFA(final List<E> info) throws DFALimitExceededException {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Perfoming DFA\n" + "Instance: " + myDfa + " Semilattice: " + mySemilattice);
|
||||
LOG.debug("Performing DFA\n" + "Instance: " + myDfa + " Semilattice: " + mySemilattice + "\nCon");
|
||||
}
|
||||
|
||||
// initializing dfa
|
||||
@@ -70,10 +69,7 @@ public class DFAEngine<E> {
|
||||
// Check if canceled
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
// Check time limit only in EDT
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode() &&
|
||||
ApplicationManager.getApplication().isDispatchThread() &&
|
||||
System.nanoTime() - startTime > TIME_LIMIT) {
|
||||
if (System.nanoTime() - startTime > TIME_LIMIT) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Time limit exceeded");
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentFactory;
|
||||
@@ -88,7 +89,7 @@ public class ExecutionHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
final RailsErrorViewPanel errorTreeView = new RailsErrorViewPanel(myProject);
|
||||
final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject);
|
||||
try {
|
||||
openMessagesView(errorTreeView, myProject, tabDisplayName);
|
||||
}
|
||||
@@ -113,7 +114,79 @@ public class ExecutionHelper {
|
||||
});
|
||||
}
|
||||
|
||||
private static void openMessagesView(@NotNull final RailsErrorViewPanel errorTreeView,
|
||||
public static void showOutput(@NotNull final Project myProject,
|
||||
@NotNull final Output output,
|
||||
@NotNull final String tabDisplayName,
|
||||
@Nullable final VirtualFile file,
|
||||
final boolean activateWindow) {
|
||||
final String stdout = output.getStdout();
|
||||
final String stderr = output.getStderr();
|
||||
if (ApplicationManager.getApplication().isUnitTestMode() && !(stdout.isEmpty() || stderr.isEmpty())) {
|
||||
throw new RuntimeException("STDOUT:\n" + stdout + "\nSTDERR:\n" + stderr);
|
||||
}
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (myProject.isDisposed()) return;
|
||||
|
||||
final String stdOutTitle = "[Stdout]:";
|
||||
final String stderrTitle = "[Stderr]:";
|
||||
final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject);
|
||||
try {
|
||||
openMessagesView(errorTreeView, myProject, tabDisplayName);
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append(stdOutTitle).append("\n").append(stdout != null ? stdout : "<empty>").append("\n");
|
||||
builder.append(stderrTitle).append("\n").append(stderr != null ? stderr : "<empty>");
|
||||
Messages.showErrorDialog(builder.toString(), "Process Output");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(stdout)) {
|
||||
final String[] stdoutLines = StringUtil.splitByLines(stdout);
|
||||
if (stdoutLines.length > 0) {
|
||||
if (StringUtil.isEmpty(stderr)) {
|
||||
// Only stdout available
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null);
|
||||
}
|
||||
else {
|
||||
// both stdout and stderr available, show as groups
|
||||
if (file == null) {
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, stdOutTitle, new FakeNavigatable(), null, null, null);
|
||||
}
|
||||
else {
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{stdOutTitle}, file, -1, -1, null);
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{""}, file, -1, -1, null);
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(stderr)) {
|
||||
final String[] stderrLines = StringUtil.splitByLines(stderr);
|
||||
if (stderrLines.length > 0) {
|
||||
if (file == null) {
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, stderrTitle, new FakeNavigatable(), null, null, null);
|
||||
}
|
||||
else {
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{stderrTitle}, file, -1, -1, null);
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[0], file, -1, -1, null);
|
||||
errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, file, -1, -1, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
errorTreeView
|
||||
.addMessage(MessageCategory.SIMPLE, new String[]{"Process finished with exit code " + output.getExitCode()}, null, -1, -1, null);
|
||||
|
||||
if (activateWindow) {
|
||||
ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView,
|
||||
@NotNull final Project myProject,
|
||||
@NotNull final String tabDisplayName) {
|
||||
CommandProcessor commandProcessor = CommandProcessor.getInstance();
|
||||
@@ -267,8 +340,8 @@ public class ExecutionHelper {
|
||||
});
|
||||
}
|
||||
|
||||
public static class RailsErrorViewPanel extends NewErrorTreeViewPanel {
|
||||
public RailsErrorViewPanel(final Project project) {
|
||||
public static class ErrorViewPanel extends NewErrorTreeViewPanel {
|
||||
public ErrorViewPanel(final Project project) {
|
||||
super(project, "reference.toolWindows.messages");
|
||||
}
|
||||
|
||||
@@ -282,9 +355,9 @@ public class ExecutionHelper {
|
||||
@NotNull final ProcessHandler processHandler,
|
||||
@NotNull final ExecutionMode mode,
|
||||
@NotNull final GeneralCommandLine cmdline) {
|
||||
executeExternalProcess(myProject, processHandler, mode, cmdline.getCommandLineString());
|
||||
executeExternalProcess(myProject, processHandler, mode, cmdline.getCommandLineString());
|
||||
}
|
||||
|
||||
|
||||
public static void executeExternalProcess(@Nullable final Project myProject,
|
||||
@NotNull final ProcessHandler processHandler,
|
||||
@NotNull final ExecutionMode mode,
|
||||
@@ -349,7 +422,7 @@ public class ExecutionHelper {
|
||||
|
||||
private final Runnable myCancelListener = new Runnable() {
|
||||
public void run() {
|
||||
for (; ;) {
|
||||
for (; ; ) {
|
||||
if ((myProgressIndicator != null && (myProgressIndicator.isCanceled()
|
||||
|| !myProgressIndicator.isRunning()))
|
||||
|| (cancelableFun != null && cancelableFun.fun(null).booleanValue())
|
||||
@@ -405,7 +478,7 @@ public class ExecutionHelper {
|
||||
try {
|
||||
final boolean finished = processHandler.waitFor(1000 * timeout);
|
||||
if (!finished) {
|
||||
final String msg = "Timeout (" + timeout + " sec) on executing: " + presentableCmdline;
|
||||
final String msg = "Timeout (" + timeout + " sec) on executing: " + presentableCmdline;
|
||||
LOG.error(msg);
|
||||
processHandler.destroyProcess();
|
||||
}
|
||||
@@ -424,4 +497,21 @@ public class ExecutionHelper {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static class FakeNavigatable implements Navigatable {
|
||||
@Override
|
||||
public void navigate(boolean requestFocus) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigateToSource() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,16 @@ package com.intellij.execution;
|
||||
public class Output {
|
||||
private final String stdout;
|
||||
private final String stderr;
|
||||
private int exitCode;
|
||||
|
||||
public Output(String stdout, String stderr) {
|
||||
this(stdout, stderr, -1);
|
||||
}
|
||||
|
||||
public Output(String stdout, String stderr, int exitCode) {
|
||||
this.stdout = stdout;
|
||||
this.stderr = stderr;
|
||||
this.exitCode = exitCode;
|
||||
}
|
||||
|
||||
public String getStdout() {
|
||||
@@ -38,4 +44,8 @@ public class Output {
|
||||
public String getStderr() {
|
||||
return stderr;
|
||||
}
|
||||
|
||||
public int getExitCode() {
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,12 @@ import com.intellij.openapi.util.Key;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author oleg
|
||||
*/
|
||||
* @author oleg
|
||||
*/
|
||||
public class OutputListener extends ProcessAdapter {
|
||||
private final StringBuilder out;
|
||||
private final StringBuilder err;
|
||||
private int myExitCode;
|
||||
|
||||
public OutputListener() {
|
||||
out = new StringBuilder();
|
||||
@@ -24,15 +25,23 @@ public class OutputListener extends ProcessAdapter {
|
||||
}
|
||||
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
if (outputType == ProcessOutputTypes.STDOUT) {
|
||||
out.append(event.getText());
|
||||
}
|
||||
if (outputType == ProcessOutputTypes.STDERR) {
|
||||
err.append(event.getText());
|
||||
}
|
||||
else if (outputType == ProcessOutputTypes.SYSTEM) {
|
||||
// skip
|
||||
}
|
||||
else {
|
||||
out.append(event.getText());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
myExitCode = event.getExitCode();
|
||||
}
|
||||
|
||||
public Output getOutput() {
|
||||
return new Output(out.toString(), err.toString());
|
||||
return new Output(out.toString(), err.toString(), myExitCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,10 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
if (target != null) {
|
||||
target.add(content, null);
|
||||
} else {
|
||||
final Point location = gridCell.getLocation();
|
||||
Point location = gridCell.getLocation();
|
||||
if (location == null) {
|
||||
location = getComponent().getLocationOnScreen();
|
||||
}
|
||||
location.translate(size.width / 2, size.height / 2);
|
||||
getDockManager().createNewDockContainerFor(content, new RelativePoint(location));
|
||||
}
|
||||
|
||||
@@ -18,17 +18,33 @@
|
||||
package com.intellij.find.actions;
|
||||
|
||||
import com.intellij.find.findInProject.FindInProjectManager;
|
||||
import com.intellij.notification.NotificationGroup;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
|
||||
public class FindInPathAction extends AnAction implements DumbAware {
|
||||
static final NotificationGroup NOTIFICATION_GROUP = NotificationGroup.toolWindowGroup("FindInPath", ToolWindowId.FIND, false);
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
|
||||
FindInProjectManager.getInstance(project).findInProject(dataContext);
|
||||
|
||||
FindInProjectManager findManager = FindInProjectManager.getInstance(project);
|
||||
if (!findManager.isEnabled()) {
|
||||
showNotAvailableMessage(e, project);
|
||||
return;
|
||||
}
|
||||
|
||||
findManager.findInProject(dataContext);
|
||||
}
|
||||
|
||||
static void showNotAvailableMessage(AnActionEvent e, Project project) {
|
||||
final String message = "'" + e.getPresentation().getText() + "' is not available while search is in progress";
|
||||
NOTIFICATION_GROUP.createNotification(message, NotificationType.WARNING).notify(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,9 +52,5 @@ public class FindInPathAction extends AnAction implements DumbAware {
|
||||
Presentation presentation = e.getPresentation();
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
presentation.setEnabled(project != null);
|
||||
if (project != null) {
|
||||
FindInProjectManager findManager = FindInProjectManager.getInstance(project);
|
||||
presentation.setEnabled(findManager.isEnabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,20 +26,20 @@ public class ReplaceInPathAction extends AnAction {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
|
||||
ReplaceInProjectManager.getInstance(project).replaceInProject(dataContext);
|
||||
|
||||
ReplaceInProjectManager replaceManager = ReplaceInProjectManager.getInstance(project);
|
||||
if (!replaceManager.isEnabled()) {
|
||||
FindInPathAction.showNotAvailableMessage(e, project);
|
||||
return;
|
||||
}
|
||||
|
||||
replaceManager.replaceInProject(dataContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext());
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
}
|
||||
else {
|
||||
ReplaceInProjectManager replaceManager = ReplaceInProjectManager.getInstance(project);
|
||||
presentation.setEnabled(replaceManager.isEnabled());
|
||||
}
|
||||
Project project = event.getData(PlatformDataKeys.PROJECT);
|
||||
presentation.setEnabled(project != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.popup.list.ListPopupImpl;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.hash.*;
|
||||
import com.intellij.util.containers.hash.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -41,7 +39,6 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -64,6 +61,7 @@ public class GotoRelatedFileAction extends AnAction {
|
||||
return;
|
||||
}
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
//noinspection UseOfSystemOutOrSystemErr
|
||||
System.out.println(items);
|
||||
}
|
||||
createPopup(items, "Go to Related Files").showInBestPositionFor(context);
|
||||
@@ -210,7 +208,7 @@ public class GotoRelatedFileAction extends AnAction {
|
||||
}
|
||||
}
|
||||
|
||||
Set<GotoRelatedItem> items = new HashSet<GotoRelatedItem> ();
|
||||
Set<GotoRelatedItem> items = new LinkedHashSet<GotoRelatedItem>();
|
||||
|
||||
for (GotoRelatedProvider provider : Extensions.getExtensions(GotoRelatedProvider.EP_NAME)) {
|
||||
items.addAll(provider.getItems(contextElement));
|
||||
|
||||
@@ -541,7 +541,6 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
|
||||
if (toolWindow != null) {
|
||||
myContentManager = toolWindow.getContentManager();
|
||||
toolWindow.setContentUiType(ToolWindowContentUiType.getInstance("combo"), null);
|
||||
toolWindow.setIcon(IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getToolWindowIconUrl()));
|
||||
((ToolWindowEx)toolWindow).setAdditionalGearActions(myActionGroup);
|
||||
toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
|
||||
} else {
|
||||
|
||||
+9
-2
@@ -17,16 +17,23 @@
|
||||
package com.intellij.ide.projectView.impl;
|
||||
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowFactory;
|
||||
import com.intellij.openapi.wm.ToolWindowFactoryEx;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class ProjectViewToolWindowFactory implements ToolWindowFactory, DumbAware {
|
||||
public class ProjectViewToolWindowFactory implements ToolWindowFactoryEx, DumbAware {
|
||||
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
|
||||
((ProjectViewImpl) ProjectView.getInstance(project)).setupImpl(toolWindow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(ToolWindow window) {
|
||||
window.setIcon(IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getToolWindowIconUrl()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,6 +462,10 @@ public class ScopeTreeViewPanel extends JPanel implements Disposable {
|
||||
myTreeExpansionMonitor.restore();
|
||||
}
|
||||
|
||||
ActionCallback getActionCallback() {
|
||||
return myActionCallback;
|
||||
}
|
||||
|
||||
private class MyTreeCellRenderer extends ColoredTreeCellRenderer {
|
||||
public void customizeCellRenderer(JTree tree,
|
||||
Object value,
|
||||
|
||||
@@ -226,4 +226,11 @@ public class ScopeViewPane extends AbstractProjectViewPane {
|
||||
}
|
||||
return myViewPanel != null ? myViewPanel.getData(dataId) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback getReady(@NotNull Object requestor) {
|
||||
final ActionCallback callback = myViewPanel.getActionCallback();
|
||||
return myViewPanel == null ? new ActionCallback.Rejected() :
|
||||
callback != null ? callback : new ActionCallback.Done();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-5
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.fileTypes.impl;
|
||||
|
||||
import com.intellij.ide.ui.ListCellRendererWrapper;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.TemplateLanguageFileType;
|
||||
@@ -22,7 +23,6 @@ import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -51,10 +51,9 @@ public class FileTypePatternDialog {
|
||||
for (Language language : languages) {
|
||||
model.addElement(language);
|
||||
}
|
||||
myLanguageCombo.setRenderer(new DefaultListCellRenderer() {
|
||||
myLanguageCombo.setRenderer(new ListCellRendererWrapper(myLanguageCombo.getRenderer()) {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
setText(value == null ? "" : ((Language) value).getDisplayName());
|
||||
if (value != null) {
|
||||
final FileType type = ((Language)value).getAssociatedFileType();
|
||||
@@ -62,7 +61,6 @@ public class FileTypePatternDialog {
|
||||
setIcon(type.getIcon());
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
myLanguageCombo.setSelectedItem(templateDataLanguage);
|
||||
|
||||
+10
-5
@@ -43,6 +43,7 @@ import com.intellij.openapi.vfs.ex.VirtualFileManagerAdapter;
|
||||
import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.roots.ToolbarPanel;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -385,11 +386,15 @@ public class CommonContentEntriesEditor extends ModuleElementsEditor {
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myProject, myDescriptor, myLastSelectedDir);
|
||||
if (files.length > 0) {
|
||||
myLastSelectedDir = files[0];
|
||||
addContentEntries(files);
|
||||
}
|
||||
FileChooser.chooseFilesWithSlideEffect(myDescriptor, myProject, myLastSelectedDir, new Consumer<VirtualFile[]>() {
|
||||
@Override
|
||||
public void consume(VirtualFile[] files) {
|
||||
if (files.length > 0) {
|
||||
myLastSelectedDir = files[0];
|
||||
addContentEntries(files);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,179 +16,154 @@
|
||||
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupArranger;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.codeInsight.hint.HintManager;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.ex.FocusChangeListener;
|
||||
import com.intellij.openapi.fileTypes.PlainTextLanguage;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.Matcher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Roman Chernyatchik
|
||||
*
|
||||
* It is text field with autocompletion from list of values.
|
||||
*
|
||||
* Autocompletion is implemented via LookupManager.
|
||||
* Use setVariants(..) set list of values for autocompletion.
|
||||
* For variants you can use not only instances of PresentableLookupValue, but
|
||||
* also instances of LookupValueWithPriority and LookupValueWithUIHint
|
||||
* <p/>
|
||||
* It is text field with autocompletion from list of values.
|
||||
* <p/>
|
||||
* Autocompletion is implemented via LookupManager.
|
||||
* Use setVariants(..) set list of values for autocompletion.
|
||||
* For variants you can use not only instances of PresentableLookupValue, but
|
||||
* also instances of LookupValueWithPriority and LookupValueWithUIHint
|
||||
*/
|
||||
public class TextFieldWithAutoCompletion extends EditorTextField {
|
||||
private List<LookupElement> myVariants;
|
||||
private String myAdText;
|
||||
|
||||
private Comparator<LookupElement> myComparator = new Comparator<LookupElement>() {
|
||||
public int compare(final LookupElement item1,
|
||||
final LookupElement item2) {
|
||||
return item1.getLookupString().compareTo(item2.getLookupString());
|
||||
}
|
||||
};
|
||||
public class TextFieldWithAutoCompletion<T> extends LanguageTextField {
|
||||
|
||||
public static final TextFieldWithAutoCompletionListProvider EMPTY_COMPLETION = new StringsCompletionProvider(null, null);
|
||||
private final boolean myShowAutocompletionIsAvailableHint;
|
||||
|
||||
public TextFieldWithAutoCompletion() {
|
||||
super();
|
||||
// For UI designer
|
||||
this(null, null, false);
|
||||
}
|
||||
|
||||
public TextFieldWithAutoCompletion(final Project project) {
|
||||
super(createDocument(project), project, PlainTextLanguage.INSTANCE.getAssociatedFileType());
|
||||
public TextFieldWithAutoCompletion(final Project project,
|
||||
final TextFieldWithAutoCompletionListProvider<T> provider,
|
||||
final boolean showAutocompletionIsAvailableHint) {
|
||||
super(PlainTextLanguage.INSTANCE, project, "");
|
||||
|
||||
new VariantsCompletionAction();
|
||||
}
|
||||
myShowAutocompletionIsAvailableHint = showAutocompletionIsAvailableHint;
|
||||
|
||||
private static Document createDocument(@Nullable final Project project) {
|
||||
if (project == null) {
|
||||
return EditorFactory.getInstance().createDocument("");
|
||||
}
|
||||
|
||||
final Language language = PlainTextLanguage.INSTANCE;
|
||||
final PsiFileFactory factory = PsiFileFactory.getInstance(project);
|
||||
final FileType fileType = language.getAssociatedFileType();
|
||||
assert fileType != null;
|
||||
|
||||
final long stamp = LocalTimeCounter.currentTime();
|
||||
final PsiFile psiFile = factory.createFileFromText("Dummy." + fileType.getDefaultExtension(), fileType, "", stamp, true, false);
|
||||
final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
|
||||
assert document != null;
|
||||
return document;
|
||||
}
|
||||
|
||||
private class VariantsCompletionAction extends AnAction {
|
||||
private VariantsCompletionAction() {
|
||||
final AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION);
|
||||
if (action != null) {
|
||||
registerCustomShortcutSet(action.getShortcutSet(), TextFieldWithAutoCompletion.this);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
showLookup();
|
||||
if (provider != null) {
|
||||
TextFieldWithAutoCompletionContributor.installCompletion(getDocument(), project, provider, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void showLookup() {
|
||||
if (LookupManager.getInstance(getProject()).getActiveLookup() != null) return;
|
||||
final Editor editor = getEditor();
|
||||
assert editor != null;
|
||||
public static TextFieldWithAutoCompletion<String> create(final Project project,
|
||||
@NotNull final Collection<String> items,
|
||||
@Nullable final Icon icon,
|
||||
final boolean showAutocompletionIsAvailableHint) {
|
||||
return new TextFieldWithAutoCompletion<String>(project, new StringsCompletionProvider(items, icon), showAutocompletionIsAvailableHint);
|
||||
}
|
||||
|
||||
editor.getSelectionModel().removeSelection();
|
||||
final String lookupPrefix = getCurrentLookupPrefix(getCurrentTextPrefix());
|
||||
final LookupImpl lookup =
|
||||
(LookupImpl)LookupManager.getInstance(getProject()).createLookup(editor,
|
||||
calcLookupItems(lookupPrefix),
|
||||
StringUtil.notNullize(lookupPrefix),
|
||||
LookupArranger.DEFAULT);
|
||||
final String advertisementText = getAdvertisementText();
|
||||
if (!StringUtil.isEmpty(advertisementText)) {
|
||||
lookup.setAdvertisementText(advertisementText);
|
||||
lookup.refreshUi(false);
|
||||
@Override
|
||||
protected EditorEx createEditor() {
|
||||
final EditorEx editor = super.createEditor();
|
||||
|
||||
if (!myShowAutocompletionIsAvailableHint) {
|
||||
return editor;
|
||||
}
|
||||
lookup.showLookup();
|
||||
}
|
||||
|
||||
public void setAdvertisementText(@Nullable String text) {
|
||||
myAdText = text;
|
||||
}
|
||||
final String completionShortcutText = getCompletionShortcutText();
|
||||
if (completionShortcutText == null) {
|
||||
return editor;
|
||||
}
|
||||
|
||||
public String getAdvertisementText() {
|
||||
return myAdText;
|
||||
}
|
||||
|
||||
public void setVariants(@Nullable final List<LookupElement> variants) {
|
||||
myVariants = (variants != null) ? variants : Collections.<LookupElement>emptyList();
|
||||
}
|
||||
|
||||
public void setVariants(@Nullable final String[] variants) {
|
||||
myVariants = (variants == null)
|
||||
? Collections.<LookupElement>emptyList()
|
||||
: ContainerUtil.map(variants, new Function<String, LookupElement>() {
|
||||
public LookupElement fun(final String s) {
|
||||
return LookupElementBuilder.create(s);
|
||||
final Ref<Boolean> toShowHintRef = new Ref<Boolean>(true);
|
||||
editor.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
toShowHintRef.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
editor.addFocusListener(new FocusChangeListener() {
|
||||
@Override
|
||||
public void focusGained(final Editor editor) {
|
||||
if (toShowHintRef.get() && getText().length() == 0) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HintManager.getInstance().showInformationHint(editor, "Code completion available ( " + completionShortcutText + " )");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(Editor editor) {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
return editor;
|
||||
}
|
||||
|
||||
private LookupElement[] calcLookupItems(@Nullable final String lookupPrefix) {
|
||||
if (lookupPrefix == null) {
|
||||
return new LookupElement[0];
|
||||
}
|
||||
|
||||
final List<LookupElement> items = new ArrayList<LookupElement>();
|
||||
if (lookupPrefix.length() == 0) {
|
||||
items.addAll(myVariants);
|
||||
} else {
|
||||
final Matcher matcher = NameUtil.buildMatcher(lookupPrefix, 0, true, true);
|
||||
|
||||
for (LookupElement variant : myVariants) {
|
||||
if (matcher.matches(variant.getLookupString())) {
|
||||
items.add(variant);
|
||||
@Nullable
|
||||
private static String getCompletionShortcutText() {
|
||||
final AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION);
|
||||
if (action != null) {
|
||||
final ShortcutSet shortcutSet = action.getShortcutSet();
|
||||
if (shortcutSet != null) {
|
||||
final Shortcut[] shortcuts = shortcutSet.getShortcuts();
|
||||
if (shortcuts != null && shortcuts.length > 0) {
|
||||
return KeymapUtil.getShortcutText(shortcuts[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(items, myComparator);
|
||||
|
||||
return items.toArray(new LookupElement[items.size()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setComparator(@NotNull Comparator<LookupElement> comparator) {
|
||||
myComparator = comparator;
|
||||
}
|
||||
public static class StringsCompletionProvider extends TextFieldWithAutoCompletionListProvider<String> {
|
||||
@Nullable private final Icon myIcon;
|
||||
|
||||
/**
|
||||
* Returns prefix for autocompletion and lookup items matching.
|
||||
*/
|
||||
@Nullable
|
||||
protected String getCurrentLookupPrefix(final String currentTextPrefix) {
|
||||
return currentTextPrefix;
|
||||
}
|
||||
public StringsCompletionProvider(@Nullable final Collection<String> variants,
|
||||
@Nullable final Icon icon) {
|
||||
super(variants);
|
||||
myIcon = icon;
|
||||
}
|
||||
|
||||
private String getCurrentTextPrefix() {
|
||||
return getText().substring(0, getCaretModel().getOffset());
|
||||
}
|
||||
@Override
|
||||
public int compare(final String item1, final String item2) {
|
||||
return StringUtil.compare(item1, item2, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Icon getIcon(@NotNull final String item) {
|
||||
return myIcon;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getLookupString(@NotNull final String item) {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTailText(@NotNull final String item) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTypeText(@NotNull final String item) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author Roman.Chernyatchik
|
||||
*/
|
||||
public class TextFieldWithAutoCompletionContributor<T> extends CompletionContributor {
|
||||
private static final Key<TextFieldWithAutoCompletionListProvider> KEY = Key.create("text field simple completion available");
|
||||
private static final Key<Boolean> AUTO_POPUP_KEY = Key.create("text Field simple completion auto-popup");
|
||||
|
||||
public static <T> void installCompletion(Document document,
|
||||
Project project,
|
||||
@Nullable TextFieldWithAutoCompletionListProvider<T> consumer,
|
||||
boolean autoPopup) {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile != null) {
|
||||
//noinspection unchecked
|
||||
psiFile.putUserData(KEY, consumer == null ? TextFieldWithAutoCompletion.EMPTY_COMPLETION : consumer);
|
||||
psiFile.putUserData(AUTO_POPUP_KEY, autoPopup);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
|
||||
PsiFile file = parameters.getOriginalFile();
|
||||
final TextFieldWithAutoCompletionListProvider<T> provider = file.getUserData(KEY);
|
||||
|
||||
if (provider != null) {
|
||||
if (CompletionService.getCompletionService().getAdvertisementText() == null) {
|
||||
String adv = provider.getAdvertisement();
|
||||
if (adv == null) {
|
||||
final String shortcut = getActionShortcut(IdeActions.ACTION_QUICK_JAVADOC);
|
||||
if (shortcut != null) {
|
||||
adv = provider.getQuickDocHotKeyAdvertisement(shortcut);
|
||||
}
|
||||
}
|
||||
if (adv != null) {
|
||||
CompletionService.getCompletionService().setAdvertisementText(adv);
|
||||
}
|
||||
}
|
||||
|
||||
final String prefix = provider.getPrefix(parameters);
|
||||
if (prefix == null) {
|
||||
return;
|
||||
}
|
||||
if (parameters.getInvocationCount() == 0 && !file.getUserData(AUTO_POPUP_KEY)) { // is autopopup
|
||||
return;
|
||||
}
|
||||
final PrefixMatcher prefixMatcher = provider.createPrefixMatcher(prefix);
|
||||
if (prefixMatcher != null) {
|
||||
result = result.withPrefixMatcher(prefixMatcher);
|
||||
}
|
||||
|
||||
Collection<T> items = provider.getItems(prefix, true);
|
||||
addCompletionElements(result, provider, items, -10000);
|
||||
|
||||
Future<Collection<T>>
|
||||
future =
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Callable<Collection<T>>() {
|
||||
@Override
|
||||
public Collection<T> call() {
|
||||
return provider.getItems(prefix, false);
|
||||
}
|
||||
});
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
Collection<T> tasks = future.get(100, TimeUnit.MILLISECONDS);
|
||||
if (tasks != null) {
|
||||
addCompletionElements(result, provider, tasks, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
|
||||
}
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void addCompletionElements(final CompletionResultSet result,
|
||||
final TextFieldWithAutoCompletionListProvider<T> listProvider,
|
||||
final Collection<T> items,
|
||||
final int index) {
|
||||
final AutoCompletionPolicy completionPolicy = ApplicationManager.getApplication().isUnitTestMode()
|
||||
? AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE
|
||||
: AutoCompletionPolicy.NEVER_AUTOCOMPLETE;
|
||||
int grouping = index;
|
||||
for (final T item : items) {
|
||||
LookupElementBuilder builder = listProvider.createLookupBuilder(item);
|
||||
|
||||
result.addElement(PrioritizedLookupElement.withGrouping(builder.withAutoCompletionPolicy(completionPolicy), grouping--));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionParameters;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.PlainPrefixMatcher;
|
||||
import com.intellij.codeInsight.completion.PrefixMatcher;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Roman.Chernyatchik
|
||||
*/
|
||||
public abstract class TextFieldWithAutoCompletionListProvider<T> implements Comparator<T> {
|
||||
@NotNull
|
||||
private Collection<T> myVariants;
|
||||
@Nullable
|
||||
private String myCompletionAdvertisement;
|
||||
|
||||
@Nullable
|
||||
protected abstract Icon getIcon(@NotNull final T item);
|
||||
|
||||
@NotNull
|
||||
protected abstract String getLookupString(@NotNull final T item);
|
||||
|
||||
@Nullable
|
||||
protected abstract String getTailText(@NotNull final T item);
|
||||
|
||||
@Nullable
|
||||
protected abstract String getTypeText(@NotNull final T item);
|
||||
|
||||
public abstract int compare(T item1, T item2);
|
||||
|
||||
protected TextFieldWithAutoCompletionListProvider(@Nullable final Collection<T> variants) {
|
||||
setItems(variants);
|
||||
myCompletionAdvertisement = null;
|
||||
}
|
||||
|
||||
public void setItems(@Nullable final Collection<T> variants) {
|
||||
myVariants = (variants != null) ? variants : Collections.<T>emptyList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<T> getItems(String prefix, boolean cached) {
|
||||
if (prefix == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final List<T> items = new ArrayList<T>(myVariants);
|
||||
|
||||
Collections.sort(items, this);
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Completion list advertisement for documentation popup
|
||||
*
|
||||
* @param shortcut
|
||||
* @return text
|
||||
*/
|
||||
@Nullable
|
||||
public String getQuickDocHotKeyAdvertisement(@NotNull final String shortcut) {
|
||||
final String advertisementTail = getQuickDocHotKeyAdvertisementTail(shortcut);
|
||||
if (advertisementTail == null) {
|
||||
return null;
|
||||
}
|
||||
return "Pressing " + shortcut + " would show " + advertisementTail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Completion list advertisement text, if null advertisement for documentation
|
||||
* popup will be shown
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
@Nullable
|
||||
public String getAdvertisement() {
|
||||
return myCompletionAdvertisement;
|
||||
}
|
||||
|
||||
public void setAdvertisement(@Nullable final String completionAdvertisement) {
|
||||
myCompletionAdvertisement = completionAdvertisement;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PrefixMatcher createPrefixMatcher(@NotNull final String prefix) {
|
||||
return new PlainPrefixMatcher(prefix);
|
||||
}
|
||||
|
||||
public LookupElementBuilder createLookupBuilder(@NotNull final T item) {
|
||||
LookupElementBuilder builder = LookupElementBuilder.create(item, getLookupString(item))
|
||||
.setIcon(getIcon(item));
|
||||
|
||||
final InsertHandler<LookupElement> handler = createInsertHandler(item);
|
||||
if (handler != null) {
|
||||
builder = builder.setInsertHandler(handler);
|
||||
}
|
||||
|
||||
final String tailText = getTailText(item);
|
||||
if (tailText != null) {
|
||||
builder = builder.setTailText(tailText, true);
|
||||
}
|
||||
|
||||
final String typeText = getTypeText(item);
|
||||
if (typeText != null) {
|
||||
builder = builder.setTypeText(typeText);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPrefix(@NotNull final CompletionParameters parameters) {
|
||||
String text = parameters.getOriginalFile().getText();
|
||||
int i = text.lastIndexOf(' ', parameters.getOffset() - 1) + 1;
|
||||
return text.substring(i, parameters.getOffset());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected String getQuickDocHotKeyAdvertisementTail(@NotNull final String shortcut) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected InsertHandler<LookupElement> createInsertHandler(@NotNull final T item) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.wm;
|
||||
|
||||
/**
|
||||
* @author Dennis.Ushakov
|
||||
*/
|
||||
public interface ToolWindowFactoryEx extends ToolWindowFactory {
|
||||
void init(ToolWindow window);
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -322,6 +323,7 @@ public class QuickListsPanel extends JPanel implements SearchableConfigurable, C
|
||||
private static class MyQuickListCellRenderer extends ColoredListCellRenderer {
|
||||
@Override
|
||||
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
setBackground(UIUtil.getListBackground(selected));
|
||||
QuickList quickList = (QuickList)value;
|
||||
append(quickList.getDisplayName());
|
||||
}
|
||||
|
||||
@@ -434,6 +434,9 @@ public final class ToolWindowImpl implements ToolWindowEx {
|
||||
|
||||
public void setContentFactory(ToolWindowFactory contentFactory) {
|
||||
myContentFactory = contentFactory;
|
||||
if (contentFactory instanceof ToolWindowFactoryEx) {
|
||||
((ToolWindowFactoryEx)contentFactory).init(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void ensureContentInitialized() {
|
||||
|
||||
@@ -472,7 +472,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
(ToolWindowImpl)registerToolWindow(bean.id, label, toolWindowAnchor, myProject, DumbService.isDumbAware(factory),
|
||||
bean.canCloseContents);
|
||||
toolWindow.setContentFactory(factory);
|
||||
if (bean.icon != null) {
|
||||
if (bean.icon != null && toolWindow.getIcon() == null) {
|
||||
Icon icon = IconLoader.findIcon(bean.icon, factory.getClass());
|
||||
if (icon == null) {
|
||||
try {
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<applicationService serviceInterface="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings"
|
||||
serviceImplementation="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings"/>
|
||||
<exportable serviceInterface="com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings"/>
|
||||
|
||||
|
||||
<applicationService serviceInterface="com.intellij.facet.FacetTypeRegistry"
|
||||
serviceImplementation="com.intellij.facet.impl.FacetTypeRegistryImpl"/>
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
<applicationService serviceInterface="com.intellij.ui.IconDeferrer"
|
||||
serviceImplementation="com.intellij.ui.IconDeferrerImpl"/>
|
||||
|
||||
|
||||
<applicationService serviceInterface="com.intellij.ui.mac.MacMessages"
|
||||
serviceImplementation="com.intellij.ui.mac.MacMessagesImpl"/>
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
serviceImplementation="com.intellij.util.download.impl.DownloadableFileServiceImpl"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.psi.impl.DocumentCommitThread"
|
||||
serviceImplementation="com.intellij.psi.impl.DocumentCommitThread"/>
|
||||
serviceImplementation="com.intellij.psi.impl.DocumentCommitThread"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.psi.stubs.StubTreeLoader"
|
||||
serviceImplementation="com.intellij.psi.stubs.StubTreeLoaderImpl"/>
|
||||
@@ -241,7 +241,7 @@
|
||||
serviceImplementation="com.intellij.analysis.AnalysisUIOptions"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.ide.util.gotoByName.ChooseByNameFactory"
|
||||
serviceImplementation="com.intellij.ide.util.gotoByName.ChooseByNameFactoryImpl"/>
|
||||
serviceImplementation="com.intellij.ide.util.gotoByName.ChooseByNameFactoryImpl"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.refactoring.listeners.RefactoringListenerManager"
|
||||
serviceImplementation="com.intellij.refactoring.listeners.impl.RefactoringListenerManagerImpl"/>
|
||||
@@ -256,7 +256,7 @@
|
||||
serviceImplementation="com.intellij.diagnostic.logging.LogConsolePreferences"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry"
|
||||
serviceImplementation="com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl"/>
|
||||
serviceImplementation="com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.find.FindManager"
|
||||
serviceImplementation="com.intellij.find.impl.FindManagerImpl"/>
|
||||
@@ -317,7 +317,7 @@
|
||||
|
||||
<!--
|
||||
-->
|
||||
<!-- Code Completion -->
|
||||
<!-- Code Completion -->
|
||||
|
||||
|
||||
<!-- Global Code Style -->
|
||||
@@ -390,67 +390,92 @@
|
||||
<internalFileTemplate name="Html"/>
|
||||
<internalFileTemplate name="Html5"/>
|
||||
<internalFileTemplate name="Xhtml"/>
|
||||
<fileBasedIndex implementation="com.intellij.psi.impl.cache.impl.todo.TodoIndex" />
|
||||
<fileBasedIndex implementation="com.intellij.psi.impl.cache.impl.id.IdIndex" />
|
||||
<fileBasedIndex implementation="com.intellij.psi.impl.cache.impl.todo.TodoIndex"/>
|
||||
<fileBasedIndex implementation="com.intellij.psi.impl.cache.impl.id.IdIndex"/>
|
||||
<fileBasedIndex implementation="com.intellij.psi.search.FilenameIndex"/>
|
||||
<fileBasedIndex implementation="com.intellij.psi.search.FileTypeIndex"/>
|
||||
<fileBasedIndex implementation="com.intellij.psi.stubs.StubUpdatingIndex"/>
|
||||
|
||||
<fileBasedIndex implementation="com.intellij.find.ngrams.TrigramIndex"/>
|
||||
<fileBasedIndex implementation="com.intellij.find.ngrams.TrigramIndex"/>
|
||||
|
||||
<fileBasedIndex implementation="com.intellij.psi.impl.include.FileIncludeIndex"/>
|
||||
|
||||
<syntaxHighlighter factoryClass="com.intellij.openapi.fileTypes.LanguageFileTypeHighlighterProvider"/>
|
||||
<structureViewBuilder factoryClass="com.intellij.ide.highlighter.LanguageFileTypeStructureViewBuilderProvider"/>
|
||||
|
||||
<lang.elementManipulator forClass="com.intellij.psi.PsiPlainTextFile" implementationClass="com.intellij.psi.impl.source.resolve.reference.impl.manipulators.PlainFileManipulator"/>
|
||||
<lang.elementManipulator forClass="com.intellij.psi.PsiComment" implementationClass="com.intellij.psi.impl.source.resolve.reference.impl.manipulators.PsiCommentManipulator"/>
|
||||
<lang.elementManipulator forClass="com.intellij.psi.PsiPlainTextFile"
|
||||
implementationClass="com.intellij.psi.impl.source.resolve.reference.impl.manipulators.PlainFileManipulator"/>
|
||||
<lang.elementManipulator forClass="com.intellij.psi.PsiComment"
|
||||
implementationClass="com.intellij.psi.impl.source.resolve.reference.impl.manipulators.PsiCommentManipulator"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.ide.macro.MacroManager" serviceImplementation="com.intellij.ide.macro.MacroManager"/>
|
||||
<hectorComponentProvider implementation="com.intellij.codeInsight.daemon.impl.FileIncludeContextHectorProvider" />
|
||||
<hectorComponentProvider implementation="com.intellij.codeInsight.daemon.impl.FileIncludeContextHectorProvider"/>
|
||||
|
||||
<programRunner implementation="com.intellij.tools.ToolProgramRunner"/>
|
||||
|
||||
<ideRootPaneNorth implementation="com.intellij.ide.navigationToolbar.NavBarRootPaneExtension"/>
|
||||
<navbar implementation="com.intellij.ide.navigationToolbar.DefaultNavBarExtension" id="defaultNavbar"/>
|
||||
|
||||
<statistician key="completion" implementationClass="com.intellij.codeInsight.completion.DecoratorCompletionStatistician" order="first" id="decorator"/>
|
||||
<statistician key="completion" implementationClass="com.intellij.codeInsight.completion.DecoratorCompletionStatistician" order="first"
|
||||
id="decorator"/>
|
||||
<statistician key="completion" implementationClass="com.intellij.codeInsight.completion.DefaultCompletionStatistician" order="last"/>
|
||||
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.OpenedInEditorWeigher" id="openedInEditor"/>
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.SameLogicalRootWeigher" id="sameLogicalRoot" order="after openedInEditor"/>
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.SameModuleWeigher" id="sameModule" order="after sameLogicalRoot"/>
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.SdkOrLibraryWeigher" id="sdkOrLibrary" order="after sameModule"/>
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.SameLogicalRootWeigher" id="sameLogicalRoot"
|
||||
order="after openedInEditor"/>
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.SameModuleWeigher" id="sameModule"
|
||||
order="after sameLogicalRoot"/>
|
||||
<weigher key="proximity" implementationClass="com.intellij.psi.util.proximity.SdkOrLibraryWeigher" id="sdkOrLibrary"
|
||||
order="after sameModule"/>
|
||||
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PriorityWeigher" id="priority" order="first"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.NegativeStatisticsWeigher" id="negativeStats" order="first, after priority"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.StatisticsWeigher" id="stats" order="after negativeStats"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PrefixMatchingWeigher" id="prefix" order="after stats"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.LookupElementProximityWeigher" id="proximity" order="after prefix"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.NegativeStatisticsWeigher" id="negativeStats"
|
||||
order="first, after priority"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.StatisticsWeigher" id="stats"
|
||||
order="after negativeStats"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PrefixMatchingWeigher" id="prefix"
|
||||
order="after stats"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.LookupElementProximityWeigher" id="proximity"
|
||||
order="after prefix"/>
|
||||
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.PriorityWeigher$Negative" id="sPriority" order="first"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.GroupingWeigher" id="sGrouping" order="after sPriority"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.LookupStringWeigher" id="sLookupString" order="after sGrouping"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.LookupElementProximityWeigher$Negative" id="sProximity" order="after sLookupString"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.PriorityWeigher$Negative" id="sPriority"
|
||||
order="first"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.GroupingWeigher" id="sGrouping"
|
||||
order="after sPriority"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.LookupStringWeigher" id="sLookupString"
|
||||
order="after sGrouping"/>
|
||||
<weigher key="completionSorting" implementationClass="com.intellij.codeInsight.completion.LookupElementProximityWeigher$Negative"
|
||||
id="sProximity" order="after sLookupString"/>
|
||||
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.DefaultCompletionContributor" id="default" order="last"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.ComboEditorCompletionContributor" id="comboEditor" order="first"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.WordCompletionContributor" id="wordCompletion" order="last"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.LegacyCompletionContributor" id="legacy" order="last"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.FilePathCompletionContributor" id="filePath" order="before javaClassName"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor" id="liveTemplates" order="first"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.DefaultCompletionContributor" id="default"
|
||||
order="last"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.ComboEditorCompletionContributor"
|
||||
id="comboEditor" order="first"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.WordCompletionContributor"
|
||||
id="wordCompletion" order="last"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.LegacyCompletionContributor" id="legacy"
|
||||
order="last"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.FilePathCompletionContributor"
|
||||
id="filePath" order="before javaClassName"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor"
|
||||
id="liveTemplates" order="first"/>
|
||||
|
||||
<completion.skip implementation="com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$Skipper" id="skipLiveTemplate"/>
|
||||
|
||||
<completion.contributor language="TEXT" implementationClass="com.intellij.openapi.vcs.CommitCompletionContributor" id="commitCompletion" order="first, before liveTemplates"/>
|
||||
<completion.contributor language="TEXT" implementationClass="com.intellij.openapi.vcs.CommitCompletionContributor" id="commitCompletion"
|
||||
order="first, before liveTemplates"/>
|
||||
<completion.contributor language="JAVA" implementationClass="com.intellij.codeInspection.magicConstant.MagicCompletionContributor"
|
||||
id="magicCompletion" order="first, before liveTemplates"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.execution.console.ConsoleFoldingSettings" serviceImplementation="com.intellij.execution.console.ConsoleFoldingSettings"/>
|
||||
<applicationService serviceInterface="com.intellij.execution.console.ConsoleFoldingSettings"
|
||||
serviceImplementation="com.intellij.execution.console.ConsoleFoldingSettings"/>
|
||||
<console.folding implementation="com.intellij.execution.console.SubstringConsoleFolding"/>
|
||||
|
||||
<lookup.charFilter implementation="com.intellij.codeInsight.template.impl.LiveTemplateCharFilter" order="first" id="liveTemplate"/>
|
||||
<lookup.charFilter implementation="com.intellij.codeInsight.completion.CompletionCharFilter" order="last" id="completion"/>
|
||||
<lookup.charFilter implementation="com.intellij.refactoring.IdentifierCharFilter" id="identifier"/>
|
||||
<lookup.charFilter implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceCharFilter" id="fileRef" order="before completion"/>
|
||||
<lookup.charFilter implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceCharFilter" id="fileRef"
|
||||
order="before completion"/>
|
||||
|
||||
<gotoFileContributor implementation="com.intellij.ide.util.gotoByName.DefaultFileNavigationContributor"/>
|
||||
<gotoRelatedProvider implementation="com.intellij.ide.actions.RelatedItemLineMarkerGotoAdapter"/>
|
||||
@@ -468,8 +493,10 @@
|
||||
<usageFilteringRuleProvider implementation="com.intellij.usages.impl.UsageFilteringRuleProviderImpl"/>
|
||||
<usageGroupingRuleProvider implementation="com.intellij.usages.impl.UsageGroupingRuleProviderImpl"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.psi.templateLanguages.TemplateDataLanguageMappings" serviceImplementation="com.intellij.psi.templateLanguages.TemplateDataLanguageMappings"/>
|
||||
<applicationService serviceInterface="com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns" serviceImplementation="com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns"/>
|
||||
<projectService serviceInterface="com.intellij.psi.templateLanguages.TemplateDataLanguageMappings"
|
||||
serviceImplementation="com.intellij.psi.templateLanguages.TemplateDataLanguageMappings"/>
|
||||
<applicationService serviceInterface="com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns"
|
||||
serviceImplementation="com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns"/>
|
||||
|
||||
<!-- execution -->
|
||||
<executor implementation="com.intellij.execution.executors.DefaultRunExecutor" order="first" id="run"/>
|
||||
@@ -487,7 +514,8 @@
|
||||
<syntaxHighlighter factoryClass="com.intellij.ide.highlighter.custom.impl.CustomFileTypeHighlighterProvider"/>
|
||||
<fileTypeRegistrator implementation="com.intellij.ide.highlighter.custom.impl.StandardFileTypeRegistrator"/>
|
||||
|
||||
<directoryProjectConfigurator implementation="com.intellij.platform.PlatformProjectConfigurator" order="first" id="PlatformProjectConfigurator"/>
|
||||
<directoryProjectConfigurator implementation="com.intellij.platform.PlatformProjectConfigurator" order="first"
|
||||
id="PlatformProjectConfigurator"/>
|
||||
<directoryProjectConfigurator implementation="com.intellij.platform.PlatformProjectViewOpener"/>
|
||||
|
||||
<iconProvider implementation="com.intellij.psi.impl.file.DirectoryIconProvider" id="directory" order="last"/>
|
||||
@@ -497,7 +525,8 @@
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterInStringLiteralHandler"/>
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterInLineCommentHandler"/>
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterAfterUnmatchedBraceHandler"/>
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesHandler" id="EnterBetweenBracesHandler"/>
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesHandler"
|
||||
id="EnterBetweenBracesHandler"/>
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterAfterJavadocTagHandler"/>
|
||||
|
||||
<codeInsight.linkHandler prefix="#inspection/" handlerClass="com.intellij.codeInsight.hint.InspectionDescriptionLinkHandler"/>
|
||||
@@ -533,14 +562,16 @@
|
||||
<editorActionHandler action="EditorCut" implementationClass="com.intellij.codeInsight.editorActions.CutHandler"/>
|
||||
<editorActionHandler action="EditorJoinLines" implementationClass="com.intellij.codeInsight.editorActions.JoinLinesHandler"/>
|
||||
<editorActionHandler action="EditorBackSpace" implementationClass="com.intellij.codeInsight.editorActions.BackspaceHandler"/>
|
||||
<editorActionHandler action="EditorDeleteToWordStart" implementationClass="com.intellij.codeInsight.editorActions.BackspaceToWordStartHandler"/>
|
||||
<editorActionHandler action="EditorDeleteToWordStart"
|
||||
implementationClass="com.intellij.codeInsight.editorActions.BackspaceToWordStartHandler"/>
|
||||
<editorTypedHandler implementationClass="com.intellij.codeInsight.editorActions.TypedHandler"/>
|
||||
|
||||
<!-- LookupManagerActions -->
|
||||
<editorActionHandler action="EditorUp" implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$UpHandler"/>
|
||||
<editorActionHandler action="EditorDown" implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$DownHandler"/>
|
||||
<editorActionHandler action="EditorPageUp" implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$PageUpHandler"/>
|
||||
<editorActionHandler action="EditorPageDown" implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$PageDownHandler"/>
|
||||
<editorActionHandler action="EditorPageDown"
|
||||
implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$PageDownHandler"/>
|
||||
<editorActionHandler action="EditorLeft" implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$LeftHandler"/>
|
||||
<editorActionHandler action="EditorRight" implementationClass="com.intellij.codeInsight.lookup.impl.LookupActionHandler$RightHandler"/>
|
||||
<editorActionHandler action="EditorLineStart" implementationClass="com.intellij.codeInsight.lookup.impl.HomeHandler"/>
|
||||
@@ -549,17 +580,22 @@
|
||||
|
||||
<!-- TemplateManagerActions -->
|
||||
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.codeInsight.template.impl.editorActions.EscapeHandler"/>
|
||||
<editorActionHandler action="EditorEnter" implementationClass="com.intellij.codeInsight.template.impl.editorActions.EnterHandler" id="templateEnter" order="before editorEnter"/>
|
||||
<editorActionHandler action="EditorEnter" implementationClass="com.intellij.codeInsight.template.impl.editorActions.EnterHandler"
|
||||
id="templateEnter" order="before editorEnter"/>
|
||||
<editorActionHandler action="EditorLineStart" implementationClass="com.intellij.codeInsight.template.impl.editorActions.HomeHandler"/>
|
||||
<editorActionHandler action="EditorLineStartWithSelection" implementationClass="com.intellij.codeInsight.template.impl.editorActions.LineStartWithSelectionHandler"/>
|
||||
<editorActionHandler action="EditorLineStartWithSelection"
|
||||
implementationClass="com.intellij.codeInsight.template.impl.editorActions.LineStartWithSelectionHandler"/>
|
||||
<editorActionHandler action="EditorLineEnd" implementationClass="com.intellij.codeInsight.template.impl.editorActions.EndHandler"/>
|
||||
<editorActionHandler action="EditorLineEndWithSelection" implementationClass="com.intellij.codeInsight.template.impl.editorActions.LineEndWithSelectionHandler"/>
|
||||
<editorActionHandler action="EditorLineEndWithSelection"
|
||||
implementationClass="com.intellij.codeInsight.template.impl.editorActions.LineEndWithSelectionHandler"/>
|
||||
<editorActionHandler action="$SelectAll" implementationClass="com.intellij.codeInsight.template.impl.editorActions.SelectAllHandler"/>
|
||||
<editorTypedHandler implementationClass="com.intellij.codeInsight.template.impl.editorActions.SpaceHandler"/>
|
||||
|
||||
<!-- HighlightManagerActions -->
|
||||
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.codeInsight.highlighting.EscapeHandler" order="after hide-hints"/>
|
||||
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.refactoring.rename.inplace.EscapeHandler" order="before hide-hints"/>
|
||||
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.codeInsight.highlighting.EscapeHandler"
|
||||
order="after hide-hints"/>
|
||||
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.refactoring.rename.inplace.EscapeHandler"
|
||||
order="before hide-hints"/>
|
||||
|
||||
<typedHandler implementation="com.intellij.codeInsight.lookup.impl.LookupTypedHandler" id="lookup" order="first"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler" id="completionAutoPopup" order="first"/>
|
||||
@@ -620,7 +656,7 @@
|
||||
<toolWindow id="Structure" anchor="left" icon="/general/toolWindowStructure.png" secondary="true"
|
||||
factoryClass="com.intellij.ide.structureView.impl.StructureViewToolWindowFactory"/>
|
||||
<toolWindow id="Favorites" anchor="left" icon="/general/toolWindowFavorites.png" secondary="true"
|
||||
factoryClass="com.intellij.ide.projectView.impl.FavoritesViewToolWindowFactory"/>
|
||||
factoryClass="com.intellij.ide.projectView.impl.FavoritesViewToolWindowFactory"/>
|
||||
|
||||
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiFileReferenceHelper"/>
|
||||
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.JarFileReferenceHelper"/>
|
||||
@@ -652,7 +688,8 @@
|
||||
<fileIconProvider implementation="com.intellij.ide.FileIconPatcherImpl"/>
|
||||
<renameHandler implementation="com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler"/>
|
||||
<renameHandler implementation="com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.refactoring.rename.inplace.CompletionContributorForInplaceRename" order="first, before liveTemplates"/>
|
||||
<completion.contributor language="any" implementationClass="com.intellij.refactoring.rename.inplace.CompletionContributorForInplaceRename"
|
||||
order="first"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.openapi.vcs.changes.ui.ChangesFileNameDecorator"
|
||||
serviceImplementation="com.intellij.openapi.vcs.changes.ui.WolfChangesFileNameDecorator"/>
|
||||
@@ -669,8 +706,8 @@
|
||||
|
||||
<copyPastePostProcessor implementation="com.intellij.codeInsight.editorActions.CopyPasteIndentProcessor"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.facet.impl.statistics.FrameworkUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.facet.impl.statistics.ModuleTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.facet.impl.statistics.FrameworkUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.facet.impl.statistics.ModuleTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.execution.impl.statistics.RunConfigurationTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.execution.impl.statistics.TemporaryRunConfigurationTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.fileTypes.FileTypeUsagesCollector"/>
|
||||
@@ -682,11 +719,12 @@
|
||||
|
||||
<keymapExtension implementation="com.intellij.tools.ToolKeymapExtension"/>
|
||||
|
||||
<inspectionsReportConverter implementation="com.intellij.codeInspection.ex.PlainTextFormatter" />
|
||||
<inspectionsReportConverter implementation="com.intellij.codeInspection.ex.PlainTextFormatter"/>
|
||||
|
||||
<documentationProvider implementation="com.intellij.openapi.paths.WebReferenceDocumentationProvider"/>
|
||||
|
||||
<refactoring.moveDirectoryWithClassesHelper implementation="com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesHelper$Default" order="last"/>
|
||||
<refactoring.moveDirectoryWithClassesHelper
|
||||
implementation="com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesHelper$Default" order="last"/>
|
||||
|
||||
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.ReformatCheckinHandlerFactory"/>
|
||||
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.OptimizeOptionsCheckinHandlerFactory"/>
|
||||
@@ -709,4 +747,7 @@
|
||||
|
||||
<customFoldingProvider implementation="com.intellij.lang.customFolding.NetBeansCustomFoldingProvider"/>
|
||||
<customFoldingProvider implementation="com.intellij.lang.customFolding.VisualStudioCustomFoldingProvider"/>
|
||||
|
||||
<completion.contributor language="TEXT" implementationClass="com.intellij.ui.TextFieldWithAutoCompletionContributor"
|
||||
order="first, before commitCompletion"/>
|
||||
</extensions>
|
||||
|
||||
+2
-15
@@ -42,11 +42,10 @@ public class SMTRunnerConsoleView extends BaseTestsOutputConsoleView {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param consoleProperties
|
||||
* @param runnerSettings
|
||||
* @param configurationPerRunnerSettings
|
||||
* @param splitterProperty Key to store(project level) latest value of testTree/consoleTab splitter. E.g. "RSpec.Splitter.Proportion"
|
||||
* @param splitterProperty Key to store(project level) latest value of testTree/consoleTab splitter. E.g. "RSpec.Splitter.Proportion"
|
||||
*/
|
||||
public SMTRunnerConsoleView(final TestConsoleProperties consoleProperties, final RunnerSettings runnerSettings,
|
||||
final ConfigurationPerRunnerSettings configurationPerRunnerSettings,
|
||||
@@ -73,19 +72,7 @@ public class SMTRunnerConsoleView extends BaseTestsOutputConsoleView {
|
||||
super.initUI();
|
||||
|
||||
// Console
|
||||
myResultsViewer.addEventsListener(new TestResultsViewer.EventsListener() {
|
||||
public void onTestNodeAdded(TestResultsViewer sender, SMTestProxy test) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void onTestingStarted(TestResultsViewer sender) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void onTestingFinished(TestResultsViewer sender) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
myResultsViewer.addEventsListener(new TestResultsViewer.SMEventsAdapter() {
|
||||
public void onSelected(@Nullable final SMTestProxy selectedTestProxy,
|
||||
@NotNull final TestResultsViewer viewer,
|
||||
@NotNull final TestFrameworkRunningModel model) {
|
||||
|
||||
+7
-9
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author Roman Chernyatchik
|
||||
*/
|
||||
public class SMTRunnerUIActionsHandler implements TestResultsViewer.EventsListener {
|
||||
public class SMTRunnerUIActionsHandler extends TestResultsViewer.SMEventsAdapter {
|
||||
private final TestConsoleProperties myConsoleProperties;
|
||||
|
||||
public SMTRunnerUIActionsHandler(final TestConsoleProperties consoleProperties) {
|
||||
@@ -45,10 +45,6 @@ public class SMTRunnerUIActionsHandler implements TestResultsViewer.EventsListen
|
||||
}
|
||||
}
|
||||
|
||||
public void onTestingStarted(TestResultsViewer sender) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void onTestingFinished(final TestResultsViewer sender) {
|
||||
// select first defect at the end (my be TRACK_RUNNING_TEST was enabled and affects on the fly selection)
|
||||
final SMTestProxy testsRootNode = sender.getTestsRootNode();
|
||||
@@ -60,12 +56,14 @@ public class SMTRunnerUIActionsHandler implements TestResultsViewer.EventsListen
|
||||
final List<SMTestProxy> allTests = testsRootNode.getAllTests();
|
||||
final AbstractTestProxy firstError = ProxyFilters.ERROR_LEAF.detectIn(allTests);
|
||||
if (firstError != null) {
|
||||
firstDefect = firstError;
|
||||
} else {
|
||||
firstDefect = firstError;
|
||||
}
|
||||
else {
|
||||
final AbstractTestProxy firstFailure = ProxyFilters.FAILURE_LEAF.detectIn(allTests);
|
||||
if (firstFailure != null) {
|
||||
firstDefect = firstFailure;
|
||||
} else {
|
||||
firstDefect = firstFailure;
|
||||
}
|
||||
else {
|
||||
firstDefect = null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -244,12 +244,12 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
|
||||
|
||||
LvcsHelper.addLabel(this);
|
||||
|
||||
fireOnTestingFinished();
|
||||
|
||||
SMTestProxy root = getTestsRootNode();
|
||||
if (root != null) {
|
||||
selectAndNotify(root);
|
||||
}
|
||||
|
||||
fireOnTestingFinished();
|
||||
}
|
||||
|
||||
public void onTestsCountInSuite(final int count) {
|
||||
|
||||
+13
-5
@@ -28,12 +28,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
public interface TestResultsViewer extends Disposable {
|
||||
/**
|
||||
* Fake Root for toplevel test suits/tests
|
||||
*
|
||||
* @return root
|
||||
*/
|
||||
SMTestProxy getTestsRootNode();
|
||||
|
||||
/**
|
||||
* Selects test or suite in Tests tree and notify about selection changed
|
||||
*
|
||||
* @param proxy
|
||||
*/
|
||||
void selectAndNotify(@Nullable AbstractTestProxy proxy);
|
||||
@@ -49,24 +51,30 @@ public interface TestResultsViewer extends Disposable {
|
||||
|
||||
interface EventsListener extends TestProxyTreeSelectionListener {
|
||||
void onTestingStarted(TestResultsViewer sender);
|
||||
|
||||
void onTestingFinished(TestResultsViewer sender);
|
||||
|
||||
void onTestNodeAdded(TestResultsViewer sender, SMTestProxy test);
|
||||
}
|
||||
|
||||
class SMEventsAdapter implements EventsListener {
|
||||
class SMEventsAdapter implements EventsListener {
|
||||
|
||||
@Override
|
||||
public void onTestingStarted(TestResultsViewer sender) {}
|
||||
public void onTestingStarted(TestResultsViewer sender) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestingFinished(TestResultsViewer sender) {}
|
||||
public void onTestingFinished(TestResultsViewer sender) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNodeAdded(TestResultsViewer sender, SMTestProxy test) {}
|
||||
public void onTestNodeAdded(TestResultsViewer sender, SMTestProxy test) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelected(@Nullable SMTestProxy selectedTestProxy,
|
||||
@NotNull TestResultsViewer viewer,
|
||||
@NotNull TestFrameworkRunningModel model) {}
|
||||
@NotNull TestFrameworkRunningModel model) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public abstract class ListCellRendererWrapper<T> implements ListCellRenderer {
|
||||
private String myText;
|
||||
private String myToolTipText;
|
||||
private Color myForeground;
|
||||
private Font myFont;
|
||||
|
||||
/**
|
||||
* A combo box for which this cell renderer is created should be passed here.
|
||||
@@ -66,6 +67,7 @@ public abstract class ListCellRendererWrapper<T> implements ListCellRenderer {
|
||||
label.setIcon(myIcon);
|
||||
if (myText != null) label.setText(myText);
|
||||
if (myForeground != null) label.setForeground(myForeground);
|
||||
if (myFont != null) label.setFont(myFont);
|
||||
label.setToolTipText(myToolTipText);
|
||||
}
|
||||
return component;
|
||||
@@ -104,4 +106,8 @@ public abstract class ListCellRendererWrapper<T> implements ListCellRenderer {
|
||||
public void setForeground(final Color foreground) {
|
||||
myForeground = foreground;
|
||||
}
|
||||
|
||||
public void setFont(final Font font) {
|
||||
myFont = font;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,7 +567,8 @@ public class UIUtil {
|
||||
}
|
||||
|
||||
public static Color getTableBackground() {
|
||||
return UIManager.getColor("Table.background");
|
||||
// Under GTK+ L&F "Table.background" often has main panel color, which looks ugly
|
||||
return isUnderGTKLookAndFeel() ? getTreeTextBackground() : UIManager.getColor("Table.background");
|
||||
}
|
||||
|
||||
public static Color getTableSelectionForeground() {
|
||||
@@ -583,7 +584,7 @@ public class UIUtil {
|
||||
}
|
||||
|
||||
public static Color getListBackground() {
|
||||
// Fixes most of the GTK+ L&F glitches
|
||||
// Under GTK+ L&F "Table.background" often has main panel color, which looks ugly
|
||||
return isUnderGTKLookAndFeel() ? getTreeTextBackground() : UIManager.getColor("List.background");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
package org.jetbrains.android.logcat;
|
||||
|
||||
import com.android.ddmlib.Log;
|
||||
import com.intellij.codeInsight.hint.HintManager;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.ex.FocusChangeListener;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.ide.ui.ListCellRendererWrapper;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.ValidationInfo;
|
||||
@@ -26,9 +16,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -62,44 +51,46 @@ class EditLogFilterDialog extends DialogWrapper {
|
||||
|
||||
myView = view;
|
||||
|
||||
myTagField = new MyTextFieldWithAutoCompletion(view.getProject()) {
|
||||
final Project project = view.getProject();
|
||||
|
||||
myTagField = new TextFieldWithAutoCompletion<String>(project, new TextFieldWithAutoCompletion.StringsCompletionProvider(null, null) {
|
||||
@NotNull
|
||||
@Override
|
||||
public void showLookup() {
|
||||
public Collection<String> getItems(String prefix, boolean cached) {
|
||||
parseExistingMessagesIfNecessary();
|
||||
myTagField.setVariants(Arrays.asList(toLookupElements(myUsedTags)));
|
||||
super.showLookup();
|
||||
setItems(Arrays.asList(myUsedTags));
|
||||
return super.getItems(prefix, cached);
|
||||
}
|
||||
};
|
||||
}, true);
|
||||
|
||||
myTagFieldWrapper.add(myTagField);
|
||||
myLogTagLabel.setLabelFor(myTagField);
|
||||
|
||||
myPidField = new MyTextFieldWithAutoCompletion(view.getProject()) {
|
||||
myPidField = new TextFieldWithAutoCompletion<String>(project, new TextFieldWithAutoCompletion.StringsCompletionProvider(null, null) {
|
||||
@NotNull
|
||||
@Override
|
||||
public void showLookup() {
|
||||
public Collection<String> getItems(String prefix, boolean cached) {
|
||||
parseExistingMessagesIfNecessary();
|
||||
myPidField.setVariants(myUsedPids);
|
||||
super.showLookup();
|
||||
setItems(Arrays.asList(myUsedPids));
|
||||
return super.getItems(prefix, cached);
|
||||
}
|
||||
};
|
||||
myPidField.setComparator(new Comparator<LookupElement>() {
|
||||
|
||||
@Override
|
||||
public int compare(LookupElement e1, LookupElement e2) {
|
||||
final int pid1 = Integer.parseInt(e1.getLookupString());
|
||||
final int pid2 = Integer.parseInt(e2.getLookupString());
|
||||
public int compare(String item1, String item2) {
|
||||
final int pid1 = Integer.parseInt(item1);
|
||||
final int pid2 = Integer.parseInt(item2);
|
||||
return Comparing.compare(pid1, pid2);
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
myPidFieldWrapper.add(myPidField);
|
||||
|
||||
myLogLevelCombo.setModel(new EnumComboBoxModel<Log.LogLevel>(Log.LogLevel.class));
|
||||
myLogLevelCombo.setRenderer(new DefaultListCellRenderer() {
|
||||
myLogLevelCombo.setRenderer(new ListCellRendererWrapper(myLogLevelCombo.getRenderer()) {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (value != null) {
|
||||
value = StringUtil.capitalize(((Log.LogLevel)value).getStringValue().toLowerCase());
|
||||
setText(StringUtil.capitalize(((Log.LogLevel)value).getStringValue().toLowerCase()));
|
||||
}
|
||||
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -114,31 +105,6 @@ class EditLogFilterDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getCompletionShortcutText() {
|
||||
final AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION);
|
||||
if (action != null) {
|
||||
final ShortcutSet shortcutSet = action.getShortcutSet();
|
||||
if (shortcutSet != null) {
|
||||
final Shortcut[] shortcuts = shortcutSet.getShortcuts();
|
||||
if (shortcuts != null && shortcuts.length > 0) {
|
||||
return KeymapUtil.getShortcutText(shortcuts[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static LookupElement[] toLookupElements(@NotNull String[] strs) {
|
||||
final LookupElement[] result = new LookupElement[strs.length];
|
||||
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
final String s = strs[i];
|
||||
result[i] = LookupElementBuilder.create(s).addLookupString(s.toLowerCase());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void parseExistingMessagesIfNecessary() {
|
||||
if (myExistingMessagesParsed) {
|
||||
return;
|
||||
@@ -219,7 +185,7 @@ class EditLogFilterDialog extends DialogWrapper {
|
||||
@Override
|
||||
protected ValidationInfo doValidate() {
|
||||
final String name = myNameField.getText().trim();
|
||||
|
||||
|
||||
if (name.length() == 0) {
|
||||
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.name.not.specified.error"), myNameField);
|
||||
}
|
||||
@@ -280,51 +246,4 @@ class EditLogFilterDialog extends DialogWrapper {
|
||||
public AndroidConfiguredLogFilters.MyFilterEntry getCustomLogFiltersEntry() {
|
||||
return myEntry;
|
||||
}
|
||||
|
||||
private static class MyTextFieldWithAutoCompletion extends TextFieldWithAutoCompletion {
|
||||
private boolean myToShowHint;
|
||||
private final String myCompletionShortcutText;
|
||||
|
||||
public MyTextFieldWithAutoCompletion(Project project) {
|
||||
super(project);
|
||||
myCompletionShortcutText = getCompletionShortcutText();
|
||||
myToShowHint = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EditorEx createEditor() {
|
||||
final EditorEx editor = super.createEditor();
|
||||
|
||||
if (myCompletionShortcutText == null) {
|
||||
return editor;
|
||||
}
|
||||
|
||||
editor.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
myToShowHint = false;
|
||||
}
|
||||
});
|
||||
|
||||
editor.addFocusListener(new FocusChangeListener() {
|
||||
@Override
|
||||
public void focusGained(final Editor editor) {
|
||||
if (myToShowHint && getText().length() == 0) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HintManager.getInstance().showInformationHint(editor, "Code completion available (" + myCompletionShortcutText + ")");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(Editor editor) {
|
||||
}
|
||||
});
|
||||
|
||||
return editor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.HtmlListCellRenderer;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -14,7 +15,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@@ -73,15 +73,14 @@ public class ExtendedDeviceChooserDialog extends DialogWrapper {
|
||||
Disposer.register(myDisposable, myAvdCombo);
|
||||
|
||||
|
||||
myAvdCombo.getComboBox().setRenderer(new DefaultListCellRenderer() {
|
||||
myAvdCombo.getComboBox().setRenderer(new HtmlListCellRenderer(myAvdCombo.getComboBox().getRenderer()) {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (value == null) {
|
||||
value = myAvdCombo.getComboBox().isEnabled()
|
||||
setText(myAvdCombo.getComboBox().isEnabled()
|
||||
? "<html><font color='red'>[none]</font></html>"
|
||||
: "[none]";
|
||||
: "[none]");
|
||||
}
|
||||
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
}
|
||||
});
|
||||
myComboBoxWrapper.add(myAvdCombo);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</action>
|
||||
<separator/>
|
||||
<action id="tasks.create.changelist" class="com.intellij.tasks.actions.CreateChangelistAction" text="Create Change_list..."/>
|
||||
<action id="tasks.show.task.description" class="com.intellij.tasks.actions.ShowTaskDescription" text="Show Description" />
|
||||
<action id="tasks.show.task.description" class="com.intellij.tasks.actions.ShowTaskDescription" text="Show Description"/>
|
||||
<action id="tasks.open.in.browser" class="com.intellij.tasks.actions.OpenTaskInBrowserAction" text="Open in _Browser">
|
||||
<keyboard-shortcut keymap="$default" first-keystroke="alt shift B"/>
|
||||
</action>
|
||||
@@ -90,14 +90,12 @@
|
||||
|
||||
<editChangelistSupport implementation="com.intellij.tasks.impl.TaskChangelistSupport"/>
|
||||
|
||||
<completion.contributor language="TEXT" implementationClass="com.intellij.tasks.impl.TaskCompletionContributor" order="first, before commitCompletion"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.tasks.impl.TaskProjectConfiguration"
|
||||
serviceImplementation="com.intellij.tasks.impl.TaskProjectConfiguration"/>
|
||||
<projectService serviceInterface="com.intellij.tasks.context.WorkingContextManager"
|
||||
serviceImplementation="com.intellij.tasks.context.WorkingContextManager"/>
|
||||
<applicationService serviceInterface="com.intellij.tasks.config.RecentTaskRepositories"
|
||||
serviceImplementation="com.intellij.tasks.config.RecentTaskRepositories"/>
|
||||
serviceImplementation="com.intellij.tasks.config.RecentTaskRepositories"/>
|
||||
|
||||
<lang.documentationProvider language="TEXT" implementationClass="com.intellij.tasks.doc.TaskDocumentationProvider"/>
|
||||
|
||||
|
||||
@@ -17,10 +17,14 @@
|
||||
package com.intellij.tasks.actions;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.actionSystem.Shortcut;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.fileTypes.PlainTextLanguage;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
@@ -35,15 +39,11 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.tasks.*;
|
||||
import com.intellij.tasks.config.TaskRepositoriesConfigurable;
|
||||
import com.intellij.tasks.impl.TaskCompletionContributor;
|
||||
import com.intellij.tasks.impl.TaskManagerImpl;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.HyperlinkAdapter;
|
||||
import com.intellij.ui.HyperlinkLabel;
|
||||
import com.intellij.ui.LanguageTextField;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.ui.AsyncProcessIcon;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -51,7 +51,9 @@ import javax.swing.event.HyperlinkEvent;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
@@ -83,21 +85,17 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
myProject = project;
|
||||
setTitle("Open Task");
|
||||
|
||||
myTaskName = new LanguageTextField(PlainTextLanguage.INSTANCE, project, "");
|
||||
myEditorPanel.add(myTaskName);
|
||||
|
||||
TaskCompletionContributor.installCompletion(myTaskName.getDocument(), myProject, new Consumer<Task>() {
|
||||
@Override
|
||||
public void consume(Task task) {
|
||||
myTaskName = new TextFieldWithAutoCompletion<Task>(project, new MyTextFieldWithAutoCompletionListProvider(project) {
|
||||
protected void handleInsert(@NotNull final Task task) {
|
||||
mySelectedTask = task;
|
||||
taskChanged();
|
||||
}
|
||||
}, true);
|
||||
|
||||
}, false);
|
||||
myEditorPanel.add(myTaskName);
|
||||
myTaskName.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
taskChanged();
|
||||
taskChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -107,7 +105,7 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
myNameLabel.setText("Enter task name or press " + KeymapUtil.getShortcutText(shortcuts[0]) + " to choose an existing task:");
|
||||
}
|
||||
myNameLabel.setLabelFor(myTaskName);
|
||||
|
||||
|
||||
TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project);
|
||||
ControlBinder binder = new ControlBinder(manager.getState());
|
||||
binder.bindAnnotations(this);
|
||||
@@ -140,7 +138,8 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
myUpdateIcon.setVisible(false);
|
||||
myUpdateLabel.setText("");
|
||||
}
|
||||
@@ -184,7 +183,7 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
|
||||
// refresh change lists
|
||||
ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
for (Iterator<ChangeListInfo> it = taskManager.getOpenChangelists(task).iterator(); it.hasNext();) {
|
||||
for (Iterator<ChangeListInfo> it = taskManager.getOpenChangelists(task).iterator(); it.hasNext(); ) {
|
||||
ChangeListInfo changeListInfo = it.next();
|
||||
if (changeListManager.getChangeList(changeListInfo.id) == null) {
|
||||
it.remove();
|
||||
@@ -194,10 +193,12 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
if (!myVcsEnabled) {
|
||||
myCreateChangelist.setEnabled(false);
|
||||
myCreateChangelist.setSelected(false);
|
||||
} else if (task != null && !taskManager.getOpenChangelists(task).isEmpty()) {
|
||||
}
|
||||
else if (task != null && !taskManager.getOpenChangelists(task).isEmpty()) {
|
||||
myCreateChangelist.setSelected(true);
|
||||
myCreateChangelist.setEnabled(false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
myCreateChangelist.setSelected(taskManager.getState().createChangelist);
|
||||
myCreateChangelist.setEnabled(true);
|
||||
}
|
||||
@@ -236,11 +237,11 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
}
|
||||
else if (mySelectedTask == null) {
|
||||
if (Messages.showOkCancelDialog(myProject,
|
||||
"Issue " + lastId + " not found.\n" +
|
||||
"Do you want to create local task?",
|
||||
"Issue Not Found",
|
||||
CommonBundle.getNoButtonText(), CommonBundle.getYesButtonText(),
|
||||
Messages.getQuestionIcon()) == DialogWrapper.OK_EXIT_CODE) {
|
||||
"Issue " + lastId + " not found.\n" +
|
||||
"Do you want to create local task?",
|
||||
"Issue Not Found",
|
||||
CommonBundle.getNoButtonText(), CommonBundle.getYesButtonText(),
|
||||
Messages.getQuestionIcon()) == DialogWrapper.OK_EXIT_CODE) {
|
||||
return;
|
||||
}
|
||||
mySelectedTask = manager.createLocalTask(taskName);
|
||||
@@ -308,4 +309,88 @@ public class ActivateTaskDialog extends DialogWrapper {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class MyTextFieldWithAutoCompletionListProvider extends TextFieldWithAutoCompletionListProvider<Task> {
|
||||
private final TaskSearchSupport mySearchSupport;
|
||||
|
||||
public MyTextFieldWithAutoCompletionListProvider(@Nullable final Project project) {
|
||||
super(null);
|
||||
mySearchSupport = new TaskSearchSupport(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getQuickDocHotKeyAdvertisementTail(@NotNull String shortcut) {
|
||||
return " would show task description and comments";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Task> getItems(final String prefix, final boolean cached) {
|
||||
return mySearchSupport.getItems(prefix, cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItems(@Nullable Collection variants) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookupElementBuilder createLookupBuilder(@NotNull final Task task) {
|
||||
LookupElementBuilder builder = super.createLookupBuilder(task);
|
||||
|
||||
builder = builder.addLookupString(task.getSummary());
|
||||
if (task.isClosed()) {
|
||||
builder = builder.setStrikeout();
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InsertHandler<LookupElement> createInsertHandler(@NotNull final Task task) {
|
||||
return new InsertHandler<LookupElement>() {
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context, LookupElement item) {
|
||||
Document document = context.getEditor().getDocument();
|
||||
String s = task.getId() + ": " + task.getSummary();
|
||||
s = StringUtil.convertLineSeparators(s);
|
||||
document.replaceString(context.getStartOffset(), context.getTailOffset(), s);
|
||||
context.getEditor().getCaretModel().moveToOffset(context.getStartOffset() + s.length());
|
||||
|
||||
MyTextFieldWithAutoCompletionListProvider.this.handleInsert(task);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void handleInsert(@NotNull final Task task) {
|
||||
// Override it for autocompletion insert handler
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Icon getIcon(@NotNull final Task task) {
|
||||
return task.getIcon();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getLookupString(@NotNull final Task task) {
|
||||
return task.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTailText(@NotNull final Task task) {
|
||||
return " " + task.getSummary();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTypeText(@NotNull final Task task) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(@NotNull final Task task1, @NotNull final Task task2) {
|
||||
// N/A here
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeList;
|
||||
import com.intellij.openapi.vcs.changes.ui.EditChangelistSupport;
|
||||
import com.intellij.tasks.actions.ActivateTaskDialog;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.TextFieldWithAutoCompletionContributor;
|
||||
import com.intellij.util.Consumer;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -40,7 +42,10 @@ public class TaskChangelistSupport implements EditChangelistSupport {
|
||||
|
||||
public void installSearch(EditorTextField name, final EditorTextField comment) {
|
||||
Document document = name.getDocument();
|
||||
TaskCompletionContributor.installCompletion(document, myProject, null, false);
|
||||
final ActivateTaskDialog.MyTextFieldWithAutoCompletionListProvider completionProvider =
|
||||
new ActivateTaskDialog.MyTextFieldWithAutoCompletionListProvider(myProject);
|
||||
|
||||
TextFieldWithAutoCompletionContributor.installCompletion(document, myProject, completionProvider, false);
|
||||
}
|
||||
|
||||
public Consumer<LocalChangeList> addControls(JPanel bottomPanel, LocalChangeList initial) {
|
||||
@@ -48,8 +53,8 @@ public class TaskChangelistSupport implements EditChangelistSupport {
|
||||
checkBox.setMnemonic('t');
|
||||
checkBox.setToolTipText("Reload context (e.g. open editors) when changelist is set active");
|
||||
checkBox.setSelected(initial == null ?
|
||||
myTaskManager.getState().trackContextForNewChangelist :
|
||||
myTaskManager.getAssociatedTask(initial) != null);
|
||||
myTaskManager.getState().trackContextForNewChangelist :
|
||||
myTaskManager.getAssociatedTask(initial) != null);
|
||||
bottomPanel.add(checkBox);
|
||||
return new Consumer<LocalChangeList>() {
|
||||
public void consume(LocalChangeList changeList) {
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
package com.intellij.tasks.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.tasks.Task;
|
||||
import com.intellij.tasks.actions.TaskSearchSupport;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class TaskCompletionContributor extends CompletionContributor {
|
||||
|
||||
private static final Key<Consumer<Task>> KEY = Key.create("task completion available");
|
||||
private static final Key<Boolean> AUTO_POPUP_KEY = Key.create("task completion auto-popup");
|
||||
|
||||
public static void installCompletion(Document document, Project project, @Nullable Consumer<Task> consumer, boolean autoPopup) {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile != null) {
|
||||
//noinspection unchecked
|
||||
psiFile.putUserData(KEY, consumer == null ? (Consumer<Task>)Consumer.EMPTY_CONSUMER : consumer);
|
||||
psiFile.putUserData(AUTO_POPUP_KEY, autoPopup);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
|
||||
PsiFile file = parameters.getOriginalFile();
|
||||
final Consumer<Task> consumer = file.getUserData(KEY);
|
||||
|
||||
if (CompletionService.getCompletionService().getAdvertisementText() == null) {
|
||||
final String shortcut = getActionShortcut(IdeActions.ACTION_QUICK_JAVADOC);
|
||||
if (shortcut != null) {
|
||||
CompletionService.getCompletionService().setAdvertisementText("Pressing " + shortcut + " would show task description and comments");
|
||||
}
|
||||
}
|
||||
|
||||
if (consumer != null) {
|
||||
|
||||
String text = parameters.getOriginalFile().getText();
|
||||
int i = text.lastIndexOf(' ', parameters.getOffset() - 1) + 1;
|
||||
final String prefix = text.substring(i, parameters.getOffset());
|
||||
if (parameters.getInvocationCount() == 0 && !file.getUserData(AUTO_POPUP_KEY)) { // is autopopup
|
||||
return;
|
||||
}
|
||||
result = result.withPrefixMatcher(new PlainPrefixMatcher(prefix));
|
||||
|
||||
final TaskSearchSupport searchSupport = new TaskSearchSupport(file.getProject());
|
||||
List<Task> items = searchSupport.getItems(prefix, true);
|
||||
addCompletionElements(result, consumer, items, -10000);
|
||||
|
||||
Future<List<Task>> future = ApplicationManager.getApplication().executeOnPooledThread(new Callable<List<Task>>() {
|
||||
@Override
|
||||
public List<Task> call() {
|
||||
return searchSupport.getItems(prefix, false);
|
||||
}
|
||||
});
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
List<Task> tasks = future.get(100, TimeUnit.MILLISECONDS);
|
||||
if (tasks != null) {
|
||||
addCompletionElements(result, consumer, tasks, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
|
||||
}
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addCompletionElements(CompletionResultSet result, final Consumer<Task> consumer, List<Task> items, int index) {
|
||||
final AutoCompletionPolicy completionPolicy = ApplicationManager.getApplication().isUnitTestMode()
|
||||
? AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE
|
||||
: AutoCompletionPolicy.NEVER_AUTOCOMPLETE;
|
||||
|
||||
for (final Task task : items) {
|
||||
LookupElementBuilder builder = LookupElementBuilder.create(task, task.getId())
|
||||
.setIcon(task.getIcon())
|
||||
.addLookupString(task.getSummary())
|
||||
.setTailText(" " + task.getSummary(), true)
|
||||
.setInsertHandler(new InsertHandler<LookupElement>() {
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context, LookupElement item) {
|
||||
Document document = context.getEditor().getDocument();
|
||||
String s = task.getId() + ": " + task.getSummary();
|
||||
s = StringUtil.convertLineSeparators(s);
|
||||
document.replaceString(context.getStartOffset(), context.getTailOffset(), s);
|
||||
context.getEditor().getCaretModel().moveToOffset(context.getStartOffset() + s.length());
|
||||
consumer.consume(task);
|
||||
}
|
||||
});
|
||||
if (task.isClosed()) {
|
||||
builder = builder.setStrikeout();
|
||||
}
|
||||
|
||||
result.addElement(PrioritizedLookupElement.withGrouping(builder.withAutoCompletionPolicy(completionPolicy), index--));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,16 @@ package com.intellij.tasks;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.ui.CommitMessage;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.tasks.actions.ActivateTaskDialog;
|
||||
import com.intellij.tasks.impl.LocalTaskImpl;
|
||||
import com.intellij.tasks.impl.TaskCompletionContributor;
|
||||
import com.intellij.tasks.impl.TaskManagerImpl;
|
||||
import com.intellij.testFramework.MapDataContext;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.ui.TextFieldWithAutoCompletionContributor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -64,9 +66,11 @@ public class TaskCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
private void configureFile(String text) {
|
||||
PsiFile psiFile = myFixture.configureByText("test.txt", text);
|
||||
Document document = myFixture.getDocument(psiFile);
|
||||
TaskCompletionContributor.installCompletion(document, getProject(), null, false);
|
||||
final Project project = getProject();
|
||||
TextFieldWithAutoCompletionContributor.installCompletion(document, project,
|
||||
new ActivateTaskDialog.MyTextFieldWithAutoCompletionListProvider(project),
|
||||
false);
|
||||
document.putUserData(CommitMessage.DATA_CONTEXT_KEY, new MapDataContext());
|
||||
|
||||
}
|
||||
|
||||
private void configureRepository(LocalTaskImpl... tasks) {
|
||||
|
||||
+2
-1
@@ -106,7 +106,8 @@ public class HtmlUnknownAttributeInspection extends HtmlUnknownTagInspection {
|
||||
quickfixes[2] = new SwitchToHtml5WithHighPriorityAction();
|
||||
}
|
||||
|
||||
holder.registerProblem(nameElement, XmlErrorMessages.message("attribute.is.not.allowed.here", name),
|
||||
if (nameElement.getTextLength() > 0)
|
||||
holder.registerProblem(nameElement, XmlErrorMessages.message("attribute.is.not.allowed.here", name),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, quickfixes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,8 @@ public class HtmlLanguageLevelForm {
|
||||
private List<MyListener> myListeners = new ArrayList<MyListener>();
|
||||
|
||||
public HtmlLanguageLevelForm(Project project) {
|
||||
myDoctypeTextField = new TextFieldWithAutoCompletion(project);
|
||||
final String[] urls = ExternalResourceManager.getInstance().getResourceUrls(null, true);
|
||||
myDoctypeTextField = TextFieldWithAutoCompletion.create(project, Arrays.asList(urls), null, true);
|
||||
myOtherDoctypeWrapper.add(myDoctypeTextField);
|
||||
ActionListener listener = new ActionListener() {
|
||||
@Override
|
||||
@@ -60,7 +62,6 @@ public class HtmlLanguageLevelForm {
|
||||
fireDoctypeChanged();
|
||||
}
|
||||
});
|
||||
myDoctypeTextField.setVariants(ExternalResourceManager.getInstance().getResourceUrls(null, true));
|
||||
}
|
||||
|
||||
public JPanel getContentPanel() {
|
||||
|
||||
Reference in New Issue
Block a user