mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge commit 'origin/master'
This commit is contained in:
Generated
+2
-1
@@ -1,5 +1,6 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA" type="Application" factoryName="Application">
|
||||
<configuration default="false" name="IDEA" type="Application" factoryName="Application" singleton="true">
|
||||
<log_file path="$PROJECT_DIR$/system/log/idea.log" checked="true" skipped="true" show_all="false" alias="idea.log" />
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
|
||||
<option name="VM_PARAMETERS" value=" -ea -Xbootclasspath/p:../out/classes/production/boot -Xmx192m -Didea.is.internal=true -XX:MaxPermSize=150m " />
|
||||
|
||||
@@ -56,6 +56,8 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
private TextFieldWithBrowseButton myProcessorPathField;
|
||||
private JTextField myGeneratedProductionDirField;
|
||||
private JTextField myGeneratedTestsDirField;
|
||||
private JRadioButton myRbRelativeToOutputRoot;
|
||||
private JRadioButton myRbRelativeToContentRoot;
|
||||
private ProcessorTableModel myProcessorsModel;
|
||||
private JCheckBox myCbEnableProcessing;
|
||||
private JBTable myProcessorTable;
|
||||
@@ -63,6 +65,12 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
private JPanel myProcessorPanel;
|
||||
private JPanel myOptionsPanel;
|
||||
private OptionsTableModel myOptionsModel;
|
||||
private JLabel myWarninglabel;
|
||||
private JLabel myStoreGenSourcesLabel;
|
||||
private JLabel myProductionLabel;
|
||||
private JLabel myTestLabel;
|
||||
private JPanel myProcessorTablePanel;
|
||||
private JPanel myOptionsTablePanel;
|
||||
|
||||
|
||||
public ProcessorProfilePanel(Project project) {
|
||||
@@ -71,11 +79,21 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
|
||||
myCbEnableProcessing = new JCheckBox("Enable annotation processing");
|
||||
|
||||
myRbClasspath = new JRadioButton("Obtain processors from project classpath");
|
||||
myRbProcessorsPath = new JRadioButton("Processor path:");
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(myRbClasspath);
|
||||
group.add(myRbProcessorsPath);
|
||||
{
|
||||
myRbClasspath = new JRadioButton("Obtain processors from project classpath");
|
||||
myRbProcessorsPath = new JRadioButton("Processor path:");
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(myRbClasspath);
|
||||
group.add(myRbProcessorsPath);
|
||||
}
|
||||
|
||||
{
|
||||
myRbRelativeToContentRoot = new JRadioButton("Module content root");
|
||||
myRbRelativeToOutputRoot = new JRadioButton("Module output directory");
|
||||
final ButtonGroup group = new ButtonGroup();
|
||||
group.add(myRbRelativeToContentRoot);
|
||||
group.add(myRbRelativeToOutputRoot);
|
||||
}
|
||||
|
||||
myProcessorPathField = new TextFieldWithBrowseButton(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -94,62 +112,66 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
final JPanel processorTablePanel = new JPanel(new BorderLayout());
|
||||
myProcessorTablePanel = new JPanel(new BorderLayout());
|
||||
myProcessorsModel = new ProcessorTableModel();
|
||||
processorTablePanel.setBorder(IdeBorderFactory.createTitledBorder("Annotation Processors", false));
|
||||
myProcessorTablePanel.setBorder(IdeBorderFactory.createTitledBorder("Annotation Processors", false));
|
||||
myProcessorTable = new JBTable(myProcessorsModel);
|
||||
myProcessorTable.getEmptyText().setText("Compiler will run all automatically discovered processors");
|
||||
myProcessorPanel = createTablePanel(myProcessorTable);
|
||||
processorTablePanel.add(myProcessorPanel, BorderLayout.CENTER);
|
||||
myProcessorTablePanel.add(myProcessorPanel, BorderLayout.CENTER);
|
||||
|
||||
final JPanel optionsTablePanel = new JPanel(new BorderLayout());
|
||||
myOptionsTablePanel = new JPanel(new BorderLayout());
|
||||
myOptionsModel = new OptionsTableModel();
|
||||
optionsTablePanel.setBorder(IdeBorderFactory.createTitledBorder("Annotation Processor options", false));
|
||||
myOptionsTablePanel.setBorder(IdeBorderFactory.createTitledBorder("Annotation Processor options", false));
|
||||
myOptionsTable = new JBTable(myOptionsModel);
|
||||
myOptionsTable.getEmptyText().setText("No processor-specific options configured");
|
||||
myOptionsPanel = createTablePanel(myOptionsTable);
|
||||
optionsTablePanel.add(myOptionsPanel, BorderLayout.CENTER);
|
||||
myOptionsTablePanel.add(myOptionsPanel, BorderLayout.CENTER);
|
||||
|
||||
myGeneratedProductionDirField = new JTextField();
|
||||
myGeneratedTestsDirField = new JTextField();
|
||||
|
||||
final JLabel warning = new JLabel("<html>WARNING!<br>" +
|
||||
myWarninglabel = new JLabel("<html>WARNING!<br>" +
|
||||
/*"All source files located in the generated sources output directory WILL BE EXCLUDED from annotation processing. " +*/
|
||||
"If option 'Clear output directory on rebuild' is enabled, " +
|
||||
"the entire contents of directories where generated sources are stored WILL BE CLEARED on rebuild.</html>");
|
||||
warning.setFont(warning.getFont().deriveFont(Font.BOLD));
|
||||
myWarninglabel.setFont(myWarninglabel.getFont().deriveFont(Font.BOLD));
|
||||
|
||||
add(myCbEnableProcessing,
|
||||
new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
||||
add(myRbClasspath,
|
||||
new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
|
||||
add(myRbProcessorsPath,
|
||||
new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
|
||||
add(myProcessorPathField,
|
||||
new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0));
|
||||
new GridBagConstraints(1, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0));
|
||||
|
||||
final JLabel noteMessage = new JLabel("<html>Source files generated by annotation processors will be stored under the project output directory. " +
|
||||
"To override this behaviour for this profile you may specify the directory name in the field below. " +
|
||||
"If specified, the directory will be created under corresponding module's content root.</html>");
|
||||
add(noteMessage,
|
||||
new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
myStoreGenSourcesLabel = new JLabel("Store generated sources relative to: ");
|
||||
add(myStoreGenSourcesLabel,
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(15, 5, 0, 0), 0, 0));
|
||||
add(myRbRelativeToOutputRoot,
|
||||
new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(15, 5, 0, 0), 0, 0));
|
||||
add(myRbRelativeToContentRoot,
|
||||
new GridBagConstraints(2, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(15, 5, 0, 0), 0, 0));
|
||||
|
||||
add(new JLabel("Production sources directory:"),
|
||||
new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
myProductionLabel = new JLabel("Production sources directory:");
|
||||
add(myProductionLabel,
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
add(myGeneratedProductionDirField,
|
||||
new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
new GridBagConstraints(1, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
|
||||
add(new JLabel("Test sources directory:"),
|
||||
new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
myTestLabel = new JLabel("Test sources directory:");
|
||||
add(myTestLabel,
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
add(myGeneratedTestsDirField,
|
||||
new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
new GridBagConstraints(1, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
|
||||
add(processorTablePanel,
|
||||
new GridBagConstraints(0, 6, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
|
||||
add(optionsTablePanel,
|
||||
new GridBagConstraints(0, 7, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
|
||||
add(warning,
|
||||
new GridBagConstraints(0, 8, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
add(myProcessorTablePanel,
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
|
||||
add(myOptionsTablePanel,
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
|
||||
add(myWarninglabel,
|
||||
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
|
||||
|
||||
myRbClasspath.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
@@ -185,6 +207,12 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
myGeneratedProductionDirField.setText(productionDirName != null? productionDirName.trim() : "");
|
||||
final String testsDirName = config.getGeneratedSourcesDirectoryName(true);
|
||||
myGeneratedTestsDirField.setText(testsDirName != null? testsDirName.trim() : "");
|
||||
if (config.isOutputRelativeToContentRoot()) {
|
||||
myRbRelativeToContentRoot.setSelected(true);
|
||||
}
|
||||
else {
|
||||
myRbRelativeToOutputRoot.setSelected(true);
|
||||
}
|
||||
myProcessorsModel.setProcessors(config.getProcessors());
|
||||
myOptionsModel.setOptions(config.getProcessorOptions());
|
||||
|
||||
@@ -201,6 +229,8 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
final String testsDir = myGeneratedTestsDirField.getText().trim();
|
||||
profile.setGeneratedSourcesDirectoryName(StringUtil.isEmpty(testsDir)? null : testsDir, true);
|
||||
|
||||
profile.setOutputRelativeToContentRoot(myRbRelativeToContentRoot.isSelected());
|
||||
|
||||
profile.clearProcessors();
|
||||
for (String processor : myProcessorsModel.getProcessors()) {
|
||||
profile.addProcessor(processor);
|
||||
@@ -240,6 +270,14 @@ public class ProcessorProfilePanel extends JPanel {
|
||||
updateTable(myOptionsPanel, myOptionsTable, enabled);
|
||||
myGeneratedProductionDirField.setEnabled(enabled);
|
||||
myGeneratedTestsDirField.setEnabled(enabled);
|
||||
myRbRelativeToOutputRoot.setEnabled(enabled);
|
||||
myRbRelativeToContentRoot.setEnabled(enabled);
|
||||
myWarninglabel.setEnabled(enabled);
|
||||
myStoreGenSourcesLabel.setEnabled(enabled);
|
||||
myProductionLabel.setEnabled(enabled);
|
||||
myTestLabel.setEnabled(enabled);
|
||||
myProcessorTablePanel.setEnabled(enabled);
|
||||
myOptionsTablePanel.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private static void updateTable(final JPanel tablePanel, final JBTable table, boolean enabled) {
|
||||
|
||||
@@ -720,8 +720,8 @@ public class BuildManager implements ApplicationComponent{
|
||||
final GeneralCommandLine cmdLine = new GeneralCommandLine();
|
||||
final String vmExecutablePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
|
||||
cmdLine.setExePath(vmExecutablePath);
|
||||
cmdLine.addParameter("-XX:MaxPermSize=150m");
|
||||
cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
|
||||
//cmdLine.addParameter("-XX:MaxPermSize=150m");
|
||||
//cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
|
||||
final int heapSize = config.COMPILER_PROCESS_HEAP_SIZE;
|
||||
final int xms = heapSize / 2;
|
||||
if (xms > 32) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CompilerWorkspaceConfiguration implements PersistentStateComponent<
|
||||
public boolean MAKE_PROJECT_ON_SAVE = false;
|
||||
public boolean PARALLEL_COMPILATION = false;
|
||||
public int COMPILER_PROCESS_HEAP_SIZE = 700;
|
||||
public String COMPILER_PROCESS_ADDITIONAL_VM_OPTIONS = "";
|
||||
public String COMPILER_PROCESS_ADDITIONAL_VM_OPTIONS = "-XX:MaxPermSize=150m";
|
||||
|
||||
public static CompilerWorkspaceConfiguration getInstance(Project project) {
|
||||
return ServiceManager.getService(project, CompilerWorkspaceConfiguration.class);
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.roots.CompilerProjectExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -34,6 +33,7 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.java.compiler.AnnotationProcessingConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
@@ -214,10 +214,9 @@ public class CompilerPaths {
|
||||
|
||||
@Nullable
|
||||
public static String getAnnotationProcessorsGenerationPath(Module module) {
|
||||
final CompilerConfiguration config = CompilerConfiguration.getInstance(module.getProject());
|
||||
|
||||
final String sourceDirName = config.getAnnotationProcessingConfiguration(module).getGeneratedSourcesDirectoryName(false);
|
||||
if (!StringUtil.isEmpty(sourceDirName)) {
|
||||
final AnnotationProcessingConfiguration config = CompilerConfiguration.getInstance(module.getProject()).getAnnotationProcessingConfiguration(module);
|
||||
final String sourceDirName = config.getGeneratedSourcesDirectoryName(false);
|
||||
if (config.isOutputRelativeToContentRoot()) {
|
||||
final String[] roots = ModuleRootManager.getInstance(module).getContentRootUrls();
|
||||
if (roots.length == 0) {
|
||||
return null;
|
||||
@@ -225,18 +224,15 @@ public class CompilerPaths {
|
||||
if (roots.length > 1) {
|
||||
Arrays.sort(roots, URLS_COMPARATOR);
|
||||
}
|
||||
return VirtualFileManager.extractPath(roots[0]) + "/" + sourceDirName;
|
||||
return StringUtil.isEmpty(sourceDirName)? VirtualFileManager.extractPath(roots[0]): VirtualFileManager.extractPath(roots[0]) + "/" + sourceDirName;
|
||||
}
|
||||
|
||||
final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(module.getProject());
|
||||
if (extension == null) {
|
||||
|
||||
final String path = getModuleOutputPath(module, false);
|
||||
if (path == null) {
|
||||
return null;
|
||||
}
|
||||
final String url = extension.getCompilerOutputUrl();
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
return VirtualFileManager.extractPath(url) + "/" + DEFAULT_GENERATED_DIR_NAME + "/" + module.getName().toLowerCase();
|
||||
return StringUtil.isEmpty(sourceDirName)? path : path + "/" + sourceDirName;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public class DefaultCodeFragmentFactory extends CodeFragmentFactory {
|
||||
|
||||
if (parameters.getInvocationCount() <= 1 && JavaCompletionUtil.mayHaveSideEffects(expression)) {
|
||||
final CompletionService service = CompletionService.getCompletionService();
|
||||
if (service.getAdvertisementText() == null && parameters.getInvocationCount() < 2) {
|
||||
if (parameters.getInvocationCount() < 2) {
|
||||
service.setAdvertisementText("Invoke completion once more to see runtime type variants");
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.Transient;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
@@ -31,7 +31,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
@State(name = "SelectProjectTemplateSettings", storages = {@Storage( file = StoragePathMacros.APP_CONFIG + "/other.xml")})
|
||||
public class SelectTemplateSettings implements PersistentStateComponent<SelectTemplateSettings> {
|
||||
|
||||
static SelectTemplateSettings getInstance() {
|
||||
private static final String STATE_ELEMENT_NAME = "treeState";
|
||||
|
||||
public static SelectTemplateSettings getInstance() {
|
||||
return ServiceManager.getService(SelectTemplateSettings.class);
|
||||
}
|
||||
|
||||
@@ -45,11 +47,11 @@ public class SelectTemplateSettings implements PersistentStateComponent<SelectTe
|
||||
myTreeState = state;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
public SelectTemplateSettings getState() {
|
||||
try {
|
||||
myTreeState.writeExternal(treeState);
|
||||
myTreeState.writeExternal(myElement = new Element(STATE_ELEMENT_NAME));
|
||||
}
|
||||
catch (WriteExternalException ignore) {
|
||||
}
|
||||
@@ -59,14 +61,14 @@ public class SelectTemplateSettings implements PersistentStateComponent<SelectTe
|
||||
@Override
|
||||
public void loadState(SelectTemplateSettings state) {
|
||||
try {
|
||||
myTreeState.readExternal(state.treeState);
|
||||
myTreeState.readExternal(state.myElement);
|
||||
}
|
||||
catch (InvalidDataException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
@Tag("treeState")
|
||||
public Element treeState = new Element("treeState");
|
||||
public Element myElement = new Element(STATE_ELEMENT_NAME);
|
||||
|
||||
private TreeState myTreeState = new TreeState();
|
||||
}
|
||||
|
||||
+6
-4
@@ -35,6 +35,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CreateFromScratchMode extends WizardMode {
|
||||
@@ -53,19 +54,20 @@ public class CreateFromScratchMode extends WizardMode {
|
||||
|
||||
@Nullable
|
||||
protected StepSequence createSteps(final WizardContext context, @NotNull final ModulesProvider modulesProvider) {
|
||||
for (ModuleBuilder builder : ModuleBuilder.getAllBuilders()) {
|
||||
List<ModuleBuilder> builders = ModuleBuilder.getAllBuilders();
|
||||
for (ModuleBuilder builder : builders) {
|
||||
myBuildersMap.put(builder.getBuilderId(), builder);
|
||||
}
|
||||
myBuildersMap.put(ModuleType.EMPTY.getId(), new EmptyModuleBuilder());
|
||||
return addSteps(context, modulesProvider, this, new StepSequence());
|
||||
return addSteps(context, modulesProvider, this, new StepSequence(), builders);
|
||||
}
|
||||
|
||||
static StepSequence addSteps(WizardContext context,
|
||||
ModulesProvider modulesProvider,
|
||||
WizardMode mode,
|
||||
StepSequence sequence) {
|
||||
StepSequence sequence, List<ModuleBuilder> builders) {
|
||||
sequence.addCommonStep(new ProjectNameWithTypeStep(context, sequence, mode));
|
||||
for (ModuleBuilder builder : ModuleBuilder.getAllBuilders()) {
|
||||
for (ModuleBuilder builder : builders) {
|
||||
addModuleBuilder(builder, context, modulesProvider, sequence);
|
||||
}
|
||||
return sequence;
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class CreateFromTemplateMode extends WizardMode {
|
||||
StepSequence sequence = new StepSequence();
|
||||
mySelectTemplateStep = new SelectTemplateStep(context, sequence);
|
||||
sequence.addCommonStep(mySelectTemplateStep);
|
||||
return CreateFromScratchMode.addSteps(context, modulesProvider, this, sequence);
|
||||
return CreateFromScratchMode.addSteps(context, modulesProvider, this, sequence, ModuleBuilder.getAllBuilders());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-6
@@ -60,12 +60,7 @@ public class JavaClassNameCompletionContributor extends CompletionContributor {
|
||||
|
||||
static void addAllClasses(CompletionParameters parameters, final CompletionResultSet _result) {
|
||||
CompletionResultSet result = _result.withPrefixMatcher(CompletionUtil.findReferenceOrAlphanumericPrefix(parameters));
|
||||
addAllClasses(parameters, parameters.getInvocationCount() <= 1, result.getPrefixMatcher(), new Consumer<LookupElement>() {
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
_result.addElement(element);
|
||||
}
|
||||
});
|
||||
addAllClasses(parameters, parameters.getInvocationCount() <= 1, result.getPrefixMatcher(), _result);
|
||||
}
|
||||
|
||||
private static boolean mayContainClassName(CompletionParameters parameters) {
|
||||
|
||||
+25
-11
@@ -15,11 +15,15 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReference;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -31,32 +35,42 @@ public class JavaClassReferenceCompletionContributor extends CompletionContribut
|
||||
public void duringCompletion(@NotNull CompletionInitializationContext context) {
|
||||
JavaClassReference reference = findJavaClassReference(context.getFile(), context.getStartOffset());
|
||||
if (reference != null && reference.getExtendClassNames() != null) {
|
||||
final PsiReference[] references = reference.getJavaClassReferenceSet().getReferences();
|
||||
final PsiReference last = references[references.length - 1];
|
||||
context.setReplacementOffset(last.getRangeInElement().getEndOffset() + last.getElement().getTextRange().getStartOffset());
|
||||
JavaClassReferenceSet set = reference.getJavaClassReferenceSet();
|
||||
context.setReplacementOffset(set.getRangeInElement().getEndOffset() + set.getElement().getTextRange().getStartOffset());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
|
||||
if (parameters.getCompletionType() == CompletionType.SMART) {
|
||||
return;
|
||||
}
|
||||
|
||||
PsiElement position = parameters.getPosition();
|
||||
JavaClassReference reference = findJavaClassReference(position.getContainingFile(), parameters.getOffset());
|
||||
if (reference == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] extendClassNames = reference.getExtendClassNames();
|
||||
PsiElement context = reference.getCompletionContext();
|
||||
if (extendClassNames != null && context instanceof PsiPackage) {
|
||||
if (parameters.getCompletionType() == CompletionType.SMART) {
|
||||
JavaClassReferenceSet set = reference.getJavaClassReferenceSet();
|
||||
int setStart = set.getRangeInElement().getStartOffset() + set.getElement().getTextRange().getStartOffset();
|
||||
String fullPrefix = parameters.getPosition().getContainingFile().getText().substring(setStart, parameters.getOffset());
|
||||
reference.processSubclassVariants((PsiPackage)context, extendClassNames, result.withPrefixMatcher(fullPrefix));
|
||||
return;
|
||||
}
|
||||
result.addLookupAdvertisement("Press " + getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION) + " to see inheritors of " +
|
||||
StringUtil.join(extendClassNames, ", "));
|
||||
}
|
||||
|
||||
if (parameters.getCompletionType() == CompletionType.SMART) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parameters.getCompletionType() == CompletionType.CLASS_NAME) {
|
||||
JavaClassNameCompletionContributor.addAllClasses(parameters, result);
|
||||
}
|
||||
else {
|
||||
CompletionData data = CompletionUtil.getCompletionDataByElement(position, parameters.getOriginalFile());
|
||||
if (data != null) {
|
||||
LegacyCompletionContributor.completeReference(parameters, result, data);
|
||||
}
|
||||
LegacyCompletionContributor.completeReference(parameters, result);
|
||||
}
|
||||
result.stopHere();
|
||||
}
|
||||
|
||||
+4
-9
@@ -237,12 +237,7 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
!((PsiReferenceExpression)parent).isQualified() &&
|
||||
parameters.isExtendedCompletion() &&
|
||||
StringUtil.isNotEmpty(matcher.getPrefix())) {
|
||||
new JavaStaticMemberProcessor(parameters).processStaticMethodsGlobally(matcher, new Consumer<LookupElement>() {
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
result.addElement(element);
|
||||
}
|
||||
});
|
||||
new JavaStaticMemberProcessor(parameters).processStaticMethodsGlobally(matcher, result);
|
||||
}
|
||||
result.stopHere();
|
||||
}
|
||||
@@ -265,13 +260,13 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
advertiseSecondCompletion(parameters.getPosition().getProject());
|
||||
advertiseSecondCompletion(parameters.getPosition().getProject(), result);
|
||||
}
|
||||
}
|
||||
|
||||
public static void advertiseSecondCompletion(Project project) {
|
||||
public static void advertiseSecondCompletion(Project project, CompletionResultSet result) {
|
||||
if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(CodeCompletionFeatures.SECOND_BASIC_COMPLETION, project)) {
|
||||
CompletionService.getCompletionService().setAdvertisementText("Press " + getActionShortcut(IdeActions.ACTION_CODE_COMPLETION) + " to see non-imported classes");
|
||||
result.addLookupAdvertisement("Press " + getActionShortcut(IdeActions.ACTION_CODE_COMPLETION) + " to see non-imported classes");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -554,12 +554,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
|
||||
|
||||
static void addExpectedTypeMembers(CompletionParameters parameters, final CompletionResultSet result, PsiElement position) {
|
||||
for (final ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) {
|
||||
new JavaMembersGetter(info.getDefaultType(), parameters).addMembers(parameters.getInvocationCount() > 1, new Consumer<LookupElement>() {
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
result.addElement(element);
|
||||
}
|
||||
});
|
||||
new JavaMembersGetter(info.getDefaultType(), parameters).addMembers(parameters.getInvocationCount() > 1, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,12 +90,7 @@ public class JavaNoVariantsDelegator extends CompletionContributor {
|
||||
private static void suggestCollectionUtilities(CompletionParameters parameters, final CompletionResultSet result, PsiElement position) {
|
||||
if (StringUtil.isNotEmpty(result.getPrefixMatcher().getPrefix())) {
|
||||
for (ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) {
|
||||
new CollectionsUtilityMethodsProvider(position, info.getType(), info.getDefaultType(), new Consumer<LookupElement>() {
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
result.addElement(element);
|
||||
}
|
||||
}).addCompletions(true);
|
||||
new CollectionsUtilityMethodsProvider(position, info.getType(), info.getDefaultType(), result).addCompletions(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class StaticMemberProcessor {
|
||||
}
|
||||
|
||||
private void showHint(boolean shouldImport) {
|
||||
if (!myHintShown && !shouldImport && CompletionService.getCompletionService().getAdvertisementText() == null) {
|
||||
if (!myHintShown && !shouldImport) {
|
||||
final String shortcut = CompletionContributor.getActionShortcut(IdeActions.ACTION_SHOW_INTENTION_ACTIONS);
|
||||
if (shortcut != null) {
|
||||
CompletionService.getCompletionService().setAdvertisementText("To import a method statically, press " + shortcut);
|
||||
|
||||
+1
-1
@@ -983,7 +983,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
}
|
||||
if (!myHolder.hasErrorResults()) {
|
||||
final PsiType functionalInterfaceType = expression.getFunctionalInterfaceType();
|
||||
if (LambdaUtil.dependsOnTypeParams(functionalInterfaceType, functionalInterfaceType, expression, null)) {
|
||||
if (functionalInterfaceType != null && LambdaUtil.dependsOnTypeParams(functionalInterfaceType, functionalInterfaceType, expression, null)) {
|
||||
myHolder.add(HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, "Cyclic inference")); //todo[ann] append not inferred type params info
|
||||
} else {
|
||||
final PsiElement referenceNameElement = expression.getReferenceNameElement();
|
||||
|
||||
+22
-31
@@ -23,6 +23,8 @@ import com.intellij.codeInsight.daemon.impl.quickfix.OrderEntryFix;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixActionRegistrarImpl;
|
||||
import com.intellij.codeInsight.daemon.quickFix.CreateClassOrPackageFix;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.LocalQuickFixProvider;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
@@ -49,13 +51,17 @@ import com.intellij.psi.util.ClassKind;
|
||||
import com.intellij.psi.util.ClassUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -225,15 +231,8 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
|
||||
@Override
|
||||
@NotNull
|
||||
public Object[] getVariants() {
|
||||
PsiElement context = getContext();
|
||||
if (context == null) {
|
||||
context = JavaPsiFacade.getInstance(getElement().getProject()).findPackage("");
|
||||
}
|
||||
PsiElement context = getCompletionContext();
|
||||
if (context instanceof PsiPackage) {
|
||||
final String[] extendClasses = getExtendClassNames();
|
||||
if (extendClasses != null) {
|
||||
return getSubclassVariants((PsiPackage)context, extendClasses);
|
||||
}
|
||||
return processPackage((PsiPackage)context);
|
||||
}
|
||||
if (context instanceof PsiClass) {
|
||||
@@ -257,6 +256,12 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getCompletionContext() {
|
||||
PsiElement context = getContext();
|
||||
return context == null ? JavaPsiFacade.getInstance(getElement().getProject()).findPackage("") : context;
|
||||
}
|
||||
|
||||
public String[] getExtendClassNames() {
|
||||
return JavaClassReferenceProvider.EXTEND_CLASS_NAMES.getValue(getOptions());
|
||||
}
|
||||
@@ -508,8 +513,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Object[] getSubclassVariants(@NotNull PsiPackage context, @NotNull String[] extendClasses) {
|
||||
HashSet<Object> lookups = new HashSet<Object>();
|
||||
public void processSubclassVariants(@NotNull PsiPackage context, @NotNull String[] extendClasses, Consumer<LookupElement> result) {
|
||||
GlobalSearchScope packageScope = PackageScope.packageScope(context, true);
|
||||
GlobalSearchScope scope = myJavaClassReferenceSet.getProvider().getScope(getElement().getProject());
|
||||
if (scope != null) {
|
||||
@@ -529,35 +533,22 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
|
||||
// add itself
|
||||
if (packageScope.contains(extendClass.getContainingFile().getVirtualFile())) {
|
||||
if (isClassAccepted(extendClass, classKind, instantiatable, concrete, notInterface, notEnum)) {
|
||||
ContainerUtil.addIfNotNull(createSubclassLookupValue(context, extendClass), lookups);
|
||||
result.consume(createSubclassLookupValue(extendClass, extendClassName));
|
||||
}
|
||||
}
|
||||
for (final PsiClass clazz : ClassInheritorsSearch.search(extendClass, packageScope, true)) {
|
||||
if (isClassAccepted(clazz, classKind, instantiatable, concrete, notInterface, notEnum)) {
|
||||
ContainerUtil.addIfNotNull(createSubclassLookupValue(context, clazz), lookups);
|
||||
String qname = clazz.getQualifiedName();
|
||||
if (qname != null && isClassAccepted(clazz, classKind, instantiatable, concrete, notInterface, notEnum)) {
|
||||
result.consume(createSubclassLookupValue(clazz, qname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lookups.toArray();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Object createSubclassLookupValue(@NotNull final PsiPackage context, @NotNull final PsiClass clazz) {
|
||||
final String qname = clazz.getQualifiedName();
|
||||
if (qname == null) return null;
|
||||
|
||||
String name = qname;
|
||||
final String pack = context.getQualifiedName();
|
||||
if (pack.length() > 0) {
|
||||
if (name.startsWith(pack)) {
|
||||
name = name.substring(pack.length() + 1);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return JavaLookupElementBuilder.forClass(clazz, name, true).withLookupString(qname).withLookupString(clazz.getName());
|
||||
@NotNull
|
||||
private static LookupElementBuilder createSubclassLookupValue(@NotNull final PsiClass clazz, @NotNull String qname) {
|
||||
return JavaLookupElementBuilder.forClass(clazz, qname, true).withPresentableText(StringUtil.getShortName(qname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
@@ -59,6 +59,11 @@ public class JavaClassReferenceSet {
|
||||
return myProvider;
|
||||
}
|
||||
|
||||
public TextRange getRangeInElement() {
|
||||
PsiReference[] references = getReferences();
|
||||
return new TextRange(references[0].getRangeInElement().getStartOffset(), references[references.length - 1].getRangeInElement().getEndOffset());
|
||||
}
|
||||
|
||||
private void reparse(String str, PsiElement element, final boolean isStaticImport, JavaClassReferenceSet context) {
|
||||
myElement = element;
|
||||
myContext = context;
|
||||
|
||||
@@ -59,8 +59,7 @@ public class MethodUsagesSearcher extends QueryExecutorBase<PsiReference, Method
|
||||
|
||||
final String textToSearch = method.getName();
|
||||
if (StringUtil.isEmpty(textToSearch)) {
|
||||
PsiFile file = aClass.getContainingFile();
|
||||
LOG.error("Cannot search for the method with empty name: "+method+"; class:"+aClass+"; file: "+ file+"; "+(file == null ? null : file.getVirtualFile()));
|
||||
return;
|
||||
}
|
||||
final PsiMethod[] methods = strictSignatureSearch ? new PsiMethod[]{method} : aClass.findMethodsByName(textToSearch, false);
|
||||
|
||||
|
||||
@@ -89,4 +89,5 @@ public interface CommonClassNames {
|
||||
String TARGET_ANNOTATION_FQ_NAME = "java.lang.annotation.Target";
|
||||
@NonNls String JAVA_LANG_RUNNABLE = "java.lang.Runnable";
|
||||
@NonNls String JAVA_IO_FILE = "java.io.File";
|
||||
String JAVA_LANG_ASSERTION_ERROR = "java.lang.AssertionError";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -20,8 +20,6 @@ package com.intellij.psi;
|
||||
* in a foreign language code or in a user interface element other than the main source code editor).
|
||||
*/
|
||||
public interface JavaCodeFragment extends PsiImportHolder, PsiCodeFragment {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type corresponding to the <code>this</code> keyword in the code fragment.
|
||||
*
|
||||
@@ -107,7 +105,7 @@ public interface JavaCodeFragment extends PsiImportHolder, PsiCodeFragment {
|
||||
*
|
||||
* @param declaration the referenced declaration.
|
||||
* @param place the location of the reference to the declaration.
|
||||
* @return the visibility of the declaraion.
|
||||
* @return the visibility of the declaration.
|
||||
*/
|
||||
Visibility isDeclarationVisible(PsiElement declaration, PsiElement place);
|
||||
|
||||
@@ -162,5 +160,4 @@ public interface JavaCodeFragment extends PsiImportHolder, PsiCodeFragment {
|
||||
*/
|
||||
boolean isHandledException(PsiClassType exceptionType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
|
||||
PsiModifierList list = ((PsiModifierListOwner)member).getModifierList();
|
||||
PsiAnnotation[] gluedAnnotations = list == null ? PsiAnnotation.EMPTY_ARRAY : list.getAnnotations();
|
||||
for (PsiAnnotation anno : gluedAnnotations) {
|
||||
if (PsiAnnotationImpl.isAnnotationApplicableTo(anno, false, "TYPE_USE")) {
|
||||
if (PsiAnnotationImpl.isAnnotationApplicableTo(anno, true, "TYPE_USE")) {
|
||||
typeAnnotations.add(anno);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -370,6 +370,7 @@ public class PsiReferenceExpressionImpl extends PsiReferenceExpressionBase imple
|
||||
if (resolve instanceof PsiVariable) {
|
||||
PsiType type = ((PsiVariable)resolve).getType();
|
||||
ret = type instanceof PsiEllipsisType ? ((PsiEllipsisType)type).toArrayType() : type;
|
||||
LOG.assertTrue(ret == null || ret.isValid());
|
||||
if (resolve instanceof PsiField && !((PsiField)resolve).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
owner = ((PsiField)resolve).getContainingClass();
|
||||
}
|
||||
@@ -377,6 +378,7 @@ public class PsiReferenceExpressionImpl extends PsiReferenceExpressionBase imple
|
||||
else if (resolve instanceof PsiMethod) {
|
||||
PsiMethod method = (PsiMethod)resolve;
|
||||
ret = method.getReturnType();
|
||||
LOG.assertTrue(ret == null || ret.isValid());
|
||||
owner = method;
|
||||
}
|
||||
if (ret == null) return null;
|
||||
@@ -390,7 +392,10 @@ public class PsiReferenceExpressionImpl extends PsiReferenceExpressionBase imple
|
||||
final PsiSubstitutor substitutor = result.getSubstitutor();
|
||||
if (owner == null || !PsiUtil.isRawSubstitutor(owner, substitutor)) {
|
||||
PsiType substitutedType = substitutor.substitute(ret);
|
||||
return PsiImplUtil.normalizeWildcardTypeByPosition(substitutedType, expr);
|
||||
LOG.assertTrue(substitutedType.isValid());
|
||||
PsiType normalized = PsiImplUtil.normalizeWildcardTypeByPosition(substitutedType, expr);
|
||||
LOG.assertTrue(normalized.isValid());
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.jps.model.JpsDummyElement;
|
||||
import org.jetbrains.jps.model.JpsProject;
|
||||
import org.jetbrains.jps.model.JpsSimpleElement;
|
||||
import org.jetbrains.jps.model.java.*;
|
||||
import org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile;
|
||||
import org.jetbrains.jps.model.library.JpsOrderRootType;
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdk;
|
||||
import org.jetbrains.jps.model.module.JpsDependencyElement;
|
||||
@@ -25,7 +26,6 @@ import java.util.*;
|
||||
* Date: 9/30/11
|
||||
*/
|
||||
public class ProjectPaths {
|
||||
private static final String DEFAULT_GENERATED_DIR_NAME = "generated";
|
||||
@NotNull
|
||||
private final JpsProject myProject;
|
||||
//private final Map<JpsJavaClasspathKind, Map<ModuleChunk, List<String>>> myCachedClasspath = new HashMap<JpsJavaClasspathKind, Map<ModuleChunk, List<String>>>();
|
||||
@@ -148,8 +148,9 @@ public class ProjectPaths {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public File getAnnotationProcessorGeneratedSourcesOutputDir(JpsModule module, final boolean forTests, String sourceDirName) {
|
||||
if (!StringUtil.isEmpty(sourceDirName)) {
|
||||
public File getAnnotationProcessorGeneratedSourcesOutputDir(JpsModule module, final boolean forTests, ProcessorConfigProfile profile) {
|
||||
final String sourceDirName = profile.getGeneratedSourcesDirectoryName(forTests);
|
||||
if (profile.isOutputRelativeToContentRoot()) {
|
||||
List<String> roots = module.getContentRootsList().getUrls();
|
||||
if (roots.isEmpty()) {
|
||||
return null;
|
||||
@@ -163,18 +164,15 @@ public class ProjectPaths {
|
||||
}
|
||||
});
|
||||
}
|
||||
return new File(JpsPathUtil.urlToFile(roots.get(0)), sourceDirName);
|
||||
final File parent = JpsPathUtil.urlToFile(roots.get(0));
|
||||
return StringUtil.isEmpty(sourceDirName)? parent : new File(parent, sourceDirName);
|
||||
}
|
||||
|
||||
final File outputDir = getModuleOutputDir(module, forTests);
|
||||
if (outputDir == null) {
|
||||
return null;
|
||||
}
|
||||
final File parentFile = outputDir.getParentFile();
|
||||
if (parentFile == null) {
|
||||
return null;
|
||||
}
|
||||
return new File(parentFile, outputDir.getName() + "_" + DEFAULT_GENERATED_DIR_NAME);
|
||||
return StringUtil.isEmpty(sourceDirName)? outputDir : new File(outputDir, sourceDirName);
|
||||
}
|
||||
|
||||
private enum ClasspathPart {WHOLE, BEFORE_JDK, AFTER_JDK}
|
||||
|
||||
@@ -368,9 +368,7 @@ public class IncProjectBuilder {
|
||||
for (ModuleBuildTarget target : projectDescriptor.getBuildTargetIndex().getAllTargets(type)) {
|
||||
final ProcessorConfigProfile profile = context.getAnnotationProcessingProfile(target.getModule());
|
||||
if (profile.isEnabled()) {
|
||||
final File annotationOut = paths.getAnnotationProcessorGeneratedSourcesOutputDir(
|
||||
target.getModule(), target.isTests(), profile.getGeneratedSourcesDirectoryName(target.isTests())
|
||||
);
|
||||
final File annotationOut = paths.getAnnotationProcessorGeneratedSourcesOutputDir(target.getModule(), target.isTests(), profile);
|
||||
if (annotationOut != null) {
|
||||
annotationOutputs.add(annotationOut);
|
||||
}
|
||||
|
||||
@@ -751,9 +751,8 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
options.add("-A" + optionEntry.getKey() + "=" + optionEntry.getValue());
|
||||
}
|
||||
|
||||
final boolean forTests = chunk.containsTests();
|
||||
final File srcOutput = context.getProjectPaths().getAnnotationProcessorGeneratedSourcesOutputDir(
|
||||
chunk.getModules().iterator().next(), forTests, profile.getGeneratedSourcesDirectoryName(forTests)
|
||||
chunk.getModules().iterator().next(), chunk.containsTests(), profile
|
||||
);
|
||||
if (srcOutput != null) {
|
||||
srcOutput.mkdirs();
|
||||
|
||||
@@ -8,6 +8,8 @@ import org.jetbrains.jps.model.module.JpsModule;
|
||||
import org.jetbrains.jps.model.module.JpsModuleType;
|
||||
import org.jetbrains.jps.model.module.JpsSdkReferencesTable;
|
||||
import org.jetbrains.jps.model.module.JpsTypedModule;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,4 +40,12 @@ public interface JpsProject extends JpsCompositeElement, JpsReferenceableElement
|
||||
|
||||
@NotNull
|
||||
JpsSdkReferencesTable getSdkReferencesTable();
|
||||
|
||||
@NotNull
|
||||
<P extends JpsElement>
|
||||
Iterable<JpsTypedRunConfiguration<P>> getRunConfigurations(JpsRunConfigurationType<P> type);
|
||||
|
||||
@NotNull
|
||||
<P extends JpsElement>
|
||||
JpsTypedRunConfiguration<P> addRunConfiguration(@NotNull String name, @NotNull JpsRunConfigurationType<P> type, @NotNull P properties);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import org.jetbrains.jps.model.JpsDummyElement;
|
||||
import org.jetbrains.jps.model.JpsGlobal;
|
||||
import org.jetbrains.jps.model.JpsProject;
|
||||
import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationProperties;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationState;
|
||||
import org.jetbrains.jps.model.library.JpsTypedLibrary;
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdk;
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;
|
||||
@@ -95,4 +97,7 @@ public abstract class JpsJavaExtensionService {
|
||||
@NotNull
|
||||
public abstract JpsSdkReference<JpsDummyElement> createWrappedJavaSdkReference(@NotNull JpsJavaSdkTypeWrapper sdkType,
|
||||
@NotNull JpsSdkReference<?> wrapperReference);
|
||||
|
||||
@NotNull
|
||||
public abstract JpsApplicationRunConfigurationProperties createRunConfigurationProperties(JpsApplicationRunConfigurationState state);
|
||||
}
|
||||
|
||||
+3
-2
@@ -16,7 +16,6 @@
|
||||
package org.jetbrains.jps.model.java.compiler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -31,9 +30,11 @@ public interface AnnotationProcessingConfiguration {
|
||||
@NotNull
|
||||
String getProcessorPath();
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
String getGeneratedSourcesDirectoryName(boolean forTests);
|
||||
|
||||
boolean isOutputRelativeToContentRoot();
|
||||
|
||||
@NotNull
|
||||
Set<String> getProcessors();
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ import java.util.Set;
|
||||
* @author nik
|
||||
*/
|
||||
public interface ProcessorConfigProfile extends AnnotationProcessingConfiguration {
|
||||
String DEFAULT_PRODUCTION_DIR_NAME = "generated";
|
||||
String DEFAULT_TESTS_DIR_NAME = "generated_tests";
|
||||
|
||||
void initFrom(ProcessorConfigProfile other);
|
||||
|
||||
String getName();
|
||||
@@ -49,4 +52,6 @@ public interface ProcessorConfigProfile extends AnnotationProcessingConfiguratio
|
||||
String getOption(String key);
|
||||
|
||||
void clearProcessorOptions();
|
||||
|
||||
void setOutputRelativeToContentRoot(boolean outputRelativeToContentRoot);
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package org.jetbrains.jps.model.java.runConfiguration;
|
||||
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public interface JpsApplicationRunConfigurationProperties extends JpsElement {
|
||||
String getMainClass();
|
||||
void setMainClass(String value);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package org.jetbrains.jps.model.java.runConfiguration;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsApplicationRunConfigurationState {
|
||||
public String MAIN_CLASS_NAME;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package org.jetbrains.jps.model.java.runConfiguration;
|
||||
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsApplicationRunConfigurationType extends JpsRunConfigurationType<JpsApplicationRunConfigurationProperties> {
|
||||
public static final JpsApplicationRunConfigurationType INSTANCE = new JpsApplicationRunConfigurationType();
|
||||
|
||||
private JpsApplicationRunConfigurationType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.jetbrains.jps.model.runConfiguration;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.JpsCompositeElement;
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
import org.jetbrains.jps.model.JpsNamedElement;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public interface JpsRunConfiguration extends JpsNamedElement, JpsCompositeElement {
|
||||
@NotNull
|
||||
JpsElement getProperties();
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package org.jetbrains.jps.model.runConfiguration;
|
||||
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
import org.jetbrains.jps.model.JpsElementType;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class JpsRunConfigurationType<P extends JpsElement> extends JpsElementType<P> {
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jetbrains.jps.model.runConfiguration;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
import org.jetbrains.jps.model.JpsTypedElement;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public interface JpsTypedRunConfiguration<P extends JpsElement> extends JpsRunConfiguration, JpsTypedElement<P> {
|
||||
@NotNull
|
||||
@Override
|
||||
P getProperties();
|
||||
|
||||
@Override
|
||||
JpsRunConfigurationType<P> getType();
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.*;
|
||||
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
|
||||
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
|
||||
import org.jetbrains.jps.model.impl.runConfiguration.JpsRunConfigurationImpl;
|
||||
import org.jetbrains.jps.model.library.JpsLibrary;
|
||||
import org.jetbrains.jps.model.library.JpsLibraryCollection;
|
||||
import org.jetbrains.jps.model.library.JpsLibraryType;
|
||||
@@ -16,6 +17,9 @@ import org.jetbrains.jps.model.module.JpsTypedModule;
|
||||
import org.jetbrains.jps.model.module.impl.JpsModuleImpl;
|
||||
import org.jetbrains.jps.model.module.impl.JpsModuleRole;
|
||||
import org.jetbrains.jps.model.module.impl.JpsSdkReferencesTableImpl;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsRunConfiguration;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,6 +29,7 @@ import java.util.List;
|
||||
public class JpsProjectImpl extends JpsRootElementBase<JpsProjectImpl> implements JpsProject {
|
||||
private static final JpsElementCollectionRole<JpsElementReference<?>> EXTERNAL_REFERENCES_COLLECTION_ROLE =
|
||||
JpsElementCollectionRole.create(JpsElementChildRoleBase.<JpsElementReference<?>>create("external reference"));
|
||||
private static final JpsElementCollectionRole<JpsRunConfiguration> RUN_CONFIGURATIONS_ROLE = JpsElementCollectionRole.create(JpsElementChildRoleBase.<JpsRunConfiguration>create("run configuration"));
|
||||
private final JpsLibraryCollection myLibraryCollection;
|
||||
|
||||
public JpsProjectImpl(JpsModel model, JpsEventDispatcher eventDispatcher) {
|
||||
@@ -32,6 +37,7 @@ public class JpsProjectImpl extends JpsRootElementBase<JpsProjectImpl> implement
|
||||
myContainer.setChild(JpsModuleRole.MODULE_COLLECTION_ROLE);
|
||||
myContainer.setChild(EXTERNAL_REFERENCES_COLLECTION_ROLE);
|
||||
myContainer.setChild(JpsSdkReferencesTableImpl.ROLE);
|
||||
myContainer.setChild(RUN_CONFIGURATIONS_ROLE);
|
||||
myLibraryCollection = new JpsLibraryCollectionImpl(myContainer.setChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
|
||||
}
|
||||
|
||||
@@ -89,6 +95,24 @@ public class JpsProjectImpl extends JpsRootElementBase<JpsProjectImpl> implement
|
||||
return myContainer.getChild(JpsSdkReferencesTableImpl.ROLE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <P extends JpsElement> Iterable<JpsTypedRunConfiguration<P>> getRunConfigurations(JpsRunConfigurationType<P> type) {
|
||||
return getRunConfigurationsCollection().getElementsOfType(type);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <P extends JpsElement> JpsTypedRunConfiguration<P> addRunConfiguration(@NotNull String name,
|
||||
@NotNull JpsRunConfigurationType<P> type,
|
||||
@NotNull P properties) {
|
||||
return getRunConfigurationsCollection().addChild(new JpsRunConfigurationImpl<P>(name, type, properties));
|
||||
}
|
||||
|
||||
private JpsElementCollection<JpsRunConfiguration> getRunConfigurationsCollection() {
|
||||
return myContainer.getChild(RUN_CONFIGURATIONS_ROLE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JpsElementReference<JpsProject> createReference() {
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package org.jetbrains.jps.model.impl.runConfiguration;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
import org.jetbrains.jps.model.ex.JpsNamedCompositeElementBase;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsRunConfigurationImpl<P extends JpsElement> extends JpsNamedCompositeElementBase<JpsRunConfigurationImpl<P>> implements
|
||||
JpsTypedRunConfiguration<P> {
|
||||
private final JpsRunConfigurationType<P> myType;
|
||||
|
||||
public JpsRunConfigurationImpl(@NotNull String name, JpsRunConfigurationType<P> type, P properties) {
|
||||
super(name);
|
||||
myType = type;
|
||||
myContainer.setChild(myType.getPropertiesRole(), properties);
|
||||
}
|
||||
|
||||
private JpsRunConfigurationImpl(JpsRunConfigurationImpl<P> original) {
|
||||
super(original);
|
||||
myType = original.myType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JpsRunConfigurationImpl<P> createCopy() {
|
||||
return new JpsRunConfigurationImpl<P>(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public P getProperties() {
|
||||
return myContainer.getChild(myType.getPropertiesRole());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpsRunConfigurationType<P> getType() {
|
||||
return myType;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package org.jetbrains.jps.model.java.impl;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.java.impl.runConfiguration.JpsApplicationRunConfigurationPropertiesImpl;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationProperties;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationState;
|
||||
import org.jetbrains.jps.util.JpsPathUtil;
|
||||
import org.jetbrains.jps.model.JpsDummyElement;
|
||||
import org.jetbrains.jps.model.JpsGlobal;
|
||||
@@ -152,6 +155,12 @@ public class JpsJavaExtensionServiceImpl extends JpsJavaExtensionService {
|
||||
return new JpsWrappedJavaSdkReferenceImpl(sdkType, wrapperReference);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JpsApplicationRunConfigurationProperties createRunConfigurationProperties(JpsApplicationRunConfigurationState state) {
|
||||
return new JpsApplicationRunConfigurationPropertiesImpl(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JpsProductionModuleOutputPackagingElement createProductionModuleOutput(@NotNull JpsModuleReference moduleReference) {
|
||||
|
||||
+21
-6
@@ -26,15 +26,17 @@ import java.util.*;
|
||||
* Date: 5/25/12
|
||||
*/
|
||||
public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile {
|
||||
|
||||
private String myName = "";
|
||||
private boolean myEnabled = false;
|
||||
private boolean myObtainProcessorsFromClasspath = true;
|
||||
private String myProcessorPath = "";
|
||||
private final Set<String> myProcessors = new HashSet<String>(); // empty list means all discovered
|
||||
private final Map<String, String> myProcessorOptions = new HashMap<String, String>(); // key=value map of options
|
||||
@Nullable
|
||||
private String myGeneratedProductionDirectoryName = null; // null means 'auto'
|
||||
private String myGeneratedTestsDirectoryName = null; // null means 'auto'
|
||||
private String myGeneratedProductionDirectoryName = DEFAULT_PRODUCTION_DIR_NAME;
|
||||
private String myGeneratedTestsDirectoryName = DEFAULT_TESTS_DIR_NAME;
|
||||
private boolean myOutputRelativeToContentRoot = false;
|
||||
|
||||
private final Set<String> myModuleNames = new HashSet<String>();
|
||||
|
||||
public ProcessorConfigProfileImpl(String name) {
|
||||
@@ -57,6 +59,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile
|
||||
myProcessorOptions.putAll(other.getProcessorOptions());
|
||||
myGeneratedProductionDirectoryName = other.getGeneratedSourcesDirectoryName(false);
|
||||
myGeneratedTestsDirectoryName = other.getGeneratedSourcesDirectoryName(true);
|
||||
myOutputRelativeToContentRoot = other.isOutputRelativeToContentRoot();
|
||||
myModuleNames.clear();
|
||||
myModuleNames.addAll(other.getModuleNames());
|
||||
}
|
||||
@@ -103,7 +106,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@NotNull
|
||||
public String getGeneratedSourcesDirectoryName(boolean forTests) {
|
||||
return forTests? myGeneratedTestsDirectoryName : myGeneratedProductionDirectoryName;
|
||||
}
|
||||
@@ -111,13 +114,23 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile
|
||||
@Override
|
||||
public void setGeneratedSourcesDirectoryName(@Nullable String name, boolean forTests) {
|
||||
if (forTests) {
|
||||
myGeneratedTestsDirectoryName = name;
|
||||
myGeneratedTestsDirectoryName = name != null? name.trim() : DEFAULT_TESTS_DIR_NAME;
|
||||
}
|
||||
else {
|
||||
myGeneratedProductionDirectoryName = name;
|
||||
myGeneratedProductionDirectoryName = name != null? name.trim() : DEFAULT_PRODUCTION_DIR_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOutputRelativeToContentRoot() {
|
||||
return myOutputRelativeToContentRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputRelativeToContentRoot(boolean relativeToContent) {
|
||||
myOutputRelativeToContentRoot = relativeToContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<String> getModuleNames() {
|
||||
@@ -211,6 +224,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile
|
||||
: profile.myGeneratedTestsDirectoryName != null) {
|
||||
return false;
|
||||
}
|
||||
if (myOutputRelativeToContentRoot != profile.myOutputRelativeToContentRoot)return false;
|
||||
if (!myModuleNames.equals(profile.myModuleNames)) return false;
|
||||
if (!myProcessorOptions.equals(profile.myProcessorOptions)) return false;
|
||||
if (myProcessorPath != null ? !myProcessorPath.equals(profile.myProcessorPath) : profile.myProcessorPath != null) return false;
|
||||
@@ -230,6 +244,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile
|
||||
result = 31 * result + myProcessorOptions.hashCode();
|
||||
result = 31 * result + (myGeneratedProductionDirectoryName != null ? myGeneratedProductionDirectoryName.hashCode() : 0);
|
||||
result = 31 * result + (myGeneratedTestsDirectoryName != null ? myGeneratedTestsDirectoryName.hashCode() : 0);
|
||||
result = 31 * result + (myOutputRelativeToContentRoot ? 1 : 0);
|
||||
result = 31 * result + myModuleNames.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package org.jetbrains.jps.model.java.impl.runConfiguration;
|
||||
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.ex.JpsElementBase;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationProperties;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationState;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsApplicationRunConfigurationPropertiesImpl extends JpsElementBase<JpsApplicationRunConfigurationPropertiesImpl> implements JpsApplicationRunConfigurationProperties {
|
||||
private JpsApplicationRunConfigurationState myState;
|
||||
|
||||
public JpsApplicationRunConfigurationPropertiesImpl(JpsApplicationRunConfigurationState state) {
|
||||
myState = state;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JpsApplicationRunConfigurationPropertiesImpl createCopy() {
|
||||
return new JpsApplicationRunConfigurationPropertiesImpl(XmlSerializerUtil.createCopy(myState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyChanges(@NotNull JpsApplicationRunConfigurationPropertiesImpl modified) {
|
||||
XmlSerializerUtil.copyBean(modified.myState, myState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMainClass() {
|
||||
return myState.MAIN_CLASS_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainClass(String value) {
|
||||
myState.MAIN_CLASS_NAME = value;
|
||||
}
|
||||
}
|
||||
+6
@@ -15,6 +15,7 @@ import org.jetbrains.jps.model.serialization.library.JpsLibraryRootTypeSerialize
|
||||
import org.jetbrains.jps.model.serialization.library.JpsSdkPropertiesSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleClasspathSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModulePropertiesSerializer;
|
||||
import org.jetbrains.jps.model.serialization.runConfigurations.JpsRunConfigurationPropertiesSerializer;
|
||||
import org.jetbrains.jps.service.JpsServiceManager;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -106,4 +107,9 @@ public abstract class JpsModelSerializerExtension {
|
||||
public JpsModuleClasspathSerializer getClasspathSerializer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<? extends JpsRunConfigurationPropertiesSerializer<?>> getRunConfigurationPropertiesSerializers() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
+27
-2
@@ -21,6 +21,7 @@ import org.jetbrains.jps.model.serialization.library.JpsSdkTableSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleClasspathSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModulePropertiesSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleRootModelSerializer;
|
||||
import org.jetbrains.jps.model.serialization.runConfigurations.JpsRunConfigurationSerializer;
|
||||
import org.jetbrains.jps.service.SharedThreadPool;
|
||||
|
||||
import java.io.File;
|
||||
@@ -88,6 +89,26 @@ public class JpsProjectLoader extends JpsLoaderBase {
|
||||
for (File artifactFile : listXmlFiles(new File(dir, "artifacts"))) {
|
||||
loadArtifacts(loadRootElement(artifactFile));
|
||||
}
|
||||
|
||||
if (hasRunConfigurationSerializers()) {
|
||||
for (File configurationFile : listXmlFiles(new File(dir, "runConfigurations"))) {
|
||||
JpsRunConfigurationSerializer.loadRunConfigurations(myProject, loadRootElement(configurationFile));
|
||||
}
|
||||
File workspaceFile = new File(dir, "workspace.xml");
|
||||
if (workspaceFile.exists()) {
|
||||
Element runManager = JDomSerializationUtil.findComponent(loadRootElement(workspaceFile), "RunManager");
|
||||
JpsRunConfigurationSerializer.loadRunConfigurations(myProject, runManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasRunConfigurationSerializers() {
|
||||
for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
|
||||
if (!extension.getRunConfigurationPropertiesSerializers().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -120,9 +141,13 @@ public class JpsProjectLoader extends JpsLoaderBase {
|
||||
loadModules(iprRoot, projectSdkType);
|
||||
loadProjectLibraries(JDomSerializationUtil.findComponent(iprRoot, "libraryTable"));
|
||||
loadArtifacts(JDomSerializationUtil.findComponent(iprRoot, "ArtifactManager"));
|
||||
if (hasRunConfigurationSerializers()) {
|
||||
JpsRunConfigurationSerializer.loadRunConfigurations(myProject, JDomSerializationUtil.findComponent(iprRoot, "ProjectRunConfigurationManager"));
|
||||
JpsRunConfigurationSerializer.loadRunConfigurations(myProject, JDomSerializationUtil.findComponent(iwsRoot, "RunManager"));
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArtifacts(Element artifactManagerComponent) {
|
||||
private void loadArtifacts(@Nullable Element artifactManagerComponent) {
|
||||
JpsArtifactSerializer.loadArtifacts(myProject, artifactManagerComponent);
|
||||
}
|
||||
|
||||
@@ -141,7 +166,7 @@ public class JpsProjectLoader extends JpsLoaderBase {
|
||||
return sdkType;
|
||||
}
|
||||
|
||||
private void loadProjectLibraries(Element libraryTableElement) {
|
||||
private void loadProjectLibraries(@Nullable Element libraryTableElement) {
|
||||
JpsLibraryTableSerializer.loadLibraries(libraryTableElement, myProject.getLibraryCollection());
|
||||
}
|
||||
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package org.jetbrains.jps.model.serialization.java;
|
||||
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationProperties;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationState;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationType;
|
||||
import org.jetbrains.jps.model.serialization.runConfigurations.JpsRunConfigurationPropertiesSerializer;
|
||||
|
||||
/**
|
||||
* Currently java run configurations aren't used in external compiler so this serializer is registered for tests only for performance reasons
|
||||
*
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsApplicationRunConfigurationSerializer extends JpsRunConfigurationPropertiesSerializer<JpsApplicationRunConfigurationProperties> {
|
||||
public JpsApplicationRunConfigurationSerializer() {
|
||||
super(JpsApplicationRunConfigurationType.INSTANCE, "Application");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpsApplicationRunConfigurationProperties loadProperties(@Nullable Element runConfigurationTag) {
|
||||
JpsApplicationRunConfigurationState properties = runConfigurationTag != null ?
|
||||
XmlSerializer.deserialize(runConfigurationTag, JpsApplicationRunConfigurationState.class) : new JpsApplicationRunConfigurationState();
|
||||
return JpsJavaExtensionService.getInstance().createRunConfigurationProperties(properties != null ? properties : new JpsApplicationRunConfigurationState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveProperties(JpsApplicationRunConfigurationProperties properties, Element runConfigurationTag) {
|
||||
}
|
||||
}
|
||||
+11
-2
@@ -50,6 +50,11 @@ public class AnnotationProcessorProfileSerializer {
|
||||
final Element srcTestOutput = element.getChild("sourceTestOutputDir");
|
||||
profile.setGeneratedSourcesDirectoryName(srcTestOutput != null ? srcTestOutput.getAttributeValue(NAME) : null, true);
|
||||
|
||||
final Element isRelativeToContentRoot = element.getChild("outputRelativeToContentRoot");
|
||||
if (isRelativeToContentRoot != null) {
|
||||
profile.setOutputRelativeToContentRoot(Boolean.parseBoolean(isRelativeToContentRoot.getAttributeValue(VALUE)));
|
||||
}
|
||||
|
||||
profile.clearProcessorOptions();
|
||||
for (Object optionElement : element.getChildren(OPTION)) {
|
||||
final Element elem = (Element)optionElement;
|
||||
@@ -98,14 +103,18 @@ public class AnnotationProcessorProfileSerializer {
|
||||
element.setAttribute(ENABLED, Boolean.toString(profile.isEnabled()));
|
||||
|
||||
final String srcDirName = profile.getGeneratedSourcesDirectoryName(false);
|
||||
if (srcDirName != null) {
|
||||
if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_PRODUCTION_DIR_NAME, srcDirName)) {
|
||||
addChild(element, "sourceOutputDir").setAttribute(NAME, srcDirName);
|
||||
}
|
||||
final String testSrcDirName = profile.getGeneratedSourcesDirectoryName(true);
|
||||
if (testSrcDirName != null) {
|
||||
if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_TESTS_DIR_NAME, testSrcDirName)) {
|
||||
addChild(element, "sourceTestOutputDir").setAttribute(NAME, testSrcDirName);
|
||||
}
|
||||
|
||||
if (profile.isOutputRelativeToContentRoot()) {
|
||||
addChild(element, "outputRelativeToContentRoot").setAttribute(VALUE, "true");
|
||||
}
|
||||
|
||||
final Map<String, String> options = profile.getProcessorOptions();
|
||||
if (!options.isEmpty()) {
|
||||
final List<String> keys = new ArrayList<String>(options.keySet());
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class JpsLibraryTableSerializer {
|
||||
private static final String PROJECT_LEVEL = "project";
|
||||
private static final String APPLICATION_LEVEL = "application";
|
||||
|
||||
public static void loadLibraries(Element libraryTableElement, JpsLibraryCollection result) {
|
||||
public static void loadLibraries(@Nullable Element libraryTableElement, JpsLibraryCollection result) {
|
||||
for (Element libraryElement : JDOMUtil.getChildren(libraryTableElement, LIBRARY_TAG)) {
|
||||
result.addLibrary(loadLibrary(libraryElement));
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package org.jetbrains.jps.model.serialization.runConfigurations;
|
||||
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
|
||||
import org.jetbrains.jps.model.serialization.JpsElementPropertiesSerializer;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class JpsRunConfigurationPropertiesSerializer<P extends JpsElement> extends JpsElementPropertiesSerializer<P, JpsRunConfigurationType<P>> {
|
||||
protected JpsRunConfigurationPropertiesSerializer(JpsRunConfigurationType<P> type, String typeId) {
|
||||
super(type, typeId);
|
||||
}
|
||||
|
||||
public abstract P loadProperties(@Nullable Element runConfigurationTag);
|
||||
|
||||
public abstract void saveProperties(P properties, Element runConfigurationTag);
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package org.jetbrains.jps.model.serialization.runConfigurations;
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.util.containers.hash.HashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
import org.jetbrains.jps.model.JpsProject;
|
||||
import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsRunConfigurationSerializer {
|
||||
public static void loadRunConfigurations(@NotNull JpsProject project, @Nullable Element runManagerTag) {
|
||||
Map<String, JpsRunConfigurationPropertiesSerializer<?>> serializers = new HashMap<String, JpsRunConfigurationPropertiesSerializer<?>>();
|
||||
for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
|
||||
for (JpsRunConfigurationPropertiesSerializer<?> serializer : extension.getRunConfigurationPropertiesSerializers()) {
|
||||
serializers.put(serializer.getTypeId(), serializer);
|
||||
}
|
||||
}
|
||||
|
||||
for (Element configurationTag : JDOMUtil.getChildren(runManagerTag, "configuration")) {
|
||||
if (Boolean.parseBoolean(configurationTag.getAttributeValue("default"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String typeId = configurationTag.getAttributeValue("type");
|
||||
JpsRunConfigurationPropertiesSerializer<?> serializer = serializers.get(typeId);
|
||||
if (serializer != null) {
|
||||
loadRunConfiguration(configurationTag, serializer, project);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <P extends JpsElement> void loadRunConfiguration(Element configurationTag,
|
||||
JpsRunConfigurationPropertiesSerializer<P> serializer,
|
||||
JpsProject project) {
|
||||
P properties = serializer.loadProperties(configurationTag);
|
||||
project.addRunConfiguration(configurationTag.getAttributeValue("name"), serializer.getType(), properties);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/run-configurations.iml" filepath="$PROJECT_DIR$/run-configurations.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
Generated
+17
@@ -0,0 +1,17 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="shared" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="xxx.Main2" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="run-configurations" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="test" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="run-configurations" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" value="test.MyTest" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunManager" selected="Application.shared">
|
||||
<configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
|
||||
<option name="VMOptions" />
|
||||
<option name="arguments" />
|
||||
<option name="filePath" />
|
||||
<option name="scope" value="ALL" />
|
||||
<option name="testName" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
|
||||
<module name="" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="CapistranoRunConfigurationType" factoryName="Capistrano">
|
||||
<module name="" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="WORK DIR" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="SHOULD_USE_SDK" VALUE="false" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="ALTERN_SDK_NAME" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="myPassParentEnvs" VALUE="true" />
|
||||
<envs />
|
||||
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
||||
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
||||
<COVERAGE_PATTERN ENABLED="true">
|
||||
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
||||
</COVERAGE_PATTERN>
|
||||
</EXTENSION>
|
||||
<CAPISTRANO_RUN_CONFIG_SETTINGS_ID NAME="CAPISTRANO_TASK_NAME" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIG_SETTINGS_ID NAME="CAPISTRANO_TASK_ARGS" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIG_SETTINGS_ID NAME="CAPISTRANO_STAGE" VALUE="" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="SUITE_NAME" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="GROUP_NAME" />
|
||||
<option name="TEST_OBJECT" value="CLASS" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="ANNOTATION_TYPE" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||
<option name="PROPERTIES_FILE" />
|
||||
<envs />
|
||||
<properties />
|
||||
<listeners />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Applet" factoryName="Applet">
|
||||
<module name="" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="HTML_FILE_NAME" />
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$IDEA_HOME$/bin/appletviewer.policy" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="FlashRunConfigurationType" factoryName="Flash App">
|
||||
<option name="BCName" value="" />
|
||||
<option name="IOSSimulatorSdkPath" value="" />
|
||||
<option name="adlOptions" value="" />
|
||||
<option name="airProgramParameters" value="" />
|
||||
<option name="appDescriptorForEmulator" value="Android" />
|
||||
<option name="debugTransport" value="USB" />
|
||||
<option name="debuggerSdkRaw" value="BC SDK" />
|
||||
<option name="emulator" value="NexusOne" />
|
||||
<option name="emulatorAdlOptions" value="" />
|
||||
<option name="fastPackaging" value="true" />
|
||||
<option name="fullScreenHeight" value="0" />
|
||||
<option name="fullScreenWidth" value="0" />
|
||||
<option name="launchUrl" value="false" />
|
||||
<option name="launcherParameters">
|
||||
<LauncherParameters>
|
||||
<option name="browserFamily" value="FIREFOX" />
|
||||
<option name="launcherType" value="OSDefault" />
|
||||
<option name="playerPath" value="/usr/bin/flashplayerdebugger" />
|
||||
</LauncherParameters>
|
||||
</option>
|
||||
<option name="mobileRunTarget" value="Emulator" />
|
||||
<option name="moduleName" value="" />
|
||||
<option name="overriddenMainClass" value="" />
|
||||
<option name="overriddenOutputFileName" value="" />
|
||||
<option name="overrideMainClass" value="false" />
|
||||
<option name="runTrusted" value="true" />
|
||||
<option name="screenDpi" value="0" />
|
||||
<option name="screenHeight" value="0" />
|
||||
<option name="screenWidth" value="0" />
|
||||
<option name="url" value="http://" />
|
||||
<option name="usbDebugPort" value="7936" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="false" name="Main" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="xxx.Main" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="run-configurations" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<list size="3">
|
||||
<item index="0" class="java.lang.String" itemvalue="Application.Main" />
|
||||
<item index="1" class="java.lang.String" itemvalue="Application.shared" />
|
||||
<item index="2" class="java.lang.String" itemvalue="JUnit.test" />
|
||||
</list>
|
||||
<configuration name="<template>" type="WebApp" default="true" selected="false">
|
||||
<Host>localhost</Host>
|
||||
<Port>5050</Port>
|
||||
</configuration>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/run-configurations.iml" filepath="$PROJECT_DIR$/run-configurations.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="shared" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="xxx.Main2" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="run-configurations" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="false" name="test" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="run-configurations" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" value="test.MyTest" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunManager" selected="JUnit.test">
|
||||
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
|
||||
<module name="" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="CapistranoRunConfigurationType" factoryName="Capistrano">
|
||||
<module name="" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="WORK DIR" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="SHOULD_USE_SDK" VALUE="false" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="ALTERN_SDK_NAME" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIGURATION NAME="myPassParentEnvs" VALUE="true" />
|
||||
<envs />
|
||||
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
||||
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
||||
<COVERAGE_PATTERN ENABLED="true">
|
||||
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
||||
</COVERAGE_PATTERN>
|
||||
</EXTENSION>
|
||||
<CAPISTRANO_RUN_CONFIG_SETTINGS_ID NAME="CAPISTRANO_TASK_NAME" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIG_SETTINGS_ID NAME="CAPISTRANO_TASK_ARGS" VALUE="" />
|
||||
<CAPISTRANO_RUN_CONFIG_SETTINGS_ID NAME="CAPISTRANO_STAGE" VALUE="" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Applet" factoryName="Applet">
|
||||
<module name="" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="HTML_FILE_NAME" />
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$IDEA_HOME$/bin/appletviewer.policy" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="SUITE_NAME" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="GROUP_NAME" />
|
||||
<option name="TEST_OBJECT" value="CLASS" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="ANNOTATION_TYPE" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||
<option name="PROPERTIES_FILE" />
|
||||
<envs />
|
||||
<properties />
|
||||
<listeners />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="FlashRunConfigurationType" factoryName="Flash App">
|
||||
<option name="BCName" value="" />
|
||||
<option name="IOSSimulatorSdkPath" value="" />
|
||||
<option name="adlOptions" value="" />
|
||||
<option name="airProgramParameters" value="" />
|
||||
<option name="appDescriptorForEmulator" value="Android" />
|
||||
<option name="debugTransport" value="USB" />
|
||||
<option name="debuggerSdkRaw" value="BC SDK" />
|
||||
<option name="emulator" value="NexusOne" />
|
||||
<option name="emulatorAdlOptions" value="" />
|
||||
<option name="fastPackaging" value="true" />
|
||||
<option name="fullScreenHeight" value="0" />
|
||||
<option name="fullScreenWidth" value="0" />
|
||||
<option name="launchUrl" value="false" />
|
||||
<option name="launcherParameters">
|
||||
<LauncherParameters>
|
||||
<option name="browserFamily" value="FIREFOX" />
|
||||
<option name="launcherType" value="OSDefault" />
|
||||
<option name="playerPath" value="/usr/bin/flashplayerdebugger" />
|
||||
</LauncherParameters>
|
||||
</option>
|
||||
<option name="mobileRunTarget" value="Emulator" />
|
||||
<option name="moduleName" value="" />
|
||||
<option name="overriddenMainClass" value="" />
|
||||
<option name="overriddenOutputFileName" value="" />
|
||||
<option name="overrideMainClass" value="false" />
|
||||
<option name="runTrusted" value="true" />
|
||||
<option name="screenDpi" value="0" />
|
||||
<option name="screenHeight" value="0" />
|
||||
<option name="screenWidth" value="0" />
|
||||
<option name="url" value="http://" />
|
||||
<option name="usbDebugPort" value="7936" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="false" name="Main" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="xxx.Main" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="run-configurations" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<list size="2">
|
||||
<item index="0" class="java.lang.String" itemvalue="Application.Main" />
|
||||
<item index="1" class="java.lang.String" itemvalue="JUnit.test" />
|
||||
</list>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jps.model.serialization.JpsTestSerializerExtension
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package org.jetbrains.jps.model.serialization;
|
||||
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationProperties;
|
||||
import org.jetbrains.jps.model.java.runConfiguration.JpsApplicationRunConfigurationType;
|
||||
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsRunConfigurationsSerializationTest extends JpsSerializationTestCase {
|
||||
public void testLoadIpr() {
|
||||
doTest("jps/model-serialization/testData/run-configurations/run-configurations.ipr");
|
||||
}
|
||||
|
||||
public void testLoadDirectoryBased() {
|
||||
doTest("jps/model-serialization/testData/run-configurations-dir");
|
||||
}
|
||||
|
||||
private void doTest(final String relativePath) {
|
||||
loadProject(relativePath);
|
||||
List<JpsTypedRunConfiguration<JpsApplicationRunConfigurationProperties>>
|
||||
configurations = ContainerUtil.newArrayList(myProject.getRunConfigurations(JpsApplicationRunConfigurationType.INSTANCE));
|
||||
assertEquals(2, configurations.size());
|
||||
|
||||
JpsTypedRunConfiguration<JpsApplicationRunConfigurationProperties> shared = configurations.get(0);
|
||||
assertEquals("shared", shared.getName());
|
||||
assertEquals("xxx.Main2", shared.getProperties().getMainClass());
|
||||
|
||||
JpsTypedRunConfiguration<JpsApplicationRunConfigurationProperties> main = configurations.get(1);
|
||||
assertEquals("Main", main.getName());
|
||||
assertEquals("xxx.Main", main.getProperties().getMainClass());
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jetbrains.jps.model.serialization;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.serialization.java.JpsApplicationRunConfigurationSerializer;
|
||||
import org.jetbrains.jps.model.serialization.runConfigurations.JpsRunConfigurationPropertiesSerializer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JpsTestSerializerExtension extends JpsModelSerializerExtension {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends JpsRunConfigurationPropertiesSerializer<?>> getRunConfigurationPropertiesSerializers() {
|
||||
return Collections.singletonList(new JpsApplicationRunConfigurationSerializer());
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -75,9 +75,7 @@ import java.util.List;
|
||||
* It's one of the item's lookup strings ({@link LookupElement#getAllLookupStrings()} that is matched against prefix matcher.<p>
|
||||
*
|
||||
* Q: How do I plug into those funny texts below the items in shown lookup?<br>
|
||||
* A: Use {@link CompletionContributor#advertise(CompletionParameters)} or
|
||||
* {@link CompletionService#setAdvertisementText(String)}. Don't forget to check whether you are in correct place
|
||||
* (see {@link CompletionParameters}).<p>
|
||||
* A: Use {@link CompletionResultSet#addLookupAdvertisement(String)} <p>
|
||||
*
|
||||
* Q: How do I change the text that gets shown when there are no suitable variants at all? <br>
|
||||
* A: Use {@link CompletionContributor#handleEmptyLookup(CompletionParameters, Editor)}.
|
||||
@@ -179,7 +177,7 @@ public abstract class CompletionContributor {
|
||||
|
||||
/**
|
||||
* @param parameters
|
||||
* @deprecated use {@link com.intellij.codeInsight.completion.CompletionService#setAdvertisementText(String)}
|
||||
* @deprecated use {@link com.intellij.codeInsight.completion.CompletionResultSet#addLookupAdvertisement(String)}
|
||||
* @return text to be shown at the bottom of lookup list
|
||||
*/
|
||||
@Nullable
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.LinkedHashSet;
|
||||
*
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class CompletionResultSet {
|
||||
public abstract class CompletionResultSet implements Consumer<LookupElement> {
|
||||
private final PrefixMatcher myPrefixMatcher;
|
||||
private final Consumer<CompletionResult> myConsumer;
|
||||
protected final CompletionService myCompletionService = CompletionService.getCompletionService();
|
||||
@@ -39,6 +39,11 @@ public abstract class CompletionResultSet {
|
||||
return myConsumer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
addElement(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* If a given element matches the prefix, give it for further processing (which may eventually result in its appearing in the completion list)
|
||||
* @param element
|
||||
@@ -66,6 +71,8 @@ public abstract class CompletionResultSet {
|
||||
@NotNull
|
||||
public abstract CompletionResultSet withRelevanceSorter(@NotNull CompletionSorter sorter);
|
||||
|
||||
public abstract void addLookupAdvertisement(@NotNull String text);
|
||||
|
||||
/**
|
||||
* @return A result set with the same prefix, but the lookup strings will be matched case-insensitively. Their lookup strings will
|
||||
* remain as they are though, so upon insertion the prefix case will be changed.
|
||||
|
||||
@@ -58,6 +58,7 @@ public abstract class CompletionService {
|
||||
/**
|
||||
* Set lookup advertisement text (at the bottom) at any time. Will do nothing if no completion process is in progress.
|
||||
* @param text
|
||||
* @deprecated use {@link CompletionResultSet#addLookupAdvertisement(String)}
|
||||
*/
|
||||
public abstract void setAdvertisementText(@Nullable String text);
|
||||
|
||||
|
||||
+1
-3
@@ -36,9 +36,7 @@ public abstract class OriginInfoProvider {
|
||||
@Nullable
|
||||
public static String getOriginInfo(@Nullable PsiElement element) {
|
||||
if (element == null) return null;
|
||||
String info = _getOriginInfo(element);
|
||||
if (info != null) info = "(" + info + ")";
|
||||
return info;
|
||||
return _getOriginInfo(element);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -69,4 +69,6 @@ public interface Lookup {
|
||||
PrefixMatcher itemMatcher(@NotNull LookupElement item);
|
||||
|
||||
boolean isSelectionTouched();
|
||||
|
||||
List<String> getAdvertisements();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public interface RunnerLayoutUi {
|
||||
Content addContent(@NotNull Content content);
|
||||
|
||||
@NotNull
|
||||
Content addContent(@NotNull Content content, int defaultTabId, PlaceInGrid defaultPlace, boolean defaultIsMinimized);
|
||||
Content addContent(@NotNull Content content, int defaultTabId, @NotNull PlaceInGrid defaultPlace, boolean defaultIsMinimized);
|
||||
|
||||
@NotNull
|
||||
Content createContent(@NotNull String contentId, @NotNull JComponent component, @NotNull String displayName, @Nullable Icon icon, @Nullable JComponent toFocus);
|
||||
@@ -60,15 +60,18 @@ public interface RunnerLayoutUi {
|
||||
@Nullable
|
||||
Content findContent(@NotNull String contentId);
|
||||
|
||||
@NotNull
|
||||
ActionCallback selectAndFocus(@Nullable Content content, boolean requestFocus, final boolean forced);
|
||||
@NotNull
|
||||
ActionCallback selectAndFocus(@Nullable Content content, boolean requestFocus, final boolean forced, final boolean implicit);
|
||||
|
||||
@NotNull
|
||||
RunnerLayoutUi addListener(@NotNull ContentManagerListener listener, @NotNull Disposable parent);
|
||||
|
||||
void removeListener(@NotNull final ContentManagerListener listener);
|
||||
|
||||
void attractBy(@NotNull String condition);
|
||||
void clearAttractionBy(final String condition);
|
||||
void clearAttractionBy(@NotNull String condition);
|
||||
|
||||
void setBouncing(@NotNull Content content, final boolean activate);
|
||||
|
||||
@@ -79,6 +82,7 @@ public interface RunnerLayoutUi {
|
||||
|
||||
void updateActionsNow();
|
||||
|
||||
@NotNull
|
||||
Content[] getContents();
|
||||
|
||||
abstract class Factory {
|
||||
@@ -89,6 +93,7 @@ public interface RunnerLayoutUi {
|
||||
return ServiceManager.getService(project, Factory.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract RunnerLayoutUi create(@NotNull String runnerId, @NotNull String runnerTitle, @NotNull String sessionName, @NotNull Disposable parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,17 @@ import com.intellij.execution.ui.layout.ViewContext;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Toggleable;
|
||||
import com.intellij.ui.content.Content;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AbstractFocusOnAction extends BaseViewAction implements Toggleable {
|
||||
@NotNull
|
||||
private final String myCondition;
|
||||
|
||||
public AbstractFocusOnAction(String condition) {
|
||||
public AbstractFocusOnAction(@NotNull String condition) {
|
||||
myCondition = condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update(final AnActionEvent e, final ViewContext context, final Content[] content) {
|
||||
final boolean visible = content.length == 1;
|
||||
e.getPresentation().setVisible(visible);
|
||||
@@ -40,6 +43,7 @@ public class AbstractFocusOnAction extends BaseViewAction implements Toggleable
|
||||
return context.getRunnerLayoutUi().getOptions().isToFocus(content[0], myCondition);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final AnActionEvent e, final ViewContext context, final Content[] content) {
|
||||
final boolean toFocus = isToFocus(context, content);
|
||||
context.getRunnerLayoutUi().getOptions().setToFocus(toFocus ? null : content[0], myCondition);
|
||||
|
||||
@@ -22,11 +22,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
|
||||
public interface LayoutStateDefaults {
|
||||
|
||||
@NotNull //this
|
||||
LayoutStateDefaults initTabDefaults(int tabId, @Nullable String defaultTabText, @Nullable Icon defaultTabIcon);
|
||||
|
||||
LayoutStateDefaults initFocusContent(@NotNull String id, final String condition);
|
||||
|
||||
LayoutStateDefaults initFocusContent(@NotNull String id, final String condition, @NotNull final LayoutAttractionPolicy policy);
|
||||
@NotNull // this
|
||||
LayoutStateDefaults initFocusContent(@NotNull String id, @NotNull String condition);
|
||||
|
||||
@NotNull //this
|
||||
LayoutStateDefaults initFocusContent(@NotNull String id, @NotNull String condition, @NotNull final LayoutAttractionPolicy policy);
|
||||
}
|
||||
@@ -29,6 +29,7 @@ public interface LayoutViewOptions {
|
||||
@NotNull
|
||||
LayoutViewOptions setTopToolbar(@NotNull ActionGroup actions, @NotNull String place);
|
||||
|
||||
@NotNull
|
||||
LayoutViewOptions setLeftToolbar(@NotNull ActionGroup leftToolbar, @NotNull String place);
|
||||
|
||||
@NotNull
|
||||
@@ -39,17 +40,23 @@ public interface LayoutViewOptions {
|
||||
|
||||
@NotNull
|
||||
LayoutViewOptions setAttractionPolicy(@NotNull String contentId, LayoutAttractionPolicy policy);
|
||||
|
||||
@NotNull
|
||||
LayoutViewOptions setConditionAttractionPolicy(@NotNull String condition, LayoutAttractionPolicy policy);
|
||||
|
||||
boolean isToFocus(Content content, final String condition);
|
||||
boolean isToFocus(@NotNull Content content, @NotNull String condition);
|
||||
|
||||
LayoutViewOptions setToFocus(@Nullable Content content, final String condition);
|
||||
@NotNull
|
||||
LayoutViewOptions setToFocus(@Nullable Content content, @NotNull String condition);
|
||||
|
||||
AnAction getLayoutActions();
|
||||
@NotNull
|
||||
AnAction[] getLayoutActionsList();
|
||||
|
||||
LayoutViewOptions setAdditionalFocusActions(ActionGroup group);
|
||||
@NotNull
|
||||
LayoutViewOptions setAdditionalFocusActions(@NotNull ActionGroup group);
|
||||
|
||||
AnAction getSettingsActions();
|
||||
@NotNull
|
||||
AnAction[] getSettingsActionsList();
|
||||
}
|
||||
@@ -22,10 +22,9 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Interface that should be implemented by the language in order to provide inline functionality and possibly
|
||||
* participate in inline of elements in other languages this language may reference.
|
||||
@@ -60,19 +59,19 @@ public interface InlineHandler {
|
||||
* @return <code>Settings</code> object in case refactoring should be performed or null otherwise
|
||||
|
||||
*/
|
||||
@Nullable Settings prepareInlineElement(PsiElement element, Editor editor, boolean invokedOnReference);
|
||||
@Nullable Settings prepareInlineElement(@NotNull PsiElement element, @Nullable Editor editor, boolean invokedOnReference);
|
||||
|
||||
/**
|
||||
* @param element inlined element
|
||||
*/
|
||||
void removeDefinition(PsiElement element, Settings settings);
|
||||
void removeDefinition(@NotNull PsiElement element, @NotNull Settings settings);
|
||||
|
||||
/**
|
||||
* @param element inlined element
|
||||
* @param settings
|
||||
* @return Inliner instance to be used for inlining references in this language
|
||||
*/
|
||||
@Nullable Inliner createInliner(PsiElement element, Settings settings);
|
||||
@Nullable Inliner createInliner(@NotNull PsiElement element, @NotNull Settings settings);
|
||||
|
||||
interface Inliner {
|
||||
/**
|
||||
@@ -82,13 +81,13 @@ public interface InlineHandler {
|
||||
* or null if no conflicts detected.
|
||||
*/
|
||||
@Nullable
|
||||
MultiMap<PsiElement, String> getConflicts(PsiReference reference, PsiElement referenced);
|
||||
MultiMap<PsiElement, String> getConflicts(@NotNull PsiReference reference, @NotNull PsiElement referenced);
|
||||
|
||||
/**
|
||||
* Perform actual inline of element to the point where it is referenced
|
||||
* @param usage usage of inlined element
|
||||
* @param referenced inlined element
|
||||
*/
|
||||
void inlineUsage(UsageInfo usage, PsiElement referenced);
|
||||
void inlineUsage(@NotNull UsageInfo usage, @NotNull PsiElement referenced);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
@@ -37,7 +37,6 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class FontOptions extends JPanel implements OptionsPanel{
|
||||
@@ -48,8 +47,8 @@ public class FontOptions extends JPanel implements OptionsPanel{
|
||||
private JTextField myLineSpacingField;
|
||||
private JTextField myFontNameField;
|
||||
|
||||
private static ArrayList<String> myFontNamesVector;
|
||||
private static HashMap<String, Boolean> myFontNameToIsMonospaced;
|
||||
private static ArrayList<String> myFontNames;
|
||||
private static ArrayList<String> myMonospacedFontNames;
|
||||
private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
|
||||
private boolean myIsInSchemeChange = false;
|
||||
private String myTitle;
|
||||
@@ -114,13 +113,13 @@ public class FontOptions extends JPanel implements OptionsPanel{
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Runnable showOption(final String option) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyChangesToScheme() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,16 +240,16 @@ public class FontOptions extends JPanel implements OptionsPanel{
|
||||
private void selectFont() {
|
||||
initFontTables();
|
||||
|
||||
List<String> fontNamesVector = (List<String>)myFontNamesVector.clone();
|
||||
HashMap fontNameToIsMonospaced = (HashMap)myFontNameToIsMonospaced.clone();
|
||||
ArrayList<String> fontNames = new ArrayList<String>(myFontNames);
|
||||
ArrayList<String> monospacedFontNames = new ArrayList<String>(myMonospacedFontNames);
|
||||
String initialFontName = myFontNameField.getText();
|
||||
if (!fontNamesVector.contains(EditorSettingsExternalizable.DEFAULT_FONT_NAME)) {
|
||||
fontNamesVector.add(0, EditorSettingsExternalizable.DEFAULT_FONT_NAME);
|
||||
if (!fontNames.contains(EditorSettingsExternalizable.DEFAULT_FONT_NAME)) {
|
||||
fontNames.add(0, EditorSettingsExternalizable.DEFAULT_FONT_NAME);
|
||||
}
|
||||
if (!fontNamesVector.contains(initialFontName)) {
|
||||
fontNamesVector.add(0, initialFontName);
|
||||
if (!fontNames.contains(initialFontName)) {
|
||||
fontNames.add(0, initialFontName);
|
||||
}
|
||||
SelectFontDialog selectFontDialog = new SelectFontDialog(this, fontNamesVector, initialFontName, fontNameToIsMonospaced);
|
||||
SelectFontDialog selectFontDialog = new SelectFontDialog(this, fontNames, initialFontName, monospacedFontNames);
|
||||
selectFontDialog.show();
|
||||
if (!selectFontDialog.isOK()) {
|
||||
return;
|
||||
@@ -265,9 +264,9 @@ public class FontOptions extends JPanel implements OptionsPanel{
|
||||
|
||||
@SuppressWarnings({"AssignmentToStaticFieldFromInstanceMethod"})
|
||||
private void initFontTables() {
|
||||
if (myFontNamesVector == null) {
|
||||
myFontNamesVector = new ArrayList<String>();
|
||||
myFontNameToIsMonospaced = new HashMap<String, Boolean>();
|
||||
if (myFontNames == null) {
|
||||
myFontNames = new ArrayList<String>();
|
||||
myMonospacedFontNames = new ArrayList<String>();
|
||||
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously(new InitFontsRunnable(), ApplicationBundle.message("progress.analyzing.fonts"), false, null);
|
||||
}
|
||||
@@ -326,15 +325,25 @@ public class FontOptions extends JPanel implements OptionsPanel{
|
||||
}
|
||||
FontMetrics plainMetrics = getFontMetrics(plainFont);
|
||||
FontMetrics boldMetrics = getFontMetrics(boldFont);
|
||||
myFontNamesVector.add(fontName);
|
||||
if (plainMetrics.getDescent() < 0 ||
|
||||
boldMetrics.getDescent() < 0 ||
|
||||
plainMetrics.getAscent() < 0 ||
|
||||
boldMetrics.getAscent() < 0) {
|
||||
continue;
|
||||
}
|
||||
int plainL = plainMetrics.charWidth('l');
|
||||
int boldL = boldMetrics.charWidth('l');
|
||||
int plainW = plainMetrics.charWidth('W');
|
||||
int boldW = boldMetrics.charWidth('W');
|
||||
int plainSpace = plainMetrics.charWidth(' ');
|
||||
int boldSpace = boldMetrics.charWidth(' ');
|
||||
boolean isMonospaced = plainL == plainW && plainL == boldL && plainW == boldW && plainSpace == boldSpace;
|
||||
myFontNameToIsMonospaced.put(fontName, isMonospaced);
|
||||
if (plainL <= 0 || boldL <= 0 || plainW <= 0 || boldW <= 0 || plainSpace <= 0 || boldSpace <= 0) {
|
||||
continue;
|
||||
}
|
||||
myFontNames.add(fontName);
|
||||
if (plainL == plainW && plainL == boldL && plainW == boldW && plainSpace == boldSpace) {
|
||||
myMonospacedFontNames.add(fontName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
|
||||
+2
-3
@@ -71,7 +71,7 @@ public class FilePathCompletionContributor extends CompletionContributor {
|
||||
if (getReference(psiReference) != null && parameters.getInvocationCount() == 1) {
|
||||
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
|
||||
if (shortcut != null) {
|
||||
CompletionService.getCompletionService().setAdvertisementText(CodeInsightBundle.message("class.completion.file.path", shortcut));
|
||||
result.addLookupAdvertisement(CodeInsightBundle.message("class.completion.file.path", shortcut));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,8 +155,7 @@ public class FilePathCompletionContributor extends CompletionContributor {
|
||||
if (set.getSuitableFileTypes().length > 0 && parameters.getInvocationCount() == 1) {
|
||||
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
|
||||
if (shortcut != null) {
|
||||
CompletionService.getCompletionService()
|
||||
.setAdvertisementText(CodeInsightBundle.message("class.completion.file.path.all.variants", shortcut));
|
||||
result.addLookupAdvertisement(CodeInsightBundle.message("class.completion.file.path.all.variants", shortcut));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-35
@@ -18,16 +18,12 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.paths.PsiDynaReference;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.patterns.PlatformPatterns;
|
||||
import com.intellij.patterns.PsiElementPattern;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.ReferenceRange;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference;
|
||||
import com.intellij.util.PairConsumer;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -37,43 +33,34 @@ import java.util.Set;
|
||||
* @author peter
|
||||
*/
|
||||
public class LegacyCompletionContributor extends CompletionContributor {
|
||||
public static boolean DEBUG = false;
|
||||
|
||||
public LegacyCompletionContributor() {
|
||||
final PsiElementPattern.Capture<PsiElement> everywhere = PlatformPatterns.psiElement();
|
||||
extend(CompletionType.BASIC, everywhere, new CompletionProvider<CompletionParameters>() {
|
||||
@Override
|
||||
public void addCompletions(@NotNull final CompletionParameters parameters,
|
||||
final ProcessingContext matchingContext,
|
||||
@NotNull final CompletionResultSet _result) {
|
||||
final PsiFile file = parameters.getOriginalFile();
|
||||
final int startOffset = parameters.getOffset();
|
||||
final PsiElement insertedElement = parameters.getPosition();
|
||||
CompletionData completionData = CompletionUtil.getCompletionDataByElement(insertedElement, file);
|
||||
if (completionData == null) return;
|
||||
@Override
|
||||
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet _result) {
|
||||
if (parameters.getCompletionType() != CompletionType.BASIC) {
|
||||
return;
|
||||
}
|
||||
CompletionData completionData = getCompletionData(parameters);
|
||||
if (completionData == null) return;
|
||||
|
||||
final CompletionResultSet result = _result.withPrefixMatcher(completionData.findPrefix(insertedElement, startOffset));
|
||||
|
||||
|
||||
completeReference(parameters, result, completionData);
|
||||
|
||||
final Set<LookupElement> lookupSet = new LinkedHashSet<LookupElement>();
|
||||
final Set<CompletionVariant> keywordVariants = new HashSet<CompletionVariant>();
|
||||
completionData.addKeywordVariants(keywordVariants, insertedElement, parameters.getOriginalFile());
|
||||
completionData
|
||||
.completeKeywordsBySet(lookupSet, keywordVariants, insertedElement, result.getPrefixMatcher(), file);
|
||||
for (final LookupElement item : lookupSet) {
|
||||
result.addElement(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
final PsiElement insertedElement = parameters.getPosition();
|
||||
final CompletionResultSet result = _result.withPrefixMatcher(completionData.findPrefix(insertedElement, parameters.getOffset()));
|
||||
|
||||
completeReference(parameters, result);
|
||||
|
||||
final Set<LookupElement> lookupSet = new LinkedHashSet<LookupElement>();
|
||||
final Set<CompletionVariant> keywordVariants = new HashSet<CompletionVariant>();
|
||||
PsiFile file = parameters.getOriginalFile();
|
||||
completionData.addKeywordVariants(keywordVariants, insertedElement, file);
|
||||
completionData.completeKeywordsBySet(lookupSet, keywordVariants, insertedElement, result.getPrefixMatcher(), file);
|
||||
result.addAllElements(lookupSet);
|
||||
}
|
||||
|
||||
public static boolean completeReference(final CompletionParameters parameters,
|
||||
final CompletionResultSet result,
|
||||
final CompletionData completionData) {
|
||||
public static boolean completeReference(final CompletionParameters parameters, final CompletionResultSet result) {
|
||||
final CompletionData completionData = getCompletionData(parameters);
|
||||
if (completionData == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Ref<Boolean> hasVariants = Ref.create(false);
|
||||
processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() {
|
||||
@Override
|
||||
@@ -92,6 +79,11 @@ public class LegacyCompletionContributor extends CompletionContributor {
|
||||
return hasVariants.get().booleanValue();
|
||||
}
|
||||
|
||||
private static CompletionData getCompletionData(CompletionParameters parameters) {
|
||||
final PsiElement position = parameters.getPosition();
|
||||
return CompletionUtil.getCompletionDataByElement(position, parameters.getOriginalFile());
|
||||
}
|
||||
|
||||
public static void processReferences(final CompletionParameters parameters,
|
||||
final CompletionResultSet result,
|
||||
final PairConsumer<PsiReference, CompletionResultSet> consumer) {
|
||||
|
||||
+5
@@ -160,6 +160,11 @@ public class CompletionServiceImpl extends CompletionService{
|
||||
return new CompletionResultSetImpl(getConsumer(), myTextBeforePosition, getPrefixMatcher(), myContributor, myParameters, (CompletionSorterImpl)sorter, myProcess, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLookupAdvertisement(@NotNull String text) {
|
||||
getCompletionService().setAdvertisementText(text);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompletionResultSet caseInsensitive() {
|
||||
|
||||
@@ -138,4 +138,7 @@ public class Advertiser {
|
||||
return myComponent;
|
||||
}
|
||||
|
||||
public List<String> getAdvertisements() {
|
||||
return myTexts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1158,6 +1158,11 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
return mySelectionTouched;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAdvertisements() {
|
||||
return myAdComponent.getAdvertisements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide(){
|
||||
hideLookup(true);
|
||||
@@ -1290,7 +1295,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
}
|
||||
|
||||
public void addAdvertisement(@NotNull final String text) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!myDisposed) {
|
||||
@@ -1301,7 +1306,12 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
}
|
||||
}
|
||||
}
|
||||
}, myModalityState);
|
||||
};
|
||||
if (ApplicationManager.getApplication().isDispatchThread()) {
|
||||
runnable.run();
|
||||
} else {
|
||||
ApplicationManager.getApplication().invokeLater(runnable, myModalityState);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLookupDisposed() {
|
||||
|
||||
+4
-1
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ToggleToolbarLayoutAction extends ToggleAction {
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
if (getRunnerUi(e) == null) {
|
||||
e.getPresentation().setEnabled(false);
|
||||
@@ -31,11 +32,13 @@ public class ToggleToolbarLayoutAction extends ToggleAction {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(final AnActionEvent e) {
|
||||
final RunnerContentUi ui = getRunnerUi(e);
|
||||
return ui != null ? ui.isHorizontalToolbar() : false;
|
||||
return ui != null && ui.isHorizontalToolbar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(final AnActionEvent e, final boolean state) {
|
||||
getRunnerUi(e).setHorizontalToolbar(state);
|
||||
}
|
||||
|
||||
@@ -291,6 +291,7 @@ public class GridImpl extends Wrapper implements Grid, Disposable, DataProvider
|
||||
break;
|
||||
case bottom:
|
||||
mySplitter.setProportion(tab.getBottomProportion());
|
||||
break;
|
||||
case center:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -69,18 +69,19 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Facade, ViewContextEx, PropertyChangeListener, SwitchProvider,
|
||||
QuickActionProvider, DockContainer.Dialog {
|
||||
public static final DataKey<RunnerContentUi> KEY = DataKey.create("DebuggerContentUI");
|
||||
|
||||
@NonNls public static final String LAYOUT = "Runner.Layout";
|
||||
@NonNls public static final String SETTINGS = "XDebugger.Settings";
|
||||
@NonNls public static final String VIEW_POPUP = "Runner.View.Popup";
|
||||
@NonNls public static final String VIEW_TOOLBAR = "Runner.View.Toolbar";
|
||||
@NonNls private static final String LAYOUT = "Runner.Layout";
|
||||
@NonNls private static final String SETTINGS = "XDebugger.Settings";
|
||||
@NonNls private static final String VIEW_POPUP = "Runner.View.Popup";
|
||||
@NonNls static final String VIEW_TOOLBAR = "Runner.View.Toolbar";
|
||||
|
||||
ContentManager myManager;
|
||||
RunnerLayout myLayoutSettings;
|
||||
private ContentManager myManager;
|
||||
private final RunnerLayout myLayoutSettings;
|
||||
|
||||
ActionManager myActionManager;
|
||||
String mySessionName;
|
||||
MyComponent myComponent = new MyComponent();
|
||||
private final ActionManager myActionManager;
|
||||
private final String mySessionName;
|
||||
private final MyComponent myComponent = new MyComponent();
|
||||
|
||||
private final Wrapper myToolbar = new Wrapper();
|
||||
final MyDragOutDelegate myDragOutDelegate = new MyDragOutDelegate();
|
||||
@@ -96,20 +97,19 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
return index1 - index2;
|
||||
}
|
||||
};
|
||||
Project myProject;
|
||||
private final Project myProject;
|
||||
|
||||
ActionGroup myTopActions = new DefaultActionGroup();
|
||||
private ActionGroup myTopActions = new DefaultActionGroup();
|
||||
|
||||
DefaultActionGroup myMinimizedViewActions = new DefaultActionGroup();
|
||||
private final DefaultActionGroup myMinimizedViewActions = new DefaultActionGroup();
|
||||
|
||||
Map<GridImpl, Wrapper> myMinimizedButtonsPlaceholder = new HashMap<GridImpl, Wrapper>();
|
||||
Map<GridImpl, Wrapper> myCommonActionsPlaceholder = new HashMap<GridImpl, Wrapper>();
|
||||
Map<GridImpl, AnAction[]> myContextActions = new HashMap<GridImpl, AnAction[]>();
|
||||
private final Map<GridImpl, Wrapper> myMinimizedButtonsPlaceholder = new HashMap<GridImpl, Wrapper>();
|
||||
private final Map<GridImpl, Wrapper> myCommonActionsPlaceholder = new HashMap<GridImpl, Wrapper>();
|
||||
private final Map<GridImpl, AnAction[]> myContextActions = new HashMap<GridImpl, AnAction[]>();
|
||||
|
||||
boolean myUiLastStateWasRestored;
|
||||
private boolean myUiLastStateWasRestored;
|
||||
|
||||
private final Set<Object> myRestoreStateRequestors = new HashSet<Object>();
|
||||
public static final DataKey<RunnerContentUi> KEY = DataKey.create("DebuggerContentUI");
|
||||
private String myActionsPlace = ActionPlaces.UNKNOWN;
|
||||
private final IdeFocusManager myFocusManager;
|
||||
|
||||
@@ -132,8 +132,8 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
private Image myCurrentOverImg;
|
||||
private TabInfo myCurrentOverInfo;
|
||||
private RunnerContentUi myOriginal;
|
||||
private CopyOnWriteArraySet<Listener> myDockingListeners = new CopyOnWriteArraySet<Listener>();
|
||||
private Set<RunnerContentUi> myChildren = new TreeSet<RunnerContentUi>(new Comparator<RunnerContentUi>() {
|
||||
private final CopyOnWriteArraySet<Listener> myDockingListeners = new CopyOnWriteArraySet<Listener>();
|
||||
private final Set<RunnerContentUi> myChildren = new TreeSet<RunnerContentUi>(new Comparator<RunnerContentUi>() {
|
||||
@Override
|
||||
public int compare(RunnerContentUi o1, RunnerContentUi o2) {
|
||||
return o1.myWindow - o2.myWindow;
|
||||
@@ -142,12 +142,12 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
private int myWindow;
|
||||
private boolean myDisposing;
|
||||
|
||||
public RunnerContentUi(Project project,
|
||||
RunnerLayoutUi ui,
|
||||
ActionManager actionManager,
|
||||
IdeFocusManager focusManager,
|
||||
RunnerLayout settings,
|
||||
String sessionName) {
|
||||
public RunnerContentUi(@NotNull Project project,
|
||||
@NotNull RunnerLayoutUi ui,
|
||||
@NotNull ActionManager actionManager,
|
||||
@NotNull IdeFocusManager focusManager,
|
||||
@NotNull RunnerLayout settings,
|
||||
@NotNull String sessionName) {
|
||||
myProject = project;
|
||||
myRunnerUi = ui;
|
||||
myLayoutSettings = settings;
|
||||
@@ -156,7 +156,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
myFocusManager = focusManager;
|
||||
}
|
||||
|
||||
public RunnerContentUi(RunnerContentUi ui, RunnerContentUi original, int window) {
|
||||
public RunnerContentUi(@NotNull RunnerContentUi ui, @NotNull RunnerContentUi original, int window) {
|
||||
this(ui.myProject, ui.myRunnerUi, ui.myActionManager, ui.myFocusManager, ui.myLayoutSettings, ui.mySessionName);
|
||||
myOriginal = original;
|
||||
original.myChildren.add(this);
|
||||
@@ -1282,7 +1282,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
processAttraction(content.getUserData(ViewImpl.ID), myAttractions, new LayoutAttractionPolicy.Bounce(), afterInitialized, true);
|
||||
}
|
||||
|
||||
public void attractByCondition(String condition, boolean afterInitialized) {
|
||||
public void attractByCondition(@NotNull String condition, boolean afterInitialized) {
|
||||
processAttraction(myLayoutSettings.getToFocus(condition), myConditionAttractions, myLayoutSettings.getAttractionPolicy(condition),
|
||||
afterInitialized, true);
|
||||
}
|
||||
@@ -1639,8 +1639,8 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
}
|
||||
|
||||
class DockableGrid implements DockableContent<List<Content>> {
|
||||
final Image myImg;
|
||||
private Presentation myPresentation;
|
||||
private final Image myImg;
|
||||
private final Presentation myPresentation;
|
||||
private final Dimension myPreferredSize;
|
||||
private final List<Content> myContents;
|
||||
private final int myWindow;
|
||||
@@ -1653,6 +1653,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
myWindow = window;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Content> getKey() {
|
||||
return myContents;
|
||||
@@ -1686,6 +1687,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
return myOriginal != null ? myOriginal : RunnerContentUi.this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Content> getContents() {
|
||||
return myContents;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class RunnerLayout {
|
||||
private final Map<String, Pair<String, LayoutAttractionPolicy>> myDefaultFocus = new HashMap<String, Pair<String, LayoutAttractionPolicy>>();
|
||||
|
||||
|
||||
public RunnerLayout(final String ID) {
|
||||
public RunnerLayout(@NotNull String ID) {
|
||||
myID = ID;
|
||||
}
|
||||
|
||||
@@ -72,17 +72,17 @@ public class RunnerLayout {
|
||||
return tab;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TabImpl createNewTab(final int index) {
|
||||
final TabImpl tab;
|
||||
|
||||
final TabImpl.Default defaultTab = getOrCreateDefaultTab(index);
|
||||
tab = defaultTab.createTab();
|
||||
final TabImpl tab = defaultTab.createTab();
|
||||
|
||||
myTabs.add(tab);
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TabImpl.Default getOrCreateDefaultTab(final int index) {
|
||||
TabImpl.Default tab = myDefaultTabs.get(index);
|
||||
if (tab == null) {
|
||||
@@ -92,6 +92,7 @@ public class RunnerLayout {
|
||||
return tab;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TabImpl createNewTab() {
|
||||
int index = 0;
|
||||
for (TabImpl each : myTabs) {
|
||||
@@ -108,7 +109,7 @@ public class RunnerLayout {
|
||||
return createNewTab(index);
|
||||
}
|
||||
|
||||
private boolean isUsed(TabImpl tab) {
|
||||
private boolean isUsed(@NotNull TabImpl tab) {
|
||||
for (ViewImpl each : myViews.values()) {
|
||||
if (each.getTab() == tab) return true;
|
||||
}
|
||||
@@ -125,15 +126,17 @@ public class RunnerLayout {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Element getState() {
|
||||
return write(new Element("layout"));
|
||||
}
|
||||
|
||||
public void loadState(final Element state) {
|
||||
public void loadState(@NotNull Element state) {
|
||||
read(state);
|
||||
}
|
||||
|
||||
public Element read(final Element parentNode) {
|
||||
@NotNull
|
||||
public Element read(@NotNull Element parentNode) {
|
||||
List tabs = parentNode.getChildren(StringUtil.getShortName(TabImpl.class.getName()));
|
||||
for (Object eachTabElement : tabs) {
|
||||
TabImpl eachTab = new TabImpl((Element)eachTabElement);
|
||||
@@ -151,7 +154,8 @@ public class RunnerLayout {
|
||||
return parentNode;
|
||||
}
|
||||
|
||||
public Element write(final Element parentNode) {
|
||||
@NotNull
|
||||
public Element write(@NotNull Element parentNode) {
|
||||
for (ViewImpl eachState : myViews.values()) {
|
||||
eachState.write(parentNode);
|
||||
}
|
||||
@@ -181,11 +185,12 @@ public class RunnerLayout {
|
||||
myGeneral.horizontalToolbar = horizontal;
|
||||
}
|
||||
|
||||
public ViewImpl getStateFor(Content content) {
|
||||
@NotNull
|
||||
public ViewImpl getStateFor(@NotNull Content content) {
|
||||
return getOrCreateView(getOrCreateContentId(content));
|
||||
}
|
||||
|
||||
public void clearStateFor(Content content) {
|
||||
public void clearStateFor(@NotNull Content content) {
|
||||
final ViewImpl view = myViews.remove(getOrCreateContentId(content));
|
||||
if (view != null) {
|
||||
final Tab tab = view.getTab();
|
||||
@@ -195,7 +200,8 @@ public class RunnerLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getOrCreateContentId(final Content content) {
|
||||
@NotNull
|
||||
private static String getOrCreateContentId(@NotNull Content content) {
|
||||
@NonNls String id = content.getUserData(ViewImpl.ID);
|
||||
if (id == null) {
|
||||
id = "UnknownView-" + content.getDisplayName();
|
||||
@@ -204,71 +210,71 @@ public class RunnerLayout {
|
||||
return id;
|
||||
}
|
||||
|
||||
private ViewImpl getOrCreateView(String id) {
|
||||
@NotNull
|
||||
private ViewImpl getOrCreateView(@NotNull String id) {
|
||||
if (myViews.containsKey(id)) {
|
||||
return myViews.get(id);
|
||||
} else {
|
||||
final ViewImpl.Default defaultView = getOrCreateDefault(id);
|
||||
final ViewImpl view = defaultView.createView(this);
|
||||
myViews.put(id, view);
|
||||
return view;
|
||||
}
|
||||
final ViewImpl.Default defaultView = getOrCreateDefault(id);
|
||||
final ViewImpl view = defaultView.createView(this);
|
||||
myViews.put(id, view);
|
||||
return view;
|
||||
}
|
||||
|
||||
private ViewImpl.Default getOrCreateDefault(String id) {
|
||||
@NotNull
|
||||
private ViewImpl.Default getOrCreateDefault(@NotNull String id) {
|
||||
if (myDefaultViews.containsKey(id)) {
|
||||
return myDefaultViews.get(id);
|
||||
} else {
|
||||
return setDefault(id, Integer.MAX_VALUE, PlaceInGrid.bottom, false);
|
||||
}
|
||||
return setDefault(id, Integer.MAX_VALUE, PlaceInGrid.bottom, false);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public TabImpl.Default setDefault(int tabID, String displayName, Icon icon) {
|
||||
final TabImpl.Default tab = new TabImpl.Default(tabID, displayName, icon);
|
||||
myDefaultTabs.put(tabID, tab);
|
||||
return tab;
|
||||
}
|
||||
|
||||
public ViewImpl.Default setDefault(String id, int tabIndex, PlaceInGrid placeInGrid, boolean isMinimized) {
|
||||
@NotNull
|
||||
public ViewImpl.Default setDefault(@NotNull String id, int tabIndex, @NotNull PlaceInGrid placeInGrid, boolean isMinimized) {
|
||||
final ViewImpl.Default view = new ViewImpl.Default(id, tabIndex, placeInGrid, isMinimized);
|
||||
myDefaultViews.put(id, view);
|
||||
return view;
|
||||
}
|
||||
|
||||
public PlaceInGrid getDefaultGridPlace(final Content content) {
|
||||
@NotNull
|
||||
public PlaceInGrid getDefaultGridPlace(@NotNull Content content) {
|
||||
return getOrCreateDefault(getOrCreateContentId(content)).getPlaceInGrid();
|
||||
}
|
||||
|
||||
public int getDefaultSelectedTabIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isToFocus(final String id, final String condition) {
|
||||
public boolean isToFocus(final String id, @NotNull String condition) {
|
||||
return Comparing.equal(id, getToFocus(condition));
|
||||
}
|
||||
|
||||
public void setToFocus(final String id, final String condition) {
|
||||
public void setToFocus(final String id, @NotNull String condition) {
|
||||
myGeneral.focusOnCondition.put(condition, id);
|
||||
}
|
||||
|
||||
public void setDefaultToFocus(String id, final String condition, @NotNull final LayoutAttractionPolicy policy) {
|
||||
public void setDefaultToFocus(@NotNull String id, @NotNull String condition, @NotNull final LayoutAttractionPolicy policy) {
|
||||
myDefaultFocus.put(condition, Pair.create(id, policy));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getToFocus(final String condition) {
|
||||
return myGeneral.focusOnCondition.containsKey(condition) ? myGeneral.focusOnCondition.get(condition) : (myDefaultFocus.containsKey(condition) ? myDefaultFocus.get(condition).getFirst() : null);
|
||||
public String getToFocus(@NotNull String condition) {
|
||||
return myGeneral.focusOnCondition.containsKey(condition) ? myGeneral.focusOnCondition.get(condition) :
|
||||
myDefaultFocus.containsKey(condition) ? myDefaultFocus.get(condition).getFirst() : null;
|
||||
}
|
||||
|
||||
public LayoutAttractionPolicy getAttractionPolicy(final String condition) {
|
||||
@NotNull
|
||||
public LayoutAttractionPolicy getAttractionPolicy(@NotNull String condition) {
|
||||
final Pair<String, LayoutAttractionPolicy> pair = myDefaultFocus.get(condition);
|
||||
return pair == null ? new LayoutAttractionPolicy.FocusOnce() : pair.getSecond();
|
||||
}
|
||||
|
||||
public static class General {
|
||||
public volatile boolean horizontalToolbar = false;
|
||||
public volatile int selectedTab = 0;
|
||||
public volatile Map<String, String> focusOnCondition = new HashMap<String, String>();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -18,6 +18,7 @@ package com.intellij.execution.ui.layout.impl;
|
||||
|
||||
import com.intellij.openapi.components.*;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -34,7 +35,7 @@ public class RunnerLayoutSettings implements PersistentStateComponent<Element> {
|
||||
|
||||
private final Map<String, RunnerLayout> myRunnerId2Settings = new LinkedHashMap<String, RunnerLayout>();
|
||||
|
||||
public RunnerLayout getLayout(String id) {
|
||||
public RunnerLayout getLayout(@NotNull String id) {
|
||||
RunnerLayout layout = myRunnerId2Settings.get(id);
|
||||
if (layout == null) {
|
||||
layout = new RunnerLayout(id);
|
||||
@@ -44,6 +45,7 @@ public class RunnerLayoutSettings implements PersistentStateComponent<Element> {
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
final Element runners = new Element("runners");
|
||||
for (String eachID : myRunnerId2Settings.keySet()) {
|
||||
@@ -56,6 +58,7 @@ public class RunnerLayoutSettings implements PersistentStateComponent<Element> {
|
||||
return runners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(final Element state) {
|
||||
final List runners = state.getChildren("runner");
|
||||
for (Object each : runners) {
|
||||
|
||||
+2
@@ -28,6 +28,8 @@ public class RunnerLayoutUiFactoryImpl extends RunnerLayoutUi.Factory {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RunnerLayoutUi create(@NotNull final String runnerId, @NotNull final String runnerTitle, @NotNull final String sessionName, @NotNull final Disposable parent) {
|
||||
return new RunnerLayoutUiImpl(myProject, parent, runnerId, runnerTitle, sessionName);
|
||||
}
|
||||
|
||||
+65
-11
@@ -54,7 +54,11 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
private final ContentManager myViewsContentManager;
|
||||
public static final Key<String> CONTENT_TYPE = Key.create("ContentType");
|
||||
|
||||
public RunnerLayoutUiImpl(Project project, Disposable parent, String runnerId, String runnerTitle, String sessionName) {
|
||||
public RunnerLayoutUiImpl(@NotNull Project project,
|
||||
@NotNull Disposable parent,
|
||||
@NotNull String runnerId,
|
||||
@NotNull String runnerTitle,
|
||||
@NotNull String sessionName) {
|
||||
myLayout = RunnerLayoutSettings.getInstance().getLayout(runnerId);
|
||||
Disposer.register(parent, this);
|
||||
|
||||
@@ -69,6 +73,7 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
myContentPanel.add(myViewsContentManager.getComponent(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public LayoutViewOptions setTopToolbar(@NotNull ActionGroup actions, @NotNull String place) {
|
||||
myContentUI.setTopActions(actions, place);
|
||||
@@ -76,31 +81,39 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutStateDefaults initTabDefaults(int id, String text, Icon icon) {
|
||||
getLayout().setDefault(id, text, icon);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutStateDefaults initFocusContent(@NotNull final String id, @NotNull final String condition) {
|
||||
return initFocusContent(id, condition, new LayoutAttractionPolicy.FocusOnce());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutStateDefaults initFocusContent(@NotNull final String id, @NotNull final String condition, @NotNull final LayoutAttractionPolicy policy) {
|
||||
getLayout().setDefaultToFocus(id, condition, policy);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Content addContent(@NotNull Content content) {
|
||||
return addContent(content, false, -1, PlaceInGrid.center, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Content addContent(@NotNull Content content, int defaultTabId, PlaceInGrid defaultPlace, boolean defaultIsMinimized) {
|
||||
public Content addContent(@NotNull Content content, int defaultTabId, @NotNull PlaceInGrid defaultPlace, boolean defaultIsMinimized) {
|
||||
return addContent(content, true, defaultTabId, defaultPlace, defaultIsMinimized);
|
||||
}
|
||||
|
||||
public Content addContent(Content content, boolean applyDefaults, int defaultTabId, PlaceInGrid defaultPlace, boolean defaultIsMinimized) {
|
||||
public Content addContent(@NotNull Content content, boolean applyDefaults, int defaultTabId, @NotNull PlaceInGrid defaultPlace, boolean defaultIsMinimized) {
|
||||
final String id = content.getUserData(CONTENT_TYPE);
|
||||
|
||||
assert id != null : "Content id is missing, use RunnerLayoutUi to create content instances";
|
||||
@@ -113,11 +126,13 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Content createContent(@NotNull String id, @NotNull JComponent component, @NotNull String displayName, @Nullable Icon icon, @Nullable JComponent focusable) {
|
||||
return createContent(id, new ComponentWithActions.Impl(component), displayName, icon, focusable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Content createContent(@NotNull final String contentId, @NotNull final ComponentWithActions withActions, @NotNull final String displayName,
|
||||
@Nullable final Icon icon,
|
||||
@@ -138,6 +153,7 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JComponent getComponent() {
|
||||
return myContentPanel;
|
||||
@@ -151,6 +167,7 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return myLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateActionsNow() {
|
||||
myContentUI.updateActionsImmediately();
|
||||
}
|
||||
@@ -160,18 +177,24 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
myContentUI.saveUiState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ContentManager getContentManager() {
|
||||
return myViewsContentManager;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ActionCallback selectAndFocus(@Nullable final Content content, boolean requestFocus, final boolean forced) {
|
||||
return selectAndFocus(content, requestFocus, forced, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ActionCallback selectAndFocus(@Nullable final Content content, boolean requestFocus, final boolean forced, boolean implicit) {
|
||||
if (content == null) return new ActionCallback.Rejected();
|
||||
return getContentManager(content).setSelectedContent(content, requestFocus || shouldRequestFocus(), forced, implicit);
|
||||
@@ -186,59 +209,73 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return focused != null && SwingUtilities.isDescendingFrom(focused, getContentManager().getComponent());
|
||||
}
|
||||
|
||||
public boolean removeContent(final Content content, final boolean dispose) {
|
||||
if (content == null) return false;
|
||||
return getContentManager().removeContent(content, dispose);
|
||||
@Override
|
||||
public boolean removeContent(@Nullable Content content, final boolean dispose) {
|
||||
return content != null && getContentManager().removeContent(content, dispose);
|
||||
}
|
||||
|
||||
public boolean isToFocus(final Content content, final String condition) {
|
||||
@Override
|
||||
public boolean isToFocus(@NotNull final Content content, @NotNull final String condition) {
|
||||
final String id = content.getUserData(ViewImpl.ID);
|
||||
return getLayout().isToFocus(id, condition);
|
||||
}
|
||||
|
||||
public LayoutViewOptions setToFocus(@Nullable final Content content, final String condition) {
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutViewOptions setToFocus(@Nullable final Content content, @NotNull final String condition) {
|
||||
getLayout().setToFocus(content != null ? content.getUserData(ViewImpl.ID) : null, condition);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attractBy(@NotNull final String condition) {
|
||||
myContentUI.attractByCondition(condition, true);
|
||||
}
|
||||
|
||||
public void clearAttractionBy(final String condition) {
|
||||
@Override
|
||||
public void clearAttractionBy(@NotNull final String condition) {
|
||||
myContentUI.clearAttractionByCondition(condition, true);
|
||||
}
|
||||
|
||||
public void removeContent(String id, final boolean dispose) {
|
||||
public void removeContent(@NotNull String id, final boolean dispose) {
|
||||
final Content content = findContent(id);
|
||||
if (content != null) {
|
||||
getContentManager().removeContent(content, dispose);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnAction getLayoutActions() {
|
||||
return myContentUI.getLayoutActions();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AnAction[] getLayoutActionsList() {
|
||||
final ActionGroup group = (ActionGroup)getLayoutActions();
|
||||
return group.getChildren(null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutViewOptions setLeftToolbar(@NotNull final ActionGroup leftToolbar, @NotNull final String place) {
|
||||
myContentUI.setLeftToolbar(leftToolbar, place);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Content findContent(@NotNull final String key) {
|
||||
return myContentUI.findContent(key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RunnerLayoutUi addListener(@NotNull final ContentManagerListener listener, @NotNull final Disposable parent) {
|
||||
final ContentManager mgr = getContentManager();
|
||||
mgr.addContentManagerListener(listener);
|
||||
Disposer.register(parent, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
mgr.removeContentManagerListener(listener);
|
||||
}
|
||||
@@ -246,19 +283,23 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(@NotNull final ContentManagerListener listener) {
|
||||
getContentManager().removeContentManagerListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBouncing(@NotNull final Content content, final boolean activate) {
|
||||
myContentUI.processBounce(content, activate);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDisposed() {
|
||||
return getContentManager().isDisposed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public LayoutViewOptions setMinimizeActionEnabled(final boolean enabled) {
|
||||
myContentUI.setMinimizeActionEnabled(enabled);
|
||||
@@ -270,34 +311,42 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public LayoutViewOptions setMoveToGridActionEnabled(final boolean enabled) {
|
||||
myContentUI.setMovetoGridActionEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public LayoutViewOptions setAttractionPolicy(@NotNull final String contentId, final LayoutAttractionPolicy policy) {
|
||||
myContentUI.setPolicy(contentId, policy);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutViewOptions setConditionAttractionPolicy(@NotNull final String condition, final LayoutAttractionPolicy policy) {
|
||||
myContentUI.setConditionPolicy(condition, policy);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public LayoutStateDefaults getDefaults() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public LayoutViewOptions getOptions() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public LayoutViewOptions setAdditionalFocusActions(final ActionGroup group) {
|
||||
@NotNull
|
||||
@Override
|
||||
public LayoutViewOptions setAdditionalFocusActions(@NotNull final ActionGroup group) {
|
||||
myContentUI.setAdditionalFocusActions(group);
|
||||
return this;
|
||||
}
|
||||
@@ -307,11 +356,15 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
return myContentUI.getSettingsActions();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AnAction[] getSettingsActionsList() {
|
||||
final ActionGroup group = (ActionGroup)getSettingsActions();
|
||||
return group.getChildren(null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Content[] getContents() {
|
||||
Content[] contents = new Content[getContentManager().getContentCount()];
|
||||
for (int i = 0; i < contents.length; i++) {
|
||||
@@ -325,6 +378,7 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La
|
||||
super(new BorderLayout());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (SwitchProvider.KEY.getName().equals(dataId)) {
|
||||
return myContentUI;
|
||||
|
||||
@@ -36,10 +36,12 @@ public class TabImpl extends AbstractTab implements Tab {
|
||||
TabImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return myIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultIndex() {
|
||||
return myDefaultIndex >= 0 ? myDefaultIndex : myIndex;
|
||||
}
|
||||
@@ -129,10 +131,12 @@ public class TabImpl extends AbstractTab implements Tab {
|
||||
myBottomDetached = bottomDetached;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefault() {
|
||||
return myIndex == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDetached(PlaceInGrid place) {
|
||||
switch (place) {
|
||||
case bottom:
|
||||
@@ -148,6 +152,7 @@ public class TabImpl extends AbstractTab implements Tab {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDetached(PlaceInGrid place, boolean detached) {
|
||||
switch (place) {
|
||||
case bottom:
|
||||
|
||||
@@ -998,7 +998,7 @@ public abstract class ChooseByNameBase {
|
||||
List<ModelDiff.Cmd> commands = ModelDiff.createDiffCmds(myListModel, oldElements, newElements);
|
||||
if (commands == null) {
|
||||
myListUpdater.doPostponedOkIfNeeded();
|
||||
return;
|
||||
return; // Nothing changed
|
||||
}
|
||||
|
||||
myTextField.setForeground(UIUtil.getTextFieldForeground());
|
||||
|
||||
@@ -17,12 +17,15 @@ package com.intellij.ide.util.gotoByName;
|
||||
|
||||
import com.intellij.util.diff.Diff;
|
||||
import com.intellij.util.diff.FilesTooBigForDiffException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ModelDiff {
|
||||
public static List<Cmd> createDiffCmds(Model<Object> listModel, Object[] oldElements, Object[] newElements) {
|
||||
@Nullable
|
||||
public static List<Cmd> createDiffCmds(@NotNull Model<Object> listModel, @NotNull Object[] oldElements, @NotNull Object[] newElements) {
|
||||
Diff.Change change = null;
|
||||
try {
|
||||
change = Diff.buildChanges(oldElements, newElements);
|
||||
@@ -41,12 +44,12 @@ public class ModelDiff {
|
||||
while (change != null) {
|
||||
if (change.deleted > 0) {
|
||||
final int start = change.line0 + inserted - deleted;
|
||||
commands.add(new RemoveCmd(listModel, start, start + change.deleted - 1));
|
||||
commands.add(new RemoveCmd<Object>(listModel, start, start + change.deleted - 1));
|
||||
}
|
||||
|
||||
if (change.inserted > 0) {
|
||||
for (int i = 0; i < change.inserted; i++) {
|
||||
commands.add(new InsertCmd(listModel, change.line0 + i + inserted - deleted, newElements[change.line1 + i]));
|
||||
commands.add(new InsertCmd<Object>(listModel, change.line0 + i + inserted - deleted, newElements[change.line1 + i]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +75,7 @@ public class ModelDiff {
|
||||
private final int start;
|
||||
private final int end;
|
||||
|
||||
private RemoveCmd(Model<T> model, final int start, final int end) {
|
||||
private RemoveCmd(@NotNull Model<T> model, final int start, final int end) {
|
||||
myListModel = model;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
@@ -80,7 +83,8 @@ public class ModelDiff {
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
myListModel.removeRangeFromModel(start, end+1);
|
||||
//System.out.println("removing: "+this);
|
||||
myListModel.removeRangeFromModel(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,7 +96,7 @@ public class ModelDiff {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "-["+start+", "+end+")";
|
||||
return "-["+start+", "+end+"]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +105,7 @@ public class ModelDiff {
|
||||
private final int idx;
|
||||
private final T element;
|
||||
|
||||
private InsertCmd(Model<T> model, final int idx, T element) {
|
||||
private InsertCmd(@NotNull Model<T> model, final int idx, @NotNull T element) {
|
||||
myListModel = model;
|
||||
this.idx = idx;
|
||||
this.element = element;
|
||||
@@ -109,6 +113,7 @@ public class ModelDiff {
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
//System.out.println("Adding: "+this+"-> "+element);
|
||||
myListModel.addToModel(idx, element);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@ import com.intellij.lang.refactoring.InlineHandler;
|
||||
import com.intellij.lang.refactoring.InlineHandlers;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
@@ -48,6 +50,8 @@ import java.util.*;
|
||||
@SuppressWarnings({"UtilityClassWithoutPrivateConstructor"})
|
||||
public class GenericInlineHandler {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(GenericInlineHandler.class);
|
||||
|
||||
public static boolean invoke(final PsiElement element, @Nullable Editor editor, final InlineHandler languageSpecific) {
|
||||
final PsiReference invocationReference = editor != null ? TargetElementUtilBase.findReference(editor) : null;
|
||||
final InlineHandler.Settings settings = languageSpecific.prepareInlineElement(element, editor, invocationReference != null);
|
||||
@@ -128,7 +132,7 @@ public class GenericInlineHandler {
|
||||
languageSpecific.removeDefinition(element, settings);
|
||||
}
|
||||
}
|
||||
}, RefactoringBundle.message("inline.command", subj), null);
|
||||
}, RefactoringBundle.message("inline.command", StringUtil.notNullize(subj, "<nameless>")), null);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
@@ -139,7 +143,10 @@ public class GenericInlineHandler {
|
||||
Collection<? extends PsiReference> allReferences) {
|
||||
final Map<Language, InlineHandler.Inliner> inliners = new HashMap<Language, InlineHandler.Inliner>();
|
||||
for (PsiReference ref : allReferences) {
|
||||
final Language language = ref.getElement().getLanguage();
|
||||
PsiElement refElement = ref.getElement();
|
||||
LOG.assertTrue(refElement != null, ref.getClass().getName());
|
||||
|
||||
final Language language = refElement.getLanguage();
|
||||
if (inliners.containsKey(language)) continue;
|
||||
|
||||
final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
|
||||
|
||||
@@ -59,18 +59,16 @@ public class TextFieldWithAutoCompletionContributor<T> extends CompletionContrib
|
||||
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);
|
||||
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) {
|
||||
result.addLookupAdvertisement(adv);
|
||||
}
|
||||
|
||||
final String prefix = provider.getPrefix(parameters);
|
||||
if (prefix == null) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.execution.process;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
@@ -41,6 +42,11 @@ public class CapturingProcessAdapter extends ProcessAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(@NotNull final ProcessEvent event) {
|
||||
myOutput.setExitCode(event.getExitCode());
|
||||
}
|
||||
|
||||
public ProcessOutput getOutput() {
|
||||
return myOutput;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ProcessOutput {
|
||||
* @return true iff exit code is zero
|
||||
*/
|
||||
public boolean checkSuccess(@NotNull final Logger logger) {
|
||||
if (getExitCode() != 0) {
|
||||
if (getExitCode() != 0 || isTimeout()) {
|
||||
logger.info(getStderr() + (isTimeout()? "\nTimed out" : "\nExit code " + getExitCode()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,13 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
@Attribute("childrenEPName")
|
||||
public String childrenEPName;
|
||||
|
||||
/**
|
||||
* Indicates that configurable has dynamically calculated children.
|
||||
* {@link com.intellij.openapi.options.Configurable.Composite#getConfigurables()} will be called for such configurables.
|
||||
*/
|
||||
@Attribute("dynamic")
|
||||
public boolean dynamic;
|
||||
|
||||
@Attribute("parentId")
|
||||
public String parentId;
|
||||
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
package com.intellij.ui.docking;
|
||||
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface DockableContent<T> {
|
||||
|
||||
@NotNull
|
||||
T getKey();
|
||||
|
||||
Image getPreviewImage();
|
||||
|
||||
@@ -23,9 +23,10 @@ import com.intellij.ui.ListScrollingUtil;
|
||||
import com.intellij.ui.ListSpeedSearch;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@@ -37,11 +38,11 @@ public class SelectFontDialog extends DialogWrapper {
|
||||
private JCheckBox myShowMonospacedCheckbox;
|
||||
private final List<String> myFontNames;
|
||||
private final String myInitialFontName;
|
||||
private final HashMap myNameToIsMonospaced;
|
||||
private final List<String> myMonospacedFontNames;
|
||||
|
||||
public SelectFontDialog(Component parent, List<String> fontNames, String initialFontName, HashMap nameToIsMonospaced) {
|
||||
public SelectFontDialog(Component parent, List<String> fontNames, String initialFontName, List<String> monospacedFontNames) {
|
||||
super(parent, true);
|
||||
myNameToIsMonospaced = nameToIsMonospaced;
|
||||
myMonospacedFontNames = monospacedFontNames;
|
||||
setTitle(ApplicationBundle.message("title.select.font"));
|
||||
myFontNames = fontNames;
|
||||
myInitialFontName = initialFontName;
|
||||
@@ -51,7 +52,6 @@ public class SelectFontDialog extends DialogWrapper {
|
||||
protected JComponent createCenterPanel() {
|
||||
myShowMonospacedCheckbox = new JCheckBox(ApplicationBundle.message("checkbox.show.only.monospaced.fonts"));
|
||||
final boolean useOnlyMonospacedFonts = EditorColorsManager.getInstance().isUseOnlyMonospacedFonts();
|
||||
myShowMonospacedCheckbox.setSelected(useOnlyMonospacedFonts);
|
||||
myFontList = new JBList();
|
||||
new ListSpeedSearch(myFontList);
|
||||
myFontList.setModel(new DefaultListModel());
|
||||
@@ -84,10 +84,11 @@ public class SelectFontDialog extends DialogWrapper {
|
||||
|
||||
panel.add(myShowMonospacedCheckbox, BorderLayout.NORTH);
|
||||
panel.add(ScrollPaneFactory.createScrollPane(myFontList), BorderLayout.CENTER);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
myShowMonospacedCheckbox.setSelected(useOnlyMonospacedFonts);
|
||||
myShowMonospacedCheckbox.setSelected(useOnlyMonospacedFonts);
|
||||
myFontList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
setOKActionEnabled(myFontList.getSelectedValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -97,20 +98,15 @@ public class SelectFontDialog extends DialogWrapper {
|
||||
private void fillList(boolean onlyMonospaced) {
|
||||
DefaultListModel model = (DefaultListModel) myFontList.getModel();
|
||||
model.removeAllElements();
|
||||
for (int i = 0; i < myFontNames.size(); i++) {
|
||||
String fontName = myFontNames.get(i);
|
||||
if (!onlyMonospaced || Boolean.TRUE.equals(myNameToIsMonospaced.get(fontName))) {
|
||||
for (String fontName : myFontNames) {
|
||||
if (!onlyMonospaced || myMonospacedFontNames.contains(fontName)) {
|
||||
model.addElement(fontName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void show() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ListScrollingUtil.selectItem(myFontList, myInitialFontName);
|
||||
}
|
||||
});
|
||||
ListScrollingUtil.selectItem(myFontList, myInitialFontName);
|
||||
super.show();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.win32.IdeaWin32;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.SystemProperties;
|
||||
@@ -33,6 +34,8 @@ import org.xerial.snappy.SnappyLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -200,6 +203,7 @@ public class StartupUtil {
|
||||
}
|
||||
try {
|
||||
final long t = System.currentTimeMillis();
|
||||
loadSnappyForJRockit();
|
||||
log.info("Snappy library loaded (" + Snappy.getNativeLibraryVersion() + ") in " + (System.currentTimeMillis() - t) + " ms");
|
||||
}
|
||||
catch (Throwable t) {
|
||||
@@ -221,4 +225,37 @@ public class StartupUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo[r.sh] drop after migration on Java 7
|
||||
private static void loadSnappyForJRockit() throws Exception {
|
||||
String vmName = System.getProperty("java.vm.name");
|
||||
if (vmName == null || !vmName.toLowerCase().contains("jrockit")) {
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] bytes;
|
||||
InputStream in = StartupUtil.class.getResourceAsStream("/org/xerial/snappy/SnappyNativeLoader.bytecode");
|
||||
try {
|
||||
bytes = FileUtil.loadBytes(in);
|
||||
}
|
||||
finally {
|
||||
in.close();
|
||||
}
|
||||
|
||||
ClassLoader classLoader = StartupUtil.class.getClassLoader();
|
||||
|
||||
Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
|
||||
defineClass.setAccessible(true);
|
||||
Class<?> loaderClass = (Class<?>)defineClass.invoke(classLoader, "org.xerial.snappy.SnappyNativeLoader", bytes, 0, bytes.length);
|
||||
loaderClass = classLoader.loadClass(loaderClass.getName());
|
||||
|
||||
String[] classes = {"org.xerial.snappy.SnappyNativeAPI", "org.xerial.snappy.SnappyNative", "org.xerial.snappy.SnappyErrorCode"};
|
||||
for (String aClass : classes) {
|
||||
classLoader.loadClass(aClass);
|
||||
}
|
||||
|
||||
Method loadNativeLibrary = SnappyLoader.class.getDeclaredMethod("loadNativeLibrary", Class.class);
|
||||
loadNativeLibrary.setAccessible(true);
|
||||
loadNativeLibrary.invoke(null, loaderClass);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -642,6 +642,7 @@ final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget
|
||||
myPinned = window.isFilePinned(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VirtualFile getKey() {
|
||||
return myFile;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.options.ex;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -42,11 +43,12 @@ public class ConfigurableWrapper implements SearchableConfigurable {
|
||||
return wrapConfigurable(ep);
|
||||
}
|
||||
};
|
||||
private static final Logger LOG = Logger.getInstance(ConfigurableWrapper.class);
|
||||
|
||||
@Nullable
|
||||
public static <T extends UnnamedConfigurable> T wrapConfigurable(ConfigurableEP<T> ep) {
|
||||
if (ep.displayName != null || ep.key != null) {
|
||||
return (T)(ep.children != null || ep.childrenEPName != null ? new CompositeWrapper(ep) : new ConfigurableWrapper(ep));
|
||||
return (T)(ep.children != null || ep.childrenEPName != null || ep.dynamic ? new CompositeWrapper(ep) : new ConfigurableWrapper(ep));
|
||||
}
|
||||
else {
|
||||
return ep.createConfigurable();
|
||||
@@ -80,11 +82,11 @@ public class ConfigurableWrapper implements SearchableConfigurable {
|
||||
|
||||
private UnnamedConfigurable myConfigurable;
|
||||
|
||||
protected UnnamedConfigurable getConfigurable() {
|
||||
public UnnamedConfigurable getConfigurable() {
|
||||
if (myConfigurable == null) {
|
||||
myConfigurable = myEp.createConfigurable();
|
||||
if (myConfigurable == null) {
|
||||
System.out.println("oops");
|
||||
LOG.error("Can't instantiate configurable for " + myEp);
|
||||
}
|
||||
}
|
||||
return myConfigurable;
|
||||
@@ -162,15 +164,15 @@ public class ConfigurableWrapper implements SearchableConfigurable {
|
||||
|
||||
public CompositeWrapper(ConfigurableEP ep, Configurable... kids) {
|
||||
super(ep);
|
||||
if (ep.children == null) {
|
||||
kids = EMPTY_ARRAY;
|
||||
if (ep.dynamic) {
|
||||
kids = ((Composite)getConfigurable()).getConfigurables();
|
||||
}
|
||||
else {
|
||||
else if (ep.children != null) {
|
||||
kids = ContainerUtil.mapNotNull(ep.getChildren(),
|
||||
new NullableFunction<ConfigurableEP, ConfigurableWrapper>() {
|
||||
@Override
|
||||
public ConfigurableWrapper fun(ConfigurableEP ep) {
|
||||
return ep.isAvailable() ? new ConfigurableWrapper(ep) : null;
|
||||
return ep.isAvailable() ? (ConfigurableWrapper)wrapConfigurable(ep) : null;
|
||||
}
|
||||
}, EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ combobox.scheme.name=Scheme name:
|
||||
progress.analyzing.fonts=Analyzing Fonts
|
||||
error.readonly.scheme.cannot.be.modified=Read-only scheme cannot be modified. Please do "Save As..." first.
|
||||
error.shared.scheme.cannot.be.modified=Shared scheme cannot be modified. Please do "Save As..." first.
|
||||
title.cannot.modify.readonly.scheme=Cannot Modify read-only Scheme
|
||||
title.cannot.modify.readonly.scheme=Cannot Modify Read-Only Scheme
|
||||
title.save.color.scheme.as=Save Color Scheme As
|
||||
title.path.variables=Path Variables
|
||||
editbox.path.macro.value=Value:
|
||||
|
||||
@@ -931,7 +931,7 @@ add.scope.popup.title=Add scope
|
||||
add.scope.name.label=Name
|
||||
add.scope.dialog.title=Add New Scope
|
||||
scope.banner.text=Scope ''{0}''
|
||||
prompt.please.select.module.jdk=Please select {0} to be set for this module
|
||||
prompt.please.select.module.jdk=Please select the {0} to be set for this module
|
||||
scopes.save.dialog.title.shared=Save as shared scope
|
||||
scopes.save.dialog.title.local=Save as local scope
|
||||
plugin.version.label=Version
|
||||
|
||||
@@ -922,6 +922,7 @@
|
||||
<action id="Console.TableResult.PreviousPage"><keyboard-shortcut first-keystroke="control alt UP"/></action>
|
||||
<action id="Console.TableResult.NextPage"><keyboard-shortcut first-keystroke="control alt DOWN"/></action>
|
||||
<action id="Console.TableResult.Reload"><keyboard-shortcut first-keystroke="control R"/></action>
|
||||
<action id="Console.TableResult.EditValue"><keyboard-shortcut first-keystroke="F2"/><keyboard-shortcut first-keystroke="alt ENTER"/></action>
|
||||
|
||||
<action id="Console.History.Next"><keyboard-shortcut first-keystroke="control UP"/></action>
|
||||
<action id="Console.History.Previous"><keyboard-shortcut first-keystroke="control DOWN"/></action>
|
||||
|
||||
@@ -53,7 +53,7 @@ message.text.stop.searching.for.frameworks={0} is currently searching for framew
|
||||
label.text.the.following.frameworks.are.detected=<html><body>Several frameworks are detected in the project. Please review the following items and exclude mistakenly detected.</body></html>
|
||||
label.text.no.frameworks.detected=No frameworks detected.
|
||||
|
||||
sdk.java.name=JSDK
|
||||
sdk.java.name=JDK
|
||||
sdk.java.unknown.name=Unknown
|
||||
sdk.java.corrupt.error=Probably SDK installed in ''{0}'' is corrupt
|
||||
sdk.java.corrupt.title=Cannot Detect SDK Version
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user