diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant index 9b9e81a3764b..2da278d6d8de 100644 --- a/build/scripts/layouts.gant +++ b/build/scripts/layouts.gant @@ -8,6 +8,7 @@ target('default' : "Developers update") { private List platformImplementationModules() { return [ + "core-impl", "platform-impl", "vcs-impl", "lang-impl", @@ -25,7 +26,7 @@ private List platformImplementationModules() { } private List platformApiModules() { - return ["platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi"] + return ["core-api", "platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi"] } def layoutFull(String home, String targetDirectory) { diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java index a7611f5e273e..a9d074801562 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java @@ -143,10 +143,8 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon if (myGeneratedSources.contains(FileBasedIndex.getFileId(file))) { return true; } - for (final VirtualFile root : myRootToModuleMap.keySet()) { - if (VfsUtil.isAncestor(root, file, false)) { - return true; - } + if (isUnderRoots(myRootToModuleMap.keySet(), file)) { + return true; } final Module module = getModuleByFile(file); if (module != null) { @@ -467,10 +465,8 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon if (myProjectFileIndex.isInTestSourceContent(fileOrDir)) { return true; } - for (final VirtualFile root : myGeneratedTestRoots) { - if (VfsUtil.isAncestor(root, fileOrDir, false)) { - return true; - } + if (isUnderRoots(myGeneratedTestRoots, fileOrDir)) { + return true; } return false; } @@ -479,11 +475,23 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon if (myProjectFileIndex.isInSourceContent(fileOrDir)) { return true; } - for (final VirtualFile root : myRootToModuleMap.keySet()) { - if (VfsUtil.isAncestor(root, fileOrDir, false)) { - return true; - } + if (isUnderRoots(myRootToModuleMap.keySet(), fileOrDir)) { + return true; } return false; } + + public static boolean isUnderRoots(@NotNull Set roots, @NotNull VirtualFile file) { + VirtualFile parent = file; + while (true) { + if (parent == null) { + return false; + } + if (roots.contains(parent)) { + return true; + } + parent = parent.getParent(); + } + } + } diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java index 021b17efd938..f1e89169f5fa 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java @@ -22,6 +22,7 @@ import com.intellij.compiler.make.MakeUtil; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.compiler.*; import com.intellij.openapi.compiler.ex.CompileContextEx; import com.intellij.openapi.components.ApplicationComponent; @@ -45,6 +46,7 @@ import com.intellij.openapi.vfs.newvfs.ManagingFS; import com.intellij.openapi.vfs.newvfs.NewVirtualFile; import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; +import com.intellij.util.Alarm; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.SLRUCache; import com.intellij.util.indexing.FileBasedIndex; @@ -121,7 +123,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { } }; private final ProjectManager myProjectManager; - private final TIntHashSet myInitInProgress = new TIntHashSet(); // projectId fior successfully initialized projects + private final TIntIntHashMap myInitInProgress = new TIntIntHashMap(); // projectId fior successfully initialized projects private final Object myAsyncScanLock = new Object(); public TranslatingCompilerFilesMonitor(VirtualFileManager vfsManager, ProjectManager projectManager, Application application) { @@ -967,7 +969,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { public void ensureInitializationCompleted(Project project, ProgressIndicator indicator) { final int id = getProjectId(project); synchronized (myAsyncScanLock) { - while (myInitInProgress.contains(id)) { + while (myInitInProgress.containsKey(id)) { if (!project.isOpen() || project.isDisposed() || (indicator != null && indicator.isCanceled())) { // makes no sense to continue waiting break; @@ -1095,7 +1097,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { catch (ProjectRef.ProjectClosedException swallowed) { } finally { - terminateAsyncScan(projectId); + terminateAsyncScan(projectId, false); } } }.queue(); @@ -1103,17 +1105,28 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { }); } - private void terminateAsyncScan(int projectId) { + private void terminateAsyncScan(int projectId, final boolean clearCounter) { synchronized (myAsyncScanLock) { - if (myInitInProgress.remove(projectId)) { + int counter = myInitInProgress.remove(projectId); + if (clearCounter) { myAsyncScanLock.notifyAll(); } + else { + if (--counter > 0) { + myInitInProgress.put(projectId, counter); + } + else { + myAsyncScanLock.notifyAll(); + } + } } } private void startAsyncScan(final int projectId) { synchronized (myAsyncScanLock) { - myInitInProgress.add(projectId); + int counter = myInitInProgress.get(projectId); + counter = (counter > 0)? counter + 1 : 1; + myInitInProgress.put(projectId, counter); myAsyncScanLock.notifyAll(); } } @@ -1130,6 +1143,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { conn.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { private VirtualFile[] myRootsBefore; + private Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, project); public void beforeRootsChange(final ModuleRootEvent event) { try { @@ -1164,26 +1178,31 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { } } - startAsyncScan(projectId); - new Task.Backgroundable(project, CompilerBundle.message("compiler.initial.scanning.progress.text"), false) { - public void run(@NotNull final ProgressIndicator indicator) { - try { - if (newRoots.size() > 0) { - scanSourceContent(projRef, newRoots, newRoots.size(), true); + myAlarm.cancelAllRequests(); // need alarm to deal with multiple rootsChanged events + myAlarm.addRequest(new Runnable() { + public void run() { + startAsyncScan(projectId); + new Task.Backgroundable(project, CompilerBundle.message("compiler.initial.scanning.progress.text"), false) { + public void run(@NotNull final ProgressIndicator indicator) { + try { + if (newRoots.size() > 0) { + scanSourceContent(projRef, newRoots, newRoots.size(), true); + } + if (oldRoots.size() > 0) { + scanSourceContent(projRef, oldRoots, oldRoots.size(), false); + } + markOldOutputRoots(projRef, buildOutputRootsLayout(projRef)); + } + catch (ProjectRef.ProjectClosedException swallowed) { + // ignored + } + finally { + terminateAsyncScan(projectId, false); + } } - if (oldRoots.size() > 0) { - scanSourceContent(projRef, oldRoots, oldRoots.size(), false); - } - markOldOutputRoots(projRef, buildOutputRootsLayout(projRef)); - } - catch (ProjectRef.ProjectClosedException swallowed) { - // ignored - } - finally { - terminateAsyncScan(projectId); - } + }.queue(); } - }.queue(); + }, 500, ModalityState.NON_MODAL); } catch (ProjectRef.ProjectClosedException e) { LOG.info(e); @@ -1196,7 +1215,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { public void projectClosed(final Project project) { final int projectId = getProjectId(project); - terminateAsyncScan(projectId); + terminateAsyncScan(projectId, true); myConnections.remove(project).disconnect(); synchronized (myDataLock) { mySourcesToRecompile.remove(projectId); diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form index 4d452482d19b..4d16b23ed4a6 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form @@ -7,7 +7,7 @@ - + @@ -38,8 +38,8 @@ - - + + diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form index ede31f90580e..113e6ace5179 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form @@ -7,7 +7,7 @@ - + @@ -37,8 +37,8 @@ - - + + diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form index 1936157f726f..39da15a2f707 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form @@ -1,13 +1,13 @@
- + - + - + @@ -46,10 +46,10 @@ - - + + - + @@ -93,10 +93,10 @@ - - + + - + diff --git a/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form index 11cf203ae50b..4ec4d8bd8c01 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form +++ b/java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form @@ -16,45 +16,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -63,7 +29,6 @@ - @@ -72,7 +37,6 @@ - @@ -81,10 +45,52 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/compiler/impl/src/com/intellij/compiler/options/RmicOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/options/RmicOptionsPanel.form index a2cd37ad0ff7..a5a4aafe6385 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/RmicOptionsPanel.form +++ b/java/compiler/impl/src/com/intellij/compiler/options/RmicOptionsPanel.form @@ -1,27 +1,24 @@ - + - - + - - + - - + @@ -29,8 +26,7 @@ - - + @@ -38,8 +34,7 @@ - - + @@ -48,8 +43,7 @@ - - + @@ -57,19 +51,17 @@ - - + + - - + - - + @@ -77,11 +69,11 @@ - - + + diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludedEntriesConfigurable.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludedEntriesConfigurable.java index a5a060531217..d31b208337e3 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludedEntriesConfigurable.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludedEntriesConfigurable.java @@ -25,9 +25,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.PanelWithButtons; -import com.intellij.ui.RightAlignedLabelUI; -import com.intellij.ui.ScrollPaneFactory; +import com.intellij.ui.*; import com.intellij.ui.table.JBTable; import javax.swing.*; @@ -308,12 +306,24 @@ public class ExcludedEntriesConfigurable implements UnnamedConfigurable { ((DefaultCellEditor)editor).setClickCountToStart(1); } - //ToolbarDecorator.createDecorator(myExcludedTable) - // .disableUpAction() - // .disableDownAction() + return ToolbarDecorator.createDecorator(myExcludedTable) + .disableUpAction() + .disableDownAction() + .setAddAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton anActionButton) { + addPath(myDescriptor); + } + }) + .setRemoveAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton anActionButton) { + removePaths(); + } + }).createPanel(); - return ScrollPaneFactory.createScrollPane(myExcludedTable); + //return ScrollPaneFactory.createScrollPane(myExcludedTable); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java index cdb4ee4a7e21..c57205e6e981 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java @@ -81,6 +81,7 @@ public class DebuggerExpressionComboBox extends DebuggerEditorImpl { setLayout(new BorderLayout(0, 0)); myComboBox = new ComboBox(new MyComboboxModel(getRecents()), -1); + myComboBox.setSwingPopup(false); // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection // See comment to SynthComboBoxUI.FocusHandler.focusLost() diff --git a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form b/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form index b6fa04e745f5..6a0c22b8ae78 100644 --- a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form +++ b/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form @@ -1,9 +1,9 @@ - + - + @@ -22,7 +22,7 @@ - + @@ -37,33 +37,38 @@ - + - + + + - + - + + + - + - + + @@ -75,16 +80,16 @@ - - + + - + - + @@ -104,8 +109,8 @@ - - + + @@ -113,9 +118,9 @@ - + - + @@ -252,12 +257,18 @@ - + - + + + + + + + diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.form b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.form index a70c36b0911a..d3c691ce357d 100644 --- a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.form +++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.form @@ -1,6 +1,6 @@ - + @@ -21,9 +21,13 @@ - + + + + + @@ -33,6 +37,7 @@ + diff --git a/java/execution/impl/src/com/intellij/execution/ui/AlternativeJREPanel.java b/java/execution/impl/src/com/intellij/execution/ui/AlternativeJREPanel.java index f2f9cb8cc63a..973cc74c180b 100644 --- a/java/execution/impl/src/com/intellij/execution/ui/AlternativeJREPanel.java +++ b/java/execution/impl/src/com/intellij/execution/ui/AlternativeJREPanel.java @@ -45,8 +45,9 @@ public class AlternativeJREPanel extends JPanel { super(new GridBagLayout()); myCbEnabled = new JCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox")); - final GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, - GridBagConstraints.HORIZONTAL, new Insets(2, -2, 2, 2), 0, 0); + myCbEnabled.setPreferredSize(new Dimension(154, 16)); + final GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, + GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0); add(myCbEnabled, gc); myFieldWithHistory = new TextFieldWithHistory(); @@ -61,7 +62,8 @@ public class AlternativeJREPanel extends JPanel { ExecutionBundle.message("run.configuration.select.jre.dir.label"), null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT); - gc.insets.left = 20; + gc.gridx = 1; + gc.weightx = 1; add(myPathField, gc); InsertPathAction.addTo(myFieldWithHistory.getTextEditor()); diff --git a/java/execution/impl/src/com/intellij/execution/ui/CommonJavaParametersPanel.java b/java/execution/impl/src/com/intellij/execution/ui/CommonJavaParametersPanel.java index 2c980cb9d75e..35442ec0d697 100644 --- a/java/execution/impl/src/com/intellij/execution/ui/CommonJavaParametersPanel.java +++ b/java/execution/impl/src/com/intellij/execution/ui/CommonJavaParametersPanel.java @@ -20,6 +20,8 @@ import com.intellij.execution.ExecutionBundle; import com.intellij.openapi.ui.LabeledComponent; import com.intellij.ui.RawCommandLineEditor; +import java.awt.*; + public class CommonJavaParametersPanel extends CommonProgramParametersPanel { private LabeledComponent myVMParameters; @@ -33,6 +35,9 @@ public class CommonJavaParametersPanel extends CommonProgramParametersPanel { ExecutionBundle.message("run.configuration.java.vm.parameters.label")); copyDialogCaption(myVMParameters); + myVMParameters.setLabelLocation(BorderLayout.WEST); + myVMParameters.setLabelPreferredSize(super.getProgramParametersComponent().getLabelPreferredSize()); + add(myVMParameters); super.addComponents(); } diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/actions/AddFacetAction.java b/java/idea-ui/src/com/intellij/facet/impl/ui/actions/AddFacetToModuleAction.java similarity index 87% rename from java/idea-ui/src/com/intellij/facet/impl/ui/actions/AddFacetAction.java rename to java/idea-ui/src/com/intellij/facet/impl/ui/actions/AddFacetToModuleAction.java index 033ca8078519..754d491060ea 100644 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/actions/AddFacetAction.java +++ b/java/idea-ui/src/com/intellij/facet/impl/ui/actions/AddFacetToModuleAction.java @@ -26,19 +26,16 @@ import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; -import java.util.Arrays; -import java.util.Comparator; - /** * @author nik */ -public class AddFacetAction extends AnAction implements DumbAware { - private static final Logger LOG = Logger.getInstance("#com.intellij.facet.impl.ui.actions.AddFacetAction"); +public class AddFacetToModuleAction extends AnAction implements DumbAware { + private static final Logger LOG = Logger.getInstance("#com.intellij.facet.impl.ui.actions.AddFacetToModuleAction"); private final FacetEditorFacade myEditor; private final Project myProject; private final FacetType myType; - public AddFacetAction(final FacetEditorFacade editor, Project project, final FacetType type) { + private AddFacetToModuleAction(final FacetEditorFacade editor, Project project, final FacetType type) { super(type.getPresentableName(), null, type.getIcon()); myEditor = editor; myProject = project; @@ -95,16 +92,10 @@ public class AddFacetAction extends AnAction implements DumbAware { } public static AnAction[] createAddFacetActions(FacetEditorFacade editor, Project project) { - final FacetType[] types = FacetTypeRegistry.getInstance().getFacetTypes(); - Arrays.sort(types, new Comparator() { - public int compare(final FacetType o1, final FacetType o2) { - return o1.getPresentableName().compareTo(o2.getPresentableName()); - } - }); - + final FacetType[] types = FacetTypeRegistry.getInstance().getSortedFacetTypes(); AnAction[] actions = new AnAction[types.length]; for (int i = 0; i < types.length; i++) { - actions[i] = new AddFacetAction(editor, project, types[i]); + actions[i] = new AddFacetToModuleAction(editor, project, types[i]); } return actions; } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/AddFacetOfTypeAction.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/AddFacetOfTypeAction.java index 41f397ab005a..82a580cfdf52 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/AddFacetOfTypeAction.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/AddFacetOfTypeAction.java @@ -20,8 +20,8 @@ import com.intellij.facet.FacetType; import com.intellij.facet.FacetTypeId; import com.intellij.facet.FacetTypeRegistry; import com.intellij.facet.impl.ProjectFacetsConfigurator; -import com.intellij.facet.impl.invalid.InvalidFacetType; import com.intellij.ide.util.ChooseElementsDialog; +import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.DumbAwareAction; @@ -29,10 +29,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.ui.NamedConfigurable; -import com.intellij.util.PlatformIcons; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.ArrayList; @@ -44,16 +41,18 @@ import java.util.List; * @author nik */ class AddFacetOfTypeAction extends DumbAwareAction { - private final FacetStructureConfigurable myFacetStructureConfigurable; + private final FacetType myFacetType; + private final StructureConfigurableContext myContext; - AddFacetOfTypeAction(FacetStructureConfigurable facetStructureConfigurable) { - super("New Facet", null, PlatformIcons.ADD_ICON); - this.myFacetStructureConfigurable = facetStructureConfigurable; + AddFacetOfTypeAction(final FacetType type, final StructureConfigurableContext context) { + super(type.getPresentableName(), null, type.getIcon()); + myFacetType = type; + myContext = context; } @Override public void actionPerformed(AnActionEvent e) { - final FacetType type = getSelectedType(); + final FacetType type = myFacetType; if (type == null) return; final FacetTypeId underlyingFacetType = type.getUnderlyingFacetType(); @@ -66,10 +65,9 @@ class AddFacetOfTypeAction extends DumbAwareAction { } private void addSubFacet(FacetType type, FacetTypeId underlyingType) { - final StructureConfigurableContext context = myFacetStructureConfigurable.myContext; - final ProjectFacetsConfigurator facetsConfigurator = context.getModulesConfigurator().getFacetsConfigurator(); + final ProjectFacetsConfigurator facetsConfigurator = myContext.getModulesConfigurator().getFacetsConfigurator(); List suitableParents = new ArrayList(); - for (Module module : context.getModules()) { + for (Module module : myContext.getModules()) { if (type.isSuitableModuleType(module.getModuleType())) { suitableParents.addAll(facetsConfigurator.getFacetsByType(module, underlyingType)); } @@ -83,14 +81,14 @@ class AddFacetOfTypeAction extends DumbAwareAction { } } - final Project project = context.getProject(); + final Project project = myContext.getProject(); if (suitableParents.isEmpty()) { final String parentType = FacetTypeRegistry.getInstance().findFacetType(underlyingType).getPresentableName(); Messages.showErrorDialog(project, "No suitable parent " + parentType + " facets found", "Cannot Create " + type.getPresentableName() + " Facet"); return; } - ChooseParentFacetDialog dialog = new ChooseParentFacetDialog(project, suitableParents, "Select Parent Facet", null); + ChooseParentFacetDialog dialog = new ChooseParentFacetDialog(project, suitableParents); dialog.show(); final List chosen = dialog.getChosenElements(); if (!dialog.isOK() || chosen.size() != 1) return; @@ -101,9 +99,8 @@ class AddFacetOfTypeAction extends DumbAwareAction { } private void addFacetToModule(@NotNull FacetType type) { - final StructureConfigurableContext context = myFacetStructureConfigurable.myContext; - final ProjectFacetsConfigurator facetsConfigurator = context.getModulesConfigurator().getFacetsConfigurator(); - List suitableModules = new ArrayList(Arrays.asList(context.getModules())); + final ProjectFacetsConfigurator facetsConfigurator = myContext.getModulesConfigurator().getFacetsConfigurator(); + List suitableModules = new ArrayList(Arrays.asList(myContext.getModules())); final Iterator iterator = suitableModules.iterator(); while (iterator.hasNext()) { Module module = iterator.next(); @@ -111,7 +108,7 @@ class AddFacetOfTypeAction extends DumbAwareAction { iterator.remove(); } } - final Project project = context.getProject(); + final Project project = myContext.getProject(); if (suitableModules.isEmpty()) { Messages.showErrorDialog(project, "No suitable modules for " + type.getPresentableName() + " facet found.", "Cannot Create Facet"); return; @@ -129,27 +126,29 @@ class AddFacetOfTypeAction extends DumbAwareAction { ProjectStructureConfigurable.getInstance(project).select(facet, true); } - @Override - public void update(AnActionEvent e) { - final FacetType type = getSelectedType(); - e.getPresentation().setEnabled(myFacetStructureConfigurable.myContext.getModules().length > 0 && type != null && !(type instanceof InvalidFacetType)); + public static AnAction[] createAddFacetActions(FacetStructureConfigurable configurable) { + final List result = new ArrayList(); + final StructureConfigurableContext context = configurable.myContext; + for (FacetType type : FacetTypeRegistry.getInstance().getSortedFacetTypes()) { + if (hasSuitableModules(context, type)) { + result.add(new AddFacetOfTypeAction(type, context)); + } + } + return result.toArray(new AnAction[result.size()]); } - @Nullable - private FacetType getSelectedType() { - final NamedConfigurable configurable = myFacetStructureConfigurable.getSelectedConfugurable(); - if (configurable instanceof FacetTypeConfigurable) { - return ((FacetTypeConfigurable)configurable).getFacetType(); + private static boolean hasSuitableModules(StructureConfigurableContext context, FacetType type) { + for (Module module : context.getModules()) { + if (type.isSuitableModuleType(module.getModuleType())) { + return true; + } } - else if (configurable instanceof FacetConfigurable) { - return ((FacetConfigurable)configurable).getEditableObject().getType(); - } - return null; + return false; } private static class ChooseParentFacetDialog extends ChooseElementsDialog { - private ChooseParentFacetDialog(Project project, List items, String title, String description) { - super(project, items, title, description, true); + private ChooseParentFacetDialog(Project project, List items) { + super(project, items, "Select Parent Facet", null, true); myChooser.setSingleSelectionMode(); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java index f8b9ec7d8df7..d39147b99ba8 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java @@ -36,6 +36,8 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStr import com.intellij.openapi.ui.DetailsComponent; import com.intellij.openapi.ui.NamedConfigurable; import com.intellij.openapi.util.IconLoader; +import com.intellij.util.ui.tree.TreeUtil; +import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,6 +54,7 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable { private final ModuleManager myModuleManager; private final Map, FacetTypeEditor> myFacetTypeEditors = new HashMap, FacetTypeEditor>(); private MultipleFacetSettingsEditor myCurrentMultipleSettingsEditor; + @NonNls private static final String NO_FRAMEWORKS_NODE = "No facets are configured"; public FacetStructureConfigurable(final Project project, ModuleManager moduleManager) { super(project); @@ -80,15 +83,20 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable { protected void loadTree() { myTree.setRootVisible(false); myTree.setShowsRootHandles(false); + boolean hasFacetTypeNodes = false; for (FacetType facetType : FacetTypeRegistry.getInstance().getFacetTypes()) { - final FacetTypeEditor editor = getOrCreateFacetTypeEditor(facetType); - if (editor.isVisible() || ProjectFacetManager.getInstance(myProject).hasFacets(facetType.getId())) { + if (ProjectFacetManager.getInstance(myProject).hasFacets(facetType.getId())) { + hasFacetTypeNodes = true; addFacetTypeNode(facetType); } } if (!InvalidFacetManager.getInstance(myProject).getInvalidFacets().isEmpty()) { + hasFacetTypeNodes = true; addFacetTypeNode(InvalidFacetType.getInstance()); } + if (!hasFacetTypeNodes) { + addNode(new MyNode(new TextConfigurable(NO_FRAMEWORKS_NODE, NO_FRAMEWORKS_NODE, "Facets", "Press '+' button to add a new facet", null, null)), myRoot); + } addNode(new MyNode(new FrameworkDetectionConfigurable(myProject)), myRoot); } @@ -108,6 +116,11 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable { } private MyNode addFacetTypeNode(FacetType facetType) { + final MyNode noFrameworksNode = findNodeByObject(myRoot, NO_FRAMEWORKS_NODE); + if (noFrameworksNode != null) { + removePaths(TreeUtil.getPathFromRoot(noFrameworksNode)); + } + FacetTypeConfigurable facetTypeConfigurable = new FacetTypeConfigurable(this, facetType); MyNode facetTypeNode = new MyNode(facetTypeConfigurable); addNode(facetTypeNode, myRoot); @@ -167,6 +180,7 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable { public void reset() { super.reset(); myFacetTypeEditors.clear(); + TreeUtil.expandAll(myTree); } @@ -202,7 +216,13 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable { @NotNull protected ArrayList createActions(final boolean fromPopup) { ArrayList actions = new ArrayList(); - actions.add(new AddFacetOfTypeAction(this)); + actions.add(new AbstractAddGroup("Add") { + @NotNull + @Override + public AnAction[] getChildren(@Nullable AnActionEvent e) { + return AddFacetOfTypeAction.createAddFacetActions(FacetStructureConfigurable.this); + } + }); if (fromPopup) { actions.add(new MyNavigateAction()); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetTypeConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetTypeConfigurable.java index 567290019169..88db4c5dfe01 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetTypeConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetTypeConfigurable.java @@ -58,10 +58,6 @@ public class FacetTypeConfigurable extends NamedConfigurable { return myFacetType.getIcon(); } - public FacetType getFacetType() { - return myFacetType; - } - public String getHelpTopic() { final FacetTypeEditor editor = myFacetStructureConfigurable.getFacetTypeEditor(myFacetType); return editor != null ? editor.getHelpTopic() : null; diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetsTreeCellRenderer.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetsTreeCellRenderer.java index 5b89b3904593..deea9427c3b4 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetsTreeCellRenderer.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetsTreeCellRenderer.java @@ -54,7 +54,7 @@ public class FacetsTreeCellRenderer extends GroupedElementsRenderer.Tree impleme final NamedConfigurable configurable = node.getConfigurable(); if (configurable != null) { final Icon icon = configurable.getIcon(expanded); - final boolean showSeparator = icon == null; + final boolean showSeparator = configurable instanceof FrameworkDetectionConfigurable; int width = -1; if (showSeparator) { final int treeWidth = tree.getSize().width; diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java index 17a90b1d4328..abc1e910a79d 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java @@ -19,7 +19,7 @@ package com.intellij.openapi.roots.ui.configuration.projectRoot; import com.intellij.CommonBundle; import com.intellij.facet.Facet; import com.intellij.facet.impl.ProjectFacetsConfigurator; -import com.intellij.facet.impl.ui.actions.AddFacetAction; +import com.intellij.facet.impl.ui.actions.AddFacetToModuleAction; import com.intellij.ide.IdeBundle; import com.intellij.ide.highlighter.ModuleFileType; import com.intellij.ide.projectView.impl.ModuleGroup; @@ -63,6 +63,7 @@ import com.intellij.openapi.wm.WindowManager; import com.intellij.ui.navigation.Place; import com.intellij.util.Consumer; import com.intellij.util.Function; +import com.intellij.util.PlatformIcons; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.tree.TreeUtil; import org.jetbrains.annotations.NonNls; @@ -234,7 +235,8 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple }, new Function() { public MyNode fun(final ModuleGroup moduleGroup) { - final NamedConfigurable moduleGroupConfigurable = new ModuleGroupConfigurable(moduleGroup); + final NamedConfigurable moduleGroupConfigurable = + createModuleGroupConfigurable(moduleGroup); return new MyNode(moduleGroupConfigurable, true); } }); @@ -281,7 +283,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple } }, new Function() { public MyNode fun(final ModuleGroup moduleGroup) { - final NamedConfigurable moduleGroupConfigurable = new ModuleGroupConfigurable(moduleGroup); + final NamedConfigurable moduleGroupConfigurable = createModuleGroupConfigurable(moduleGroup); return new MyNode(moduleGroupConfigurable, true); } }); @@ -536,6 +538,12 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple return myContext; } + private static TextConfigurable createModuleGroupConfigurable(final ModuleGroup moduleGroup) { + return new TextConfigurable(moduleGroup, moduleGroup.toString(), + ProjectBundle.message("module.group.banner.text", moduleGroup.toString()), + ProjectBundle.message("project.roots.module.groups.text"), + PlatformIcons.OPENED_MODULE_GROUP_ICON, PlatformIcons.CLOSED_MODULE_GROUP_ICON); + } private class MyDataProviderWrapper extends JPanel implements DataProvider { public MyDataProviderWrapper(final JComponent component) { @@ -639,7 +647,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple ArrayList result = new ArrayList(); result.add(module); - final AnAction[] facets = AddFacetAction.createAddFacetActions(myFacetEditorFacade, myProject); + final AnAction[] facets = AddFacetToModuleAction.createAddFacetActions(myFacetEditorFacade, myProject); if (facets.length > 0) { result.add(new Separator(ProjectBundle.message("add.group.facet.separator"))); ContainerUtil.addAll(result, facets); diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleGroupConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/TextConfigurable.java similarity index 59% rename from java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleGroupConfigurable.java rename to java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/TextConfigurable.java index a3fe20581f7f..f6c08deb3de2 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleGroupConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/TextConfigurable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 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. @@ -13,68 +13,44 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * Created by IntelliJ IDEA. - * User: Anna.Kozlova - * Date: 16-Jul-2006 - * Time: 16:52:27 - */ package com.intellij.openapi.roots.ui.configuration.projectRoot; -import com.intellij.ide.projectView.impl.ModuleGroup; import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.ui.NamedConfigurable; import com.intellij.openapi.ui.PanelWithText; -import com.intellij.util.PlatformIcons; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import javax.swing.*; -public class ModuleGroupConfigurable extends NamedConfigurable { - private final ModuleGroup myModuleGroup; +/** + * @author nik + */ +public class TextConfigurable extends NamedConfigurable { + private final T myObject; + private final String myBannerSlogan; + private final String myDisplayName; + private final Icon myOpenedIcon; + private final Icon myClosedIcon; + private final String myDescriptionText; - public ModuleGroupConfigurable(final ModuleGroup moduleGroup) { - myModuleGroup = moduleGroup; + public TextConfigurable(final T object, + final String displayName, + final String bannerSlogan, + final String descriptionText, + final Icon openedIcon, final Icon closedIcon) { + myDisplayName = displayName; + myBannerSlogan = bannerSlogan; + myDescriptionText = descriptionText; + myOpenedIcon = openedIcon; + myClosedIcon = closedIcon; + myObject = object; } public void setDisplayName(final String name) { //do nothing } - public ModuleGroup getEditableObject() { - return myModuleGroup; - } - - public String getBannerSlogan() { - return ProjectBundle.message("module.group.banner.text", myModuleGroup.toString()); - } - - public String getDisplayName() { - return myModuleGroup.toString(); - } - - public Icon getIcon() { - return PlatformIcons.OPENED_MODULE_GROUP_ICON; - } - - public Icon getIcon(final boolean open) { - return open ? PlatformIcons.OPENED_MODULE_GROUP_ICON : PlatformIcons.CLOSED_MODULE_GROUP_ICON; - } - - @Nullable - @NonNls - public String getHelpTopic() { - return null; - } - - - public JComponent createOptionsPanel() { - return new PanelWithText(ProjectBundle.message("project.roots.module.groups.text")); - } - public boolean isModified() { return false; } @@ -90,4 +66,34 @@ public class ModuleGroupConfigurable extends NamedConfigurable { public void disposeUIResources() { //do nothing } + + @Nullable + @NonNls + public String getHelpTopic() { + return null; + } + + public T getEditableObject() { + return myObject; + } + + public String getBannerSlogan() { + return myBannerSlogan; + } + + public String getDisplayName() { + return myDisplayName; + } + + public Icon getIcon() { + return myOpenedIcon; + } + + public Icon getIcon(final boolean open) { + return open ? myOpenedIcon : myClosedIcon; + } + + public JComponent createOptionsPanel() { + return new PanelWithText(myDescriptionText); + } } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java index e081d4d91286..6bba05fb03dd 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java @@ -16,7 +16,6 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.CodeInsightUtilBase; -import com.intellij.codeInsight.completion.impl.CompletionServiceImpl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -27,7 +26,6 @@ import com.intellij.openapi.util.Condition; import com.intellij.psi.*; import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.psi.search.PsiShortNamesCache; import com.intellij.psi.search.searches.AllClassesSearch; import com.intellij.util.Consumer; import com.intellij.util.IncorrectOperationException; @@ -153,7 +151,11 @@ public class AllClassesGetter { final GlobalSearchScope scope = filterByScope ? context.getContainingFile().getResolveScope() : GlobalSearchScope.allScope(project); final boolean pkgContext = JavaCompletionUtil.inSomePackage(context); - final Processor classProcessor = new Processor() { + AllClassesSearch.search(scope, project, new Condition() { + public boolean value(String s) { + return prefixMatcher.prefixMatches(s); + } + }).forEach(new Processor() { public boolean process(PsiClass psiClass) { assert psiClass != null; if (isSuitable(context, packagePrefix, qnames, psiClass, filterByScope, pkgContext)) { @@ -162,33 +164,7 @@ public class AllClassesGetter { } return true; } - }; - - PsiShortNamesCache shortNamesCache = JavaPsiFacade.getInstance(project).getShortNamesCache(); - - Set words = WordCompletionContributor.getAllWords(context, parameters.getOffset()); - words.add(prefixMatcher.getPrefix()); - for (String s : words) { - if (prefixMatcher.prefixMatches(s)) { - for (PsiClass wordMatch : shortNamesCache.getClassesByName(s, scope)) { - classProcessor.process(wordMatch); - } - } - } - - final CompletionProgressIndicator indicator = CompletionServiceImpl.getCompletionService().getCurrentCompletion(); - if (indicator != null) { - indicator.delayAllowingFocusedLookup(new Runnable() { - @Override - public void run() { - AllClassesSearch.search(scope, project, new Condition() { - public boolean value(String s) { - return prefixMatcher.prefixMatches(s); - } - }).forEach(classProcessor); - } - }); - } + }); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaBasicToClassNameDelegator.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaBasicToClassNameDelegator.java new file mode 100644 index 000000000000..daf464e94938 --- /dev/null +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaBasicToClassNameDelegator.java @@ -0,0 +1,58 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInsight.completion; + +import com.intellij.codeInsight.lookup.AutoCompletionPolicy; +import com.intellij.codeInsight.lookup.LookupElement; +import com.intellij.openapi.util.Ref; +import com.intellij.util.Consumer; + +/** + * @author peter + */ +public class JavaBasicToClassNameDelegator extends CompletionContributor { + + @Override + public void fillCompletionVariants(final CompletionParameters parameters, final CompletionResultSet result) { + if (parameters.getCompletionType() != CompletionType.BASIC || + parameters.getInvocationCount() != 1 || + !JavaCompletionContributor.mayStartClassName(result, false) || + !JavaCompletionContributor.isClassNamePossible(parameters.getPosition())) { + return; + } + + final Ref empty = Ref.create(true); + result.runRemainingContributors(parameters, new Consumer() { + public void consume(final CompletionResult lookupElement) { + empty.set(false); + result.passResult(lookupElement); + } + }); + + if (empty.get()) { + JavaClassNameCompletionContributor.addAllClasses(parameters, JavaCompletionSorting.addJavaSorting(parameters, result), new Consumer() { + @Override + public void consume(LookupElement element) { + JavaPsiClassReferenceElement classElement = element.as(JavaPsiClassReferenceElement.CLASS_CONDITION_KEY); + if (classElement != null) { + classElement.setAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE); + } + result.addElement(element); + } + }); + } + } +} diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java index c240ad91b64a..0f70a482fb5a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java @@ -270,16 +270,11 @@ public class JavaCompletionContributor extends CompletionContributor { final boolean isSwitchLabel = SWITCH_LABEL.accepts(position); final PsiFile originalFile = parameters.getOriginalFile(); - Set set = JavaCompletionUtil.processJavaReference(position, + for (LookupElement element : JavaCompletionUtil.processJavaReference(position, (PsiJavaReference)reference, new ElementExtractorFilter(filter), checkAccess, - result.getPrefixMatcher(), parameters); - PsiClass arrays = JavaPsiFacade.getInstance(position.getProject()).findClass(CommonClassNames.JAVA_UTIL_ARRAYS, position.getResolveScope()); - if (arrays != null && filter.isAcceptable(arrays, position) && isClassNamePossible(parameters.getPosition())) { - set.add(JavaClassNameCompletionContributor.createClassLookupItem(arrays, true)); - } - for (LookupElement element : set) { + result.getPrefixMatcher(), parameters)) { if (inheritors.alreadyProcessed(element)) { continue; } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberNameCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberNameCompletionContributor.java index bdfe1f25cd25..2f414eeedd4d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberNameCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberNameCompletionContributor.java @@ -102,7 +102,7 @@ public class JavaGlobalMemberNameCompletionContributor extends CompletionContrib @Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); - myHelper.renderElement(presentation, getAttribute(FORCE_QUALIFY) != null, PsiSubstitutor.EMPTY); + myHelper.renderElement(presentation, getAttribute(FORCE_QUALIFY) != null ? Boolean.TRUE : null, PsiSubstitutor.EMPTY); } @Override diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java index 89a928ecb034..5cbc97c19593 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java @@ -22,16 +22,14 @@ import com.intellij.openapi.util.Condition; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; import com.intellij.psi.filters.getters.ExpectedTypesGetter; +import com.intellij.psi.infos.MethodCandidateInfo; import com.intellij.psi.statistics.JavaStatisticsManager; import com.intellij.psi.statistics.StatisticsInfo; import com.intellij.psi.statistics.StatisticsManager; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; import com.intellij.psi.util.TypeConversionUtil; -import com.intellij.util.Consumer; -import com.intellij.util.ProcessingContext; -import com.intellij.util.Processor; -import com.intellij.util.SmartList; +import com.intellij.util.*; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -137,8 +135,13 @@ public class JavaInheritorsGetter extends CompletionProvider -1) { + final JavaResolveResult resolveResult = methodCallExpression.resolveMethodGenerics(); + return PsiUtil.getApplicabilityLevel((PsiMethod)resolveResult.getElement(), resolveResult.getSubstitutor(), types, PsiUtil.getLanguageLevel(originalPosition)) + != MethodCandidateInfo.ApplicabilityLevel.NOT_APPLICABLE; + } + } + return true; + } + + public static void processInheritors(final CompletionParameters parameters, final Collection expectedClassTypes, final PrefixMatcher matcher, final Consumer consumer) { //quick diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/BasicToClassNameDelegator.java b/java/java-impl/src/com/intellij/codeInsight/completion/XmlBasicToClassNameDelegator.java similarity index 88% rename from java/java-impl/src/com/intellij/codeInsight/completion/BasicToClassNameDelegator.java rename to java/java-impl/src/com/intellij/codeInsight/completion/XmlBasicToClassNameDelegator.java index 11fe1b25cc70..f5a864885480 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/BasicToClassNameDelegator.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/XmlBasicToClassNameDelegator.java @@ -24,16 +24,12 @@ import com.intellij.psi.PsiFile; /** * @author peter */ -public class BasicToClassNameDelegator extends AbstractBasicToClassNameDelegator { +public class XmlBasicToClassNameDelegator extends AbstractBasicToClassNameDelegator { @Override protected boolean isClassNameCompletionSupported(CompletionResultSet result, PsiFile file, PsiElement position) { if (!JavaCompletionContributor.mayStartClassName(result, false)) return false; - if (file.getLanguage() == StdLanguages.JAVA) { - return JavaCompletionContributor.isClassNamePossible(position); - } - return file.getLanguage().isKindOf(StdLanguages.XML); } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java index b4f141eb648f..1a6bcce36009 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java @@ -26,12 +26,15 @@ import com.intellij.codeInsight.navigation.ListBackgroundUpdaterTask; import com.intellij.ide.util.MethodCellRenderer; import com.intellij.ide.util.PsiClassListCellRenderer; import com.intellij.ide.util.PsiElementListCellRenderer; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbService; +import com.intellij.openapi.util.Computable; import com.intellij.psi.*; import com.intellij.psi.search.PsiElementProcessor; import com.intellij.psi.search.PsiElementProcessorAdapter; +import com.intellij.psi.search.SearchScope; import com.intellij.psi.search.searches.ClassInheritorsSearch; import com.intellij.psi.search.searches.OverridingMethodsSearch; import com.intellij.psi.util.PsiUtil; @@ -235,7 +238,12 @@ public class MarkerType { @Override public void run(@NotNull ProgressIndicator indicator) { super.run(indicator); - ClassInheritorsSearch.search(myClass, myClass.getUseScope(), true).forEach(new CommonProcessors.CollectProcessor() { + ClassInheritorsSearch.search(myClass, ApplicationManager.getApplication().runReadAction(new Computable() { + @Override + public SearchScope compute() { + return myClass.getUseScope(); + } + }), true).forEach(new CommonProcessors.CollectProcessor() { @Override public boolean process(final PsiClass o) { updateComponent(o, myRenderer.getComparator()); @@ -266,7 +274,7 @@ public class MarkerType { @Override public void run(@NotNull ProgressIndicator indicator) { super.run(indicator); - OverridingMethodsSearch.search(myMethod, myMethod.getUseScope(), true).forEach( + OverridingMethodsSearch.search(myMethod, true).forEach( new CommonProcessors.CollectProcessor() { @Override public boolean process(PsiMethod psiMethod) { diff --git a/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java b/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java index 31ebb67c8234..c30d115cba82 100644 --- a/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java +++ b/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java @@ -15,6 +15,8 @@ */ package com.intellij.ide; +import com.intellij.application.options.IndentOptionsEditor; +import com.intellij.application.options.JavaIndentOptionsEditor; import com.intellij.lang.Language; import com.intellij.lang.StdLanguages; import com.intellij.lang.java.JavaLanguage; @@ -79,7 +81,9 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett @Override public CommonCodeStyleSettings getDefaultCommonSettings() { - return new CommonCodeStyleSettings(JavaLanguage.INSTANCE); + CommonCodeStyleSettings settings = new CommonCodeStyleSettings(JavaLanguage.INSTANCE); + settings.initIndentOptions(); + return settings; } @Override @@ -87,6 +91,11 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett return false; } + @Override + public IndentOptionsEditor getIndentOptionsEditor() { + return new JavaIndentOptionsEditor(); + } + private static final String GENERAL_CODE_SAMPLE = "public class Foo {\n" + " public int[] X = new int[]{1, 3, 5 7, 9, 11};\n" + diff --git a/java/java-impl/src/com/intellij/psi/impl/search/JavaDirectInheritorsSearcher.java b/java/java-impl/src/com/intellij/psi/impl/search/JavaDirectInheritorsSearcher.java index 73593a3a7184..fbbd5bdaeaf5 100644 --- a/java/java-impl/src/com/intellij/psi/impl/search/JavaDirectInheritorsSearcher.java +++ b/java/java-impl/src/com/intellij/psi/impl/search/JavaDirectInheritorsSearcher.java @@ -67,7 +67,12 @@ public class JavaDirectInheritorsSearcher implements QueryExecutor() { + @Override + public String compute() { + return aClass.getName(); + } + }); if (StringUtil.isEmpty(searchKey)) { return true; } diff --git a/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java b/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java index cb88168724b0..025a154c8fb2 100644 --- a/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java +++ b/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java @@ -22,9 +22,10 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; import com.intellij.openapi.editor.impl.DocumentImpl; +import com.intellij.openapi.editor.impl.EditorHighlighterCache; +import com.intellij.psi.JspPsiUtil; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; -import com.intellij.psi.JspPsiUtil; import com.intellij.psi.impl.cache.impl.id.IdTableBuilding; import com.intellij.psi.impl.source.tree.StdTokenSets; import com.intellij.psi.jsp.JspFile; @@ -44,8 +45,7 @@ public class JspIndexPatternBuilder implements IndexPatternBuilder { EditorHighlighter cachedEditorHighlighter; boolean alreadyInitializedHighlighter = false; - if (document instanceof DocumentImpl && - (cachedEditorHighlighter = ((DocumentImpl)document).getEditorHighlighterForCachesBuilding()) != null && + if ((cachedEditorHighlighter = EditorHighlighterCache.getEditorHighlighterForCachesBuilding(document)) != null && IdTableBuilding.checkCanUseCachedEditorHighlighter(file.getText(), cachedEditorHighlighter) ) { highlighter = cachedEditorHighlighter; diff --git a/java/java-impl/src/com/intellij/slicer/SliceLeafAnalyzer.java b/java/java-impl/src/com/intellij/slicer/SliceLeafAnalyzer.java index 733c249da67d..dc36ddf99c8a 100644 --- a/java/java-impl/src/com/intellij/slicer/SliceLeafAnalyzer.java +++ b/java/java-impl/src/com/intellij/slicer/SliceLeafAnalyzer.java @@ -29,7 +29,7 @@ import com.intellij.openapi.util.Ref; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiJavaReference; import com.intellij.psi.PsiNamedElement; -import com.intellij.psi.WalkingState; +import com.intellij.util.WalkingState; import com.intellij.psi.impl.source.tree.SourceUtil; import com.intellij.util.NullableFunction; import com.intellij.util.PairProcessor; diff --git a/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java b/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java index 70cc0535c9c3..bf3d141a8d2f 100644 --- a/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java +++ b/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java @@ -30,6 +30,7 @@ import com.intellij.psi.*; import com.intellij.psi.util.PsiUtil; import com.intellij.util.NullableFunction; import com.intellij.util.PairProcessor; +import com.intellij.util.WalkingState; import com.intellij.util.containers.FactoryMap; import gnu.trove.THashMap; import gnu.trove.THashSet; diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java new file mode 100644 index 000000000000..a18195cbc50e --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java @@ -0,0 +1,9 @@ +class MyClass { + public void foo() { + MyDD d = new MyDD() { + } + } +} + +abstract class MyDD { +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses.java new file mode 100644 index 000000000000..546c59c4c63f --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses.java @@ -0,0 +1,8 @@ +class MyClass { + public void foo() { + MyDD d = new MyD + } +} + +abstract class MyDD { +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfInapplicableInference-out.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfInapplicableInference-out.java new file mode 100644 index 000000000000..a658060983f6 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfInapplicableInference-out.java @@ -0,0 +1,12 @@ +import java.util.ArrayList; + +public class CompletionWithPassToMethod { + + public static void main(String[] args) { + foo(new ArrayList()); + } + + + static void foo(ArrayList ll) { + } +} diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfInapplicableInference.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfInapplicableInference.java new file mode 100644 index 000000000000..4665f7a7612d --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfInapplicableInference.java @@ -0,0 +1,12 @@ +import java.util.ArrayList; + +public class CompletionWithPassToMethod { + + public static void main(String[] args) { + foo(new ArrayL); + } + + + static void foo(ArrayList ll) { + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java index 1668696059c3..9df55fdaa25f 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java @@ -4,7 +4,7 @@ import com.intellij.ide.DataManager; import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.editor.actionSystem.EditorActionManager; -import com.intellij.openapi.editor.ex.DocumentEx; +import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.testFramework.PlatformTestCase; /** @@ -29,6 +29,6 @@ public class GenerateJavadocTest extends CodeInsightTestCase { EditorActionManager actionManager = EditorActionManager.getInstance(); EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER); actionHandler.execute(myEditor, DataManager.getInstance().getDataContext()); - ((DocumentEx)myEditor.getDocument()).stripTrailingSpaces(false); + ((DocumentImpl)myEditor.getDocument()).stripTrailingSpaces(); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy index 2cf4238f1f49..12d209a155c2 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy @@ -2,7 +2,8 @@ package com.intellij.codeInsight.completion; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import com.intellij.codeInsight.CodeInsightSettings -import com.intellij.util.ArrayUtil; +import com.intellij.util.ArrayUtil +import com.intellij.codeInsight.lookup.LookupElementPresentation; /** * @author peter @@ -54,6 +55,24 @@ public class Foo { class Bar {{ Foo.abcfield }}""" } + public void testFieldNamePresentation() { + myFixture.addClass(""" +package foo; + +public class Foo { + public static int abcfield = 2 + static final int fieldThatsNotVisible = 3 +} +""") + myFixture.configureByText "a.java", "class Bar {{ abcf }}" + def element = myFixture.complete(CompletionType.CLASS_NAME)[0] + def presentation = new LookupElementPresentation() + element.renderElement(presentation) + assert 'Foo.abcfield' == presentation.itemText + assert ' (foo)' == presentation.tailText + assert 'int' == presentation.typeText + } + public void testQualifiedMethodName() throws Exception { myFixture.addClass(""" package foo; diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy index 146070fc692b..c5e754ab78c4 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy @@ -934,8 +934,9 @@ public class Bar { public void testArrays() { myFixture.configureByText "a.java", "class Foo {{ }}" - type 'Arrays' - assert myFixture.lookupElementStrings == ['Arrays', 'ArrayStoreException'] + type 'Arrays.' + myFixture.checkResult "class Foo {{ Arrays. }}" + assert !lookup } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java index 272408cedc6e..70c1ff827755 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java @@ -41,6 +41,14 @@ public class SmartType17CompletionTest extends LightFixtureCompletionTestCase { doTest(); } + public void testDiamondNotCollapsedInCaseOfAnonymousClasses() throws Exception { + doTest(); + } + + public void testDiamondNotCollapsedInCaseOfInapplicableInference() throws Exception { + doTest(); + } + public void testDiamondPresentation() { configureByFile("/" + getTestName(false) + ".java"); LookupElementPresentation presentation = new LookupElementPresentation(); diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/AbstractJavaFormatterTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/AbstractJavaFormatterTest.java index 6a3ec80568de..662b34b00e92 100644 --- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/AbstractJavaFormatterTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/AbstractJavaFormatterTest.java @@ -21,7 +21,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.EditorFactory; -import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.roots.LanguageLevelProjectExtension; @@ -200,7 +199,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { - ((DocumentEx)doc).stripTrailingSpaces(false); + ((DocumentImpl)doc).stripTrailingSpaces(); } }); } diff --git a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java index 77bc11669912..b772186338b7 100644 --- a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java +++ b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java @@ -72,10 +72,10 @@ public class ClassFilterEditor extends JPanel implements ComponentWithEmptyText myTable = new JBTable(); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); - add(scrollPane, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 3, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 6), 0, 0)); - add(myAddClassButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 4), 0, 0)); - add(myAddPatternButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 4), 0, 0)); - add(myRemoveButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 4), 0, 0)); + add(scrollPane, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 3, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 0, 4, 6), 0, 0)); + add(myAddClassButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0)); + add(myAddPatternButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0)); + add(myRemoveButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0)); myChooserFilter = classFilter; myProject = project; diff --git a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java index 0238f601e11b..5f3e20cfa075 100644 --- a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java @@ -32,6 +32,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.actionSystem.TypedAction; import com.intellij.openapi.editor.ex.DocumentEx; +import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; @@ -480,7 +481,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase { public void run() { getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting(); if (stripTrailingSpaces) { - ((DocumentEx)myEditor.getDocument()).stripTrailingSpaces(false); + ((DocumentImpl)myEditor.getDocument()).stripTrailingSpaces(); } PsiDocumentManager.getInstance(myProject).commitAllDocuments(); @@ -522,7 +523,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase { String newFileText1 = newFileText; if (stripTrailingSpaces) { Document document1 = EditorFactory.getInstance().createDocument(newFileText); - ((DocumentEx)document1).stripTrailingSpaces(false); + ((DocumentImpl)document1).stripTrailingSpaces(); newFileText1 = document1.getText(); } diff --git a/java/testFramework/testFramework-java.iml b/java/testFramework/testFramework-java.iml index 129c4b2f135a..edbdff617f45 100644 --- a/java/testFramework/testFramework-java.iml +++ b/java/testFramework/testFramework-java.iml @@ -20,6 +20,7 @@ + diff --git a/platform/core-api/core-api.iml b/platform/core-api/core-api.iml new file mode 100644 index 000000000000..86d00e0493ab --- /dev/null +++ b/platform/core-api/core-api.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/platform/platform-api/src/com/intellij/lang/Language.java b/platform/core-api/src/com/intellij/lang/Language.java similarity index 100% rename from platform/platform-api/src/com/intellij/lang/Language.java rename to platform/core-api/src/com/intellij/lang/Language.java diff --git a/platform/platform-api/src/com/intellij/lexer/Lexer.java b/platform/core-api/src/com/intellij/lexer/Lexer.java similarity index 100% rename from platform/platform-api/src/com/intellij/lexer/Lexer.java rename to platform/core-api/src/com/intellij/lexer/Lexer.java diff --git a/platform/platform-api/src/com/intellij/lexer/LexerPosition.java b/platform/core-api/src/com/intellij/lexer/LexerPosition.java similarity index 100% rename from platform/platform-api/src/com/intellij/lexer/LexerPosition.java rename to platform/core-api/src/com/intellij/lexer/LexerPosition.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/AccessToken.java b/platform/core-api/src/com/intellij/openapi/application/AccessToken.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/AccessToken.java rename to platform/core-api/src/com/intellij/openapi/application/AccessToken.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/Application.java b/platform/core-api/src/com/intellij/openapi/application/Application.java similarity index 99% rename from platform/platform-api/src/com/intellij/openapi/application/Application.java rename to platform/core-api/src/com/intellij/openapi/application/Application.java index e8ce3a3c5b7c..dfc60e440cc8 100644 --- a/platform/platform-api/src/com/intellij/openapi/application/Application.java +++ b/platform/core-api/src/com/intellij/openapi/application/Application.java @@ -331,4 +331,6 @@ public interface Application extends ComponentManager { * Returns lock used for write operations, should be closed in finally block */ AccessToken acquireWriteActionLock(@Nullable Class marker); + + boolean isInternal(); } diff --git a/platform/platform-api/src/com/intellij/openapi/application/ApplicationListener.java b/platform/core-api/src/com/intellij/openapi/application/ApplicationListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/ApplicationListener.java rename to platform/core-api/src/com/intellij/openapi/application/ApplicationListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/ApplicationManager.java b/platform/core-api/src/com/intellij/openapi/application/ApplicationManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/ApplicationManager.java rename to platform/core-api/src/com/intellij/openapi/application/ApplicationManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/BaseActionRunnable.java b/platform/core-api/src/com/intellij/openapi/application/BaseActionRunnable.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/BaseActionRunnable.java rename to platform/core-api/src/com/intellij/openapi/application/BaseActionRunnable.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/CachedSingletonsRegistry.java b/platform/core-api/src/com/intellij/openapi/application/CachedSingletonsRegistry.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/CachedSingletonsRegistry.java rename to platform/core-api/src/com/intellij/openapi/application/CachedSingletonsRegistry.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/ModalityInvokator.java b/platform/core-api/src/com/intellij/openapi/application/ModalityInvokator.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/ModalityInvokator.java rename to platform/core-api/src/com/intellij/openapi/application/ModalityInvokator.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/ModalityState.java b/platform/core-api/src/com/intellij/openapi/application/ModalityState.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/ModalityState.java rename to platform/core-api/src/com/intellij/openapi/application/ModalityState.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/Result.java b/platform/core-api/src/com/intellij/openapi/application/Result.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/Result.java rename to platform/core-api/src/com/intellij/openapi/application/Result.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/RunResult.java b/platform/core-api/src/com/intellij/openapi/application/RunResult.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/RunResult.java rename to platform/core-api/src/com/intellij/openapi/application/RunResult.java diff --git a/platform/platform-api/src/com/intellij/openapi/application/WriteAction.java b/platform/core-api/src/com/intellij/openapi/application/WriteAction.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/application/WriteAction.java rename to platform/core-api/src/com/intellij/openapi/application/WriteAction.java diff --git a/platform/platform-api/src/com/intellij/openapi/command/CommandEvent.java b/platform/core-api/src/com/intellij/openapi/command/CommandEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/command/CommandEvent.java rename to platform/core-api/src/com/intellij/openapi/command/CommandEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/command/CommandListener.java b/platform/core-api/src/com/intellij/openapi/command/CommandListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/command/CommandListener.java rename to platform/core-api/src/com/intellij/openapi/command/CommandListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/command/CommandProcessor.java b/platform/core-api/src/com/intellij/openapi/command/CommandProcessor.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/command/CommandProcessor.java rename to platform/core-api/src/com/intellij/openapi/command/CommandProcessor.java diff --git a/platform/platform-api/src/com/intellij/openapi/command/UndoConfirmationPolicy.java b/platform/core-api/src/com/intellij/openapi/command/UndoConfirmationPolicy.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/command/UndoConfirmationPolicy.java rename to platform/core-api/src/com/intellij/openapi/command/UndoConfirmationPolicy.java diff --git a/platform/platform-api/src/com/intellij/openapi/components/BaseComponent.java b/platform/core-api/src/com/intellij/openapi/components/BaseComponent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/components/BaseComponent.java rename to platform/core-api/src/com/intellij/openapi/components/BaseComponent.java diff --git a/platform/platform-api/src/com/intellij/openapi/components/ComponentManager.java b/platform/core-api/src/com/intellij/openapi/components/ComponentManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/components/ComponentManager.java rename to platform/core-api/src/com/intellij/openapi/components/ComponentManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/components/NamedComponent.java b/platform/core-api/src/com/intellij/openapi/components/NamedComponent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/components/NamedComponent.java rename to platform/core-api/src/com/intellij/openapi/components/NamedComponent.java diff --git a/platform/platform-api/src/com/intellij/openapi/components/ServiceManager.java b/platform/core-api/src/com/intellij/openapi/components/ServiceManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/components/ServiceManager.java rename to platform/core-api/src/com/intellij/openapi/components/ServiceManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/Document.java b/platform/core-api/src/com/intellij/openapi/editor/Document.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/Document.java rename to platform/core-api/src/com/intellij/openapi/editor/Document.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/DocumentRunnable.java b/platform/core-api/src/com/intellij/openapi/editor/DocumentRunnable.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/DocumentRunnable.java rename to platform/core-api/src/com/intellij/openapi/editor/DocumentRunnable.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/EditorBundle.java b/platform/core-api/src/com/intellij/openapi/editor/EditorBundle.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/EditorBundle.java rename to platform/core-api/src/com/intellij/openapi/editor/EditorBundle.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/RangeMarker.java b/platform/core-api/src/com/intellij/openapi/editor/RangeMarker.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/RangeMarker.java rename to platform/core-api/src/com/intellij/openapi/editor/RangeMarker.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/ReadOnlyFragmentModificationException.java b/platform/core-api/src/com/intellij/openapi/editor/ReadOnlyFragmentModificationException.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/ReadOnlyFragmentModificationException.java rename to platform/core-api/src/com/intellij/openapi/editor/ReadOnlyFragmentModificationException.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/ReadOnlyModificationException.java b/platform/core-api/src/com/intellij/openapi/editor/ReadOnlyModificationException.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/ReadOnlyModificationException.java rename to platform/core-api/src/com/intellij/openapi/editor/ReadOnlyModificationException.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/TextChange.java b/platform/core-api/src/com/intellij/openapi/editor/TextChange.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/TextChange.java rename to platform/core-api/src/com/intellij/openapi/editor/TextChange.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/DocCommandGroupId.java b/platform/core-api/src/com/intellij/openapi/editor/actionSystem/DocCommandGroupId.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/actionSystem/DocCommandGroupId.java rename to platform/core-api/src/com/intellij/openapi/editor/actionSystem/DocCommandGroupId.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/ReadonlyFragmentModificationHandler.java b/platform/core-api/src/com/intellij/openapi/editor/actionSystem/ReadonlyFragmentModificationHandler.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/actionSystem/ReadonlyFragmentModificationHandler.java rename to platform/core-api/src/com/intellij/openapi/editor/actionSystem/ReadonlyFragmentModificationHandler.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/event/DocumentEvent.java b/platform/core-api/src/com/intellij/openapi/editor/event/DocumentEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/event/DocumentEvent.java rename to platform/core-api/src/com/intellij/openapi/editor/event/DocumentEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/editor/event/DocumentListener.java b/platform/core-api/src/com/intellij/openapi/editor/event/DocumentListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/editor/event/DocumentListener.java rename to platform/core-api/src/com/intellij/openapi/editor/event/DocumentListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/ExactFileNameMatcher.java b/platform/core-api/src/com/intellij/openapi/fileTypes/ExactFileNameMatcher.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/ExactFileNameMatcher.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/ExactFileNameMatcher.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/ExtensionFileNameMatcher.java b/platform/core-api/src/com/intellij/openapi/fileTypes/ExtensionFileNameMatcher.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/ExtensionFileNameMatcher.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/ExtensionFileNameMatcher.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileNameMatcher.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileNameMatcher.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/FileNameMatcher.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/FileNameMatcher.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileType.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/FileType.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/FileType.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeEvent.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeEvent.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeListener.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeListener.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypes.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypes.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypes.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/FileTypes.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/MockFileTypeManager.java b/platform/core-api/src/com/intellij/openapi/fileTypes/MockFileTypeManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/MockFileTypeManager.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/MockFileTypeManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/MockLanguageFileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/MockLanguageFileType.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/MockLanguageFileType.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/MockLanguageFileType.java diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java similarity index 93% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java index 107e29a0ebd4..8ded6faed7b1 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.fileTypes; -import com.intellij.ide.IdeBundle; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; @@ -35,7 +34,7 @@ public class UnknownFileType implements FileType { @NotNull public String getDescription() { - return IdeBundle.message("filetype.description.unknown"); + return "UNKNOWN"; } @NotNull diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/WildcardFileNameMatcher.java b/platform/core-api/src/com/intellij/openapi/fileTypes/WildcardFileNameMatcher.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/WildcardFileNameMatcher.java rename to platform/core-api/src/com/intellij/openapi/fileTypes/WildcardFileNameMatcher.java diff --git a/platform/platform-api/src/com/intellij/openapi/options/Scheme.java b/platform/core-api/src/com/intellij/openapi/options/Scheme.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/options/Scheme.java rename to platform/core-api/src/com/intellij/openapi/options/Scheme.java diff --git a/platform/platform-api/src/com/intellij/openapi/project/Project.java b/platform/core-api/src/com/intellij/openapi/project/Project.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/project/Project.java rename to platform/core-api/src/com/intellij/openapi/project/Project.java diff --git a/platform/platform-api/src/com/intellij/openapi/util/ActionCallback.java b/platform/core-api/src/com/intellij/openapi/util/ActionCallback.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/util/ActionCallback.java rename to platform/core-api/src/com/intellij/openapi/util/ActionCallback.java diff --git a/platform/platform-api/src/com/intellij/openapi/util/ExecutionCallback.java b/platform/core-api/src/com/intellij/openapi/util/ExecutionCallback.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/util/ExecutionCallback.java rename to platform/core-api/src/com/intellij/openapi/util/ExecutionCallback.java diff --git a/platform/platform-api/src/com/intellij/openapi/util/ModificationTracker.java b/platform/core-api/src/com/intellij/openapi/util/ModificationTracker.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/util/ModificationTracker.java rename to platform/core-api/src/com/intellij/openapi/util/ModificationTracker.java diff --git a/platform/platform-api/src/com/intellij/openapi/util/SimpleTimer.java b/platform/core-api/src/com/intellij/openapi/util/SimpleTimer.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/util/SimpleTimer.java rename to platform/core-api/src/com/intellij/openapi/util/SimpleTimer.java diff --git a/platform/platform-api/src/com/intellij/openapi/util/SimpleTimerTask.java b/platform/core-api/src/com/intellij/openapi/util/SimpleTimerTask.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/util/SimpleTimerTask.java rename to platform/core-api/src/com/intellij/openapi/util/SimpleTimerTask.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/CharsetToolkit.java b/platform/core-api/src/com/intellij/openapi/vfs/CharsetToolkit.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/CharsetToolkit.java rename to platform/core-api/src/com/intellij/openapi/vfs/CharsetToolkit.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/JarFileSystem.java b/platform/core-api/src/com/intellij/openapi/vfs/JarFileSystem.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/JarFileSystem.java rename to platform/core-api/src/com/intellij/openapi/vfs/JarFileSystem.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java b/platform/core-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java rename to platform/core-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java b/platform/core-api/src/com/intellij/openapi/vfs/LocalFileSystem.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java rename to platform/core-api/src/com/intellij/openapi/vfs/LocalFileSystem.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/ModificationAttemptEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/ModificationAttemptEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/ModificationAttemptEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/ModificationAttemptEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/ModificationAttemptListener.java b/platform/core-api/src/com/intellij/openapi/vfs/ModificationAttemptListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/ModificationAttemptListener.java rename to platform/core-api/src/com/intellij/openapi/vfs/ModificationAttemptListener.java diff --git a/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java b/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java new file mode 100644 index 000000000000..4e2c3d0add2d --- /dev/null +++ b/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.vfs; + +/** + * Marker interface for the requestor to label VFS events as coming from a save operation. + * + * @author yole + */ +public interface SavingRequestor { +} diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VfsBundle.java b/platform/core-api/src/com/intellij/openapi/vfs/VfsBundle.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VfsBundle.java rename to platform/core-api/src/com/intellij/openapi/vfs/VfsBundle.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtil.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java rename to platform/core-api/src/com/intellij/openapi/vfs/VfsUtil.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFile.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java similarity index 99% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFile.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java index daa91d1cfa60..467765ee78a5 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFile.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java @@ -23,8 +23,6 @@ import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.encoding.EncodingManager; -import com.intellij.openapi.vfs.newvfs.BulkFileListener; -import com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileCopyEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileCopyEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileCopyEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileCopyEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java similarity index 97% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java index 32d1e002e1ed..51923f4d1cb3 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.vfs; -import com.intellij.openapi.fileEditor.FileDocumentManager; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; @@ -125,6 +124,6 @@ public class VirtualFileEvent extends EventObject { * @return true if the VFS change described by the event is the save of a document, false otherwise. */ public boolean isFromSave() { - return myRequestor instanceof FileDocumentManager; + return myRequestor instanceof SavingRequestor; } } diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileFilter.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileFilter.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileFilter.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileFilter.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileListener.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileListener.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileManager.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileManager.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileManagerListener.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManagerListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileManagerListener.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManagerListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileMoveEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileMoveEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileMoveEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileMoveEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFilePropertyEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFilePropertyEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFilePropertyEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFilePropertyEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java rename to platform/core-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/encoding/EncodingManager.java b/platform/core-api/src/com/intellij/openapi/vfs/encoding/EncodingManager.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/encoding/EncodingManager.java rename to platform/core-api/src/com/intellij/openapi/vfs/encoding/EncodingManager.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java rename to platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java rename to platform/core-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFileSystem.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFileSystem.java similarity index 55% rename from platform/platform-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFileSystem.java rename to platform/core-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFileSystem.java index 008c44da4e99..958001c71769 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFileSystem.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFileSystem.java @@ -19,7 +19,6 @@ */ package com.intellij.openapi.vfs.newvfs; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileListener; import com.intellij.openapi.vfs.VirtualFileManager; @@ -28,88 +27,17 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; public abstract class NewVirtualFileSystem extends VirtualFileSystem implements FileSystemInterface { - @NonNls private static final String FILE_SEPARATORS = "/" + File.separator; private final Map myListenerWrappers = new HashMap(); public abstract boolean isCaseSensitive(); @Nullable - public VirtualFile findFileByPath(@NotNull @NonNls final String path) { - final String normalizedPath = normalize(path); - if (normalizedPath == null) return null; - final String basePath = extractRootPath(normalizedPath); - NewVirtualFile file = ManagingFS.getInstance().findRoot(basePath, this); - if (file == null || !file.exists()) return null; - - if (normalizedPath.length() < basePath.length()) { - return null; - } - for (String pathElement : StringUtil.tokenize(normalizedPath.substring(basePath.length()), FILE_SEPARATORS)) { - if (pathElement.length() == 0 || ".".equals(pathElement)) continue; - if ("..".equals(pathElement)) { - file = file.getParent(); - } - else { - file = file.findChild(pathElement); - } - - if (file == null) return null; - } - - return file; - } - - @Nullable - public VirtualFile findFileByPathIfCached(@NotNull @NonNls final String path) { - final String normalizedPath = normalize(path); - if (normalizedPath == null) return null; - final String basePath = extractRootPath(normalizedPath); - NewVirtualFile file = ManagingFS.getInstance().findRoot(basePath, this); - if (file == null || !file.exists()) return null; - - for (String pathElement : StringUtil.tokenize(normalizedPath.substring(basePath.length()), FILE_SEPARATORS)) { - if (pathElement.length() == 0 || ".".equals(pathElement)) continue; - if ("..".equals(pathElement)) { - file = file.getParent(); - } - else { - file = file.findChildIfCached(pathElement); - } - - if (file == null) return null; - } - - return file; - } - - @Nullable - public VirtualFile refreshAndFindFileByPath(@NotNull final String path) { - final String normalizedPath = normalize(path); - if (normalizedPath == null) return null; - final String basePath = extractRootPath(normalizedPath); - NewVirtualFile file = ManagingFS.getInstance().findRoot(basePath, this); - if (file == null || !file.exists()) return null; - - for (String pathElement : StringUtil.tokenize(normalizedPath.substring(basePath.length()), FILE_SEPARATORS)) { - if (pathElement.length() == 0 || ".".equals(pathElement)) continue; - if ("..".equals(pathElement)) { - file = file.getParent(); - } - else { - file = file.refreshAndFindChild(pathElement); - } - - if (file == null) return null; - } - - return file; - } + public abstract VirtualFile findFileByPathIfCached(@NotNull @NonNls final String path); @Nullable protected String normalize(final String path) { @@ -120,10 +48,6 @@ public abstract class NewVirtualFileSystem extends VirtualFileSystem implements refresh(asynchronous); } - public void refresh(final boolean asynchronous) { - RefreshQueue.getInstance().refresh(asynchronous, true, null, ManagingFS.getInstance().getRoots(this)); - } - public boolean isReadOnly() { return true; } diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java rename to platform/core-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java rename to platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java diff --git a/platform/platform-api/src/com/intellij/psi/tree/IElementType.java b/platform/core-api/src/com/intellij/psi/tree/IElementType.java similarity index 100% rename from platform/platform-api/src/com/intellij/psi/tree/IElementType.java rename to platform/core-api/src/com/intellij/psi/tree/IElementType.java diff --git a/platform/platform-api/src/com/intellij/ui/InvokeUtil.java b/platform/core-api/src/com/intellij/ui/InvokeUtil.java similarity index 100% rename from platform/platform-api/src/com/intellij/ui/InvokeUtil.java rename to platform/core-api/src/com/intellij/ui/InvokeUtil.java diff --git a/platform/platform-api/src/com/intellij/util/PathUtil.java b/platform/core-api/src/com/intellij/util/PathUtil.java similarity index 100% rename from platform/platform-api/src/com/intellij/util/PathUtil.java rename to platform/core-api/src/com/intellij/util/PathUtil.java diff --git a/platform/core-impl/core-impl.iml b/platform/core-impl/core-impl.iml new file mode 100644 index 000000000000..caff682b4a06 --- /dev/null +++ b/platform/core-impl/core-impl.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/DocumentBulkUpdateListener.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentBulkUpdateListener.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/DocumentBulkUpdateListener.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentBulkUpdateListener.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java similarity index 89% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java index dcf483585a12..03b7d51b4229 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java @@ -24,10 +24,6 @@ import org.jetbrains.annotations.NotNull; import java.util.List; public interface DocumentEx extends Document { - /** - * @return true if stripping was completed successfully, false if the document prevented stripping by e.g. caret being in the way - */ - boolean stripTrailingSpaces(boolean inChangedLinesOnly); void setStripTrailingSpacesEnabled(boolean isEnabled); @NotNull LineIterator createLineIterator(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditReadOnlyListener.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/EditReadOnlyListener.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/EditReadOnlyListener.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/EditReadOnlyListener.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/LineIterator.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/LineIterator.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/LineIterator.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/LineIterator.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/PrioritizedDocumentListener.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/PrioritizedDocumentListener.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/PrioritizedDocumentListener.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/PrioritizedDocumentListener.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/RangeMarkerEx.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/RangeMarkerEx.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/RangeMarkerEx.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/RangeMarkerEx.java diff --git a/platform/core-impl/src/com/intellij/openapi/editor/ex/SweepProcessor.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/SweepProcessor.java new file mode 100644 index 000000000000..8d89b8bab76d --- /dev/null +++ b/platform/core-impl/src/com/intellij/openapi/editor/ex/SweepProcessor.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.editor.ex; + +import java.util.Collection; + +public interface SweepProcessor { + boolean process(int offset, T interval, boolean atStart, Collection overlappingIntervals); +} diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/SegmentArray.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/util/SegmentArray.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/util/SegmentArray.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/util/SegmentArray.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/SegmentArrayWithData.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/util/SegmentArrayWithData.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/ex/util/SegmentArrayWithData.java rename to platform/core-impl/src/com/intellij/openapi/editor/ex/util/SegmentArrayWithData.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/BulkChangesMerger.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/BulkChangesMerger.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/BulkChangesMerger.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/BulkChangesMerger.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CharArray.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/CharArray.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/CharArray.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/CharArray.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java similarity index 84% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java index 541053eaed13..459a6a352aa9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java @@ -15,13 +15,9 @@ */ package com.intellij.openapi.editor.impl; -import com.intellij.ide.DataManager; import com.intellij.openapi.Disposable; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.*; @@ -30,12 +26,13 @@ import com.intellij.openapi.editor.actionSystem.ReadonlyFragmentModificationHand import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.ex.*; -import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; -import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.editor.impl.event.DocumentEventImpl; -import com.intellij.openapi.util.*; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.ShutDownTracker; +import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.util.LocalTimeCounter; import com.intellij.util.Processor; import com.intellij.util.containers.ContainerUtil; @@ -46,7 +43,6 @@ import org.jetbrains.annotations.TestOnly; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -76,7 +72,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { private boolean myEventsHandling = false; private final boolean myAssertWriteAccess; private volatile boolean myDoingBulkUpdate = false; - private static final Key> ourSomeEditorSyntaxHighlighter = Key.create("some editor highlighter"); private boolean myAcceptSlashR = false; private boolean myChangeInProgress; @@ -123,66 +118,73 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { public void setStripTrailingSpacesEnabled(boolean isEnabled) { isStripTrailingSpacesEnabled = isEnabled; } + + @TestOnly + public boolean stripTrailingSpaces() { + return stripTrailingSpaces(null, false, false, -1, -1); + } - public boolean stripTrailingSpaces(boolean inChangedLinesOnly) { + /** + * @return true if stripping was completed successfully, false if the document prevented stripping by e.g. caret being in the way + */ + public boolean stripTrailingSpaces(@Nullable final Project project, + boolean inChangedLinesOnly, + boolean virtualSpaceEnabled, + int caretLine, + int caretOffset) { if (!isStripTrailingSpacesEnabled) { return true; } - DataContext dataContext = DataManager.getInstance().getDataContext(IdeFocusManager.getGlobalInstance().getFocusOwner()); - Editor activeEditor = PlatformDataKeys.EDITOR.getData(dataContext); - - // when virtual space enabled, we can strip whitespace anywhere - boolean isVirtualSpaceEnabled = activeEditor == null || activeEditor.getSettings().isVirtualSpace(); - - VisualPosition visualCaret = activeEditor == null ? null : activeEditor.getCaretModel().getVisualPosition(); - int caretLine = activeEditor == null ? -1 : activeEditor.getCaretModel().getLogicalPosition().line; - boolean markAsNeedsStrippingLater = false; CharSequence text = myText.getCharArray(); - for (int line = 0; line < myLineSet.getLineCount(); line++) { - if (inChangedLinesOnly && !myLineSet.isModified(line)) continue; - int whiteSpaceStart = -1; - final int lineEnd = myLineSet.getLineEnd(line) - myLineSet.getSeparatorLength(line); - int lineStart = myLineSet.getLineStart(line); - for (int offset = lineEnd - 1; offset >= lineStart; offset--) { - char c = text.charAt(offset); - if (c != ' ' && c != '\t') { - break; - } - whiteSpaceStart = offset; - } - if (whiteSpaceStart == -1) continue; - if (!isVirtualSpaceEnabled && caretLine == line && activeEditor != null && whiteSpaceStart < activeEditor.getCaretModel().getOffset()) { - // mark this as a document that needs stripping later - // otherwise the caret would jump madly - markAsNeedsStrippingLater = true; - } - else { - final int finalStart = whiteSpaceStart; - ApplicationManager.getApplication().runWriteAction(new DocumentRunnable(this, activeEditor == null ? null : activeEditor.getProject()) { - public void run() { - CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { - public void run() { - deleteString(finalStart, lineEnd); - } - }); + RangeMarker caretMarker = caretOffset < 0 ? null : createRangeMarker(caretOffset, caretOffset); + try { + for (int line = 0; line < myLineSet.getLineCount(); line++) { + if (inChangedLinesOnly && !myLineSet.isModified(line)) continue; + int whiteSpaceStart = -1; + final int lineEnd = myLineSet.getLineEnd(line) - myLineSet.getSeparatorLength(line); + int lineStart = myLineSet.getLineStart(line); + for (int offset = lineEnd - 1; offset >= lineStart; offset--) { + char c = text.charAt(offset); + if (c != ' ' && c != '\t') { + break; } - }); - text = myText.getCharArray(); + whiteSpaceStart = offset; + } + if (whiteSpaceStart == -1) continue; + if (!virtualSpaceEnabled && caretLine == line && caretMarker != null && + caretMarker.getStartOffset() >= 0 && whiteSpaceStart < caretMarker.getStartOffset()) { + // mark this as a document that needs stripping later + // otherwise the caret would jump madly + markAsNeedsStrippingLater = true; + } + else { + final int finalStart = whiteSpaceStart; + ApplicationManager + .getApplication().runWriteAction(new DocumentRunnable(this, project) { + public void run() { + CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + public void run() { + deleteString(finalStart, lineEnd); + } + }); + } + }); + text = myText.getCharArray(); + } } } - - if (!ShutDownTracker.isShutdownHookRunning() && activeEditor != null) { - activeEditor.getCaretModel().moveToVisualPosition(visualCaret); + finally { + if (caretMarker != null) caretMarker.dispose(); } - return !markAsNeedsStrippingLater; + return markAsNeedsStrippingLater; } public void setReadOnly(boolean isReadOnly) { if (myIsReadOnly != isReadOnly) { myIsReadOnly = isReadOnly; - myPropertyChangeSupport.firePropertyChange(PROP_WRITABLE, !isReadOnly, isReadOnly); + myPropertyChangeSupport.firePropertyChange(Document.PROP_WRITABLE, !isReadOnly, isReadOnly); } } @@ -199,12 +201,10 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } public boolean removeRangeMarker(@NotNull RangeMarkerEx rangeMarker) { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); return myRangeMarkers.removeInterval(rangeMarker); } public void addRangeMarker(@NotNull RangeMarkerEx rangeMarker, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer) { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); myRangeMarkers.addInterval(rangeMarker, start, end, greedyToLeft, greedyToRight, layer); } @@ -285,7 +285,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { @NotNull public RangeMarker createRangeMarker(int startOffset, int endOffset, boolean surviveOnExternalChange) { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); if (!(0 <= startOffset && startOffset <= endOffset && endOffset <= getTextLength())) { LOG.error("Incorrect offsets: startOffset=" + startOffset + ", endOffset=" + endOffset + ", text length=" + getTextLength()); } @@ -295,7 +294,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } public long getModificationStamp() { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); return myModificationStamp; } @@ -611,7 +609,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { @NotNull public LineIterator createLineIterator() { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); return myLineSet.createIterator(); } @@ -624,7 +621,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } public final int getLineEndOffset(int line) { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); if (getTextLength() == 0 && line == 0) return 0; int result = myLineSet.getLineEnd(line) - getLineSeparatorLength(line); assert result >= 0; @@ -632,14 +628,12 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } public final int getLineSeparatorLength(int line) { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); int separatorLength = myLineSet.getSeparatorLength(line); assert separatorLength >= 0; return separatorLength; } public final int getLineCount() { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); int lineCount = myLineSet.getLineCount(); assert lineCount >= 0; return lineCount; @@ -658,7 +652,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } public void fireReadOnlyModificationAttempt() { - ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); for (EditReadOnlyListener listener : myReadOnlyListeners) { listener.readOnlyModificationAttempt(this); } @@ -721,24 +714,6 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } } - @Nullable - public EditorHighlighter getEditorHighlighterForCachesBuilding() { - final WeakReference editorHighlighterWeakReference = getUserData(ourSomeEditorSyntaxHighlighter); - final EditorHighlighter someEditorHighlighter = editorHighlighterWeakReference != null ? editorHighlighterWeakReference.get():null; - - if (someEditorHighlighter instanceof LexerEditorHighlighter && - ((LexerEditorHighlighter)someEditorHighlighter).isValid() - ) { - return someEditorHighlighter; - } - putUserData(ourSomeEditorSyntaxHighlighter, null); - return null; - } - - public void rememberEditorHighlighterForCachesOptimization(@NotNull final EditorHighlighter highlighter) { - putUserData(ourSomeEditorSyntaxHighlighter, new WeakReference(highlighter)); - } - private static class DocumentBulkUpdateListenerHolder { private static final DocumentBulkUpdateListener ourBulkChangePublisher = ApplicationManager.getApplication().getMessageBus().syncPublisher(DocumentBulkUpdateListener.TOPIC); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorDocumentPriorities.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/EditorDocumentPriorities.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorDocumentPriorities.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/EditorDocumentPriorities.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/Getable.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/Getable.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/Getable.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/Getable.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/Interval.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/Interval.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/Interval.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/Interval.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/IntervalTree.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTree.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/IntervalTree.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTree.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java similarity index 84% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java index 4791a78f9887..ebf120ebda2d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java @@ -17,10 +17,10 @@ package com.intellij.openapi.editor.impl; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.Trinity; -import com.intellij.psi.WalkingState; import com.intellij.util.IncorrectOperationException; import com.intellij.util.Processor; import com.intellij.util.SmartList; +import com.intellij.util.WalkingState; import com.intellij.util.containers.ContainerUtil; import gnu.trove.TLongHashSet; import org.jetbrains.annotations.NotNull; @@ -41,51 +41,53 @@ public abstract class IntervalTreeImpl extends RedBla private int keySize; // number of all intervals, counting all duplicates, some of them maybe gced protected final ReadWriteLock l = new ReentrantReadWriteLock(); - protected abstract int compareEqualStartIntervals(@NotNull IntervalNode i1, @NotNull IntervalNode i2); + protected abstract int compareEqualStartIntervals(@NotNull IntervalNode i1, @NotNull IntervalNode i2); private final ReferenceQueue myReferenceQueue = new ReferenceQueue(); private int deadReferenceCount; - protected class IntervalNode extends RedBlackTree.Node implements MutableInterval { + protected static class IntervalNode extends RedBlackTree.Node implements MutableInterval { private volatile int myStart; private volatile int myEnd; private volatile boolean isValid = true; - protected final List> intervals; + protected final List> intervals; protected int maxEnd; // max of all intervalEnd()s among all children. protected int delta; // delta of startOffset. getStartOffset() = myStartOffset + Sum of deltas up to root private volatile int modCount; // if it equals to the com.intellij.openapi.editor.impl.RedBlackTree.modCount then deltaUpToRoot can be used, otherwise it is expired private volatile int deltaUpToRoot; // sum of all deltas up to the root (including this node' delta). Has valid value only if modCount == IntervalTreeImpl.this.modCount private volatile boolean allDeltasUpAreNull; // true if all deltas up the tree (including this node) are 0. Has valid value only if modCount == IntervalTreeImpl.this.modCount + private final IntervalTreeImpl myIntervalTree; - public IntervalNode(@NotNull T key, int start, int end) { + public IntervalNode(IntervalTreeImpl intervalTree, @NotNull E key, int start, int end) { // maxEnd == 0 so to not disrupt existing maxes - intervals = new SmartList>(createGetable(key)); + this.myIntervalTree = intervalTree; myStart = start; myEnd = end; + intervals = new SmartList>(createGetable(key)); } @Override - public IntervalNode getLeft() { - return (IntervalNode)left; + public IntervalNode getLeft() { + return (IntervalNode)left; } @Override - public IntervalNode getRight() { - return (IntervalNode)right; + public IntervalNode getRight() { + return (IntervalNode)right; } @Override - public IntervalNode getParent() { - return (IntervalNode)parent; + public IntervalNode getParent() { + return (IntervalNode)parent; } @Override - public boolean processAliveKeys(@NotNull Processor processor) { + public boolean processAliveKeys(@NotNull Processor processor) { //noinspection ForLoopReplaceableByForEach for (int i = 0; i < intervals.size(); i++) { - Getable interval = intervals.get(i); - T key = interval.get(); + Getable interval = intervals.get(i); + E key = interval.get(); if (key != null && !processor.process(key)) return false; } return true; @@ -94,7 +96,7 @@ public abstract class IntervalTreeImpl extends RedBla public boolean hasAliveKey(boolean purgeDead) { boolean hasAliveInterval = false; for (int i = intervals.size() - 1; i >= 0; i--) { - Getable interval = intervals.get(i); + Getable interval = intervals.get(i); if (interval.get() != null) { hasAliveInterval = true; if (purgeDead) { @@ -105,7 +107,7 @@ public abstract class IntervalTreeImpl extends RedBla } } if (purgeDead) { - assertUnderWriteLock(); + myIntervalTree.assertUnderWriteLock(); removeIntervalInternal(i); } } @@ -114,16 +116,16 @@ public abstract class IntervalTreeImpl extends RedBla // removes interval and the node, if node became empty // returns true if node was removed - public boolean removeInterval(@NotNull T key) { - checkBelongsToTheTree(key, true); - assertUnderWriteLock(); + public boolean removeInterval(@NotNull E key) { + myIntervalTree.checkBelongsToTheTree(key, true); + myIntervalTree.assertUnderWriteLock(); for (int i = intervals.size() - 1; i >= 0; i--) { - Getable interval = intervals.get(i); - T t = interval.get(); + Getable interval = intervals.get(i); + E t = interval.get(); if (t == key) { removeIntervalInternal(i); if (intervals.isEmpty()) { - removeNode(this); + myIntervalTree.removeNode(this); return true; } return false; @@ -135,31 +137,31 @@ public abstract class IntervalTreeImpl extends RedBla public void removeIntervalInternal(int i) { intervals.remove(i); - assert keySize > 0 : keySize; - keySize--; + assert myIntervalTree.keySize > 0 : myIntervalTree.keySize; + myIntervalTree.keySize--; } - public void addInterval(@NotNull T interval) { - assertUnderWriteLock(); + public void addInterval(@NotNull E interval) { + myIntervalTree.assertUnderWriteLock(); intervals.add(createGetable(interval)); - keySize++; - setNode(interval, this); + myIntervalTree.keySize++; + myIntervalTree.setNode(interval, this); } - protected Getable createGetable(@NotNull T interval) { - return new WeakReferencedGetable(interval, myReferenceQueue); + protected Getable createGetable(@NotNull E interval) { + return new WeakReferencedGetable(interval, myIntervalTree.myReferenceQueue); } protected int computeDeltaUpToRoot() { if (!isValid()) return 0; - int treeModCount = IntervalTreeImpl.this.modCount; + int treeModCount = myIntervalTree.modCount; if (modCount == treeModCount) { return deltaUpToRoot; } IntervalNode node = this; int height = 0; long path = 0; // path to this node from the root; 0 bit means we turn left subtree, 1 bit means we turn right subtree - IntervalNode treeRoot = getRoot(); + IntervalNode treeRoot = myIntervalTree.getRoot(); int deltaUp = 0; boolean allDeltasAreNull = true; while (node != treeRoot) { @@ -244,8 +246,8 @@ public abstract class IntervalTreeImpl extends RedBla return myEnd; } - public IntervalTreeImpl getTree() { - return IntervalTreeImpl.this; + public IntervalTreeImpl getTree() { + return myIntervalTree; } } @@ -257,7 +259,7 @@ public abstract class IntervalTreeImpl extends RedBla return s.contains("Locked by thread"); } - private void pushDeltaFromRoot(IntervalNode node) { + private void pushDeltaFromRoot(IntervalNode node) { if (node != null) { if (node.allDeltasUpAreNull && node.isValid() && node.modCount == modCount) return; pushDeltaFromRoot(node.getParent()); @@ -266,11 +268,11 @@ public abstract class IntervalTreeImpl extends RedBla } @NotNull - protected abstract IntervalNode createNewNode(@NotNull T key, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer); - protected abstract IntervalNode lookupNode(@NotNull T key); + protected abstract IntervalNode createNewNode(@NotNull T key, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer); + protected abstract IntervalNode lookupNode(@NotNull T key); protected abstract void setNode(@NotNull T key, IntervalNode node); - private int compareNodes(@NotNull IntervalNode i1, int delta1, @NotNull IntervalNode i2, int delta2, @NotNull List invalid) { + private int compareNodes(@NotNull IntervalNode i1, int delta1, @NotNull IntervalNode i2, int delta2, @NotNull List> invalid) { if (!i2.hasAliveKey(false)) { invalid.add(i2); //gced } @@ -280,8 +282,8 @@ public abstract class IntervalTreeImpl extends RedBla return compareEqualStartIntervals(i1, i2); } - protected IntervalNode getRoot() { - return (IntervalNode)root; + protected IntervalNode getRoot() { + return (IntervalNode)root; } public boolean process(@NotNull Processor processor) { @@ -295,7 +297,7 @@ public abstract class IntervalTreeImpl extends RedBla } } - private boolean process(final IntervalNode root, final Processor processor, final int modCountBefore) { + private boolean process(final IntervalNode root, final Processor processor, final int modCountBefore) { if (root == null) return true; return WalkingState.processAll(root, INTERVAL_TREE_GUIDE_INSTANCE, new Processor() { @@ -319,7 +321,7 @@ public abstract class IntervalTreeImpl extends RedBla } } - private boolean processOverlappingWith(IntervalNode root, + private boolean processOverlappingWith(IntervalNode root, int start, int end, Processor processor, @@ -361,7 +363,7 @@ public abstract class IntervalTreeImpl extends RedBla l.readLock().unlock(); } } - private boolean processOverlappingWithOutside(IntervalNode root, + private boolean processOverlappingWithOutside(IntervalNode root, int start, int end, @NotNull Processor processor, @@ -401,7 +403,7 @@ public abstract class IntervalTreeImpl extends RedBla l.readLock().unlock(); } } - private boolean processContaining(IntervalNode root, + private boolean processContaining(IntervalNode root, int offset, Processor processor, int modCountBefore, @@ -434,7 +436,7 @@ public abstract class IntervalTreeImpl extends RedBla @NotNull Iterator overlappingIterator(final int startOffset, final int endOffset) { - final IntervalNode firstOverlap = findMinOverlappingWith(getRoot(), new TextRangeInterval(startOffset, endOffset), modCount, 0); + final IntervalNode firstOverlap = findMinOverlappingWith(getRoot(), new TextRangeInterval(startOffset, endOffset), modCount, 0); if (firstOverlap == null) { return ContainerUtil.emptyIterator(); } @@ -442,7 +444,7 @@ public abstract class IntervalTreeImpl extends RedBla final int firstOverlapStart = firstOverlap.intervalStart() + firstOverlapDelta; final int modCountBefore = modCount; return new Iterator() { - private IntervalNode currentNode = firstOverlap; + private IntervalNode currentNode = firstOverlap; private int deltaUpToRootExclusive = firstOverlapDelta-firstOverlap.delta; private int indexInCurrentList = 0; private T current; @@ -495,14 +497,14 @@ public abstract class IntervalTreeImpl extends RedBla } // next node in in-order traversal - private IntervalNode nextNode(@NotNull IntervalNode root) { + private IntervalNode nextNode(@NotNull IntervalNode root) { assert root.isValid(); int delta = deltaUpToRootExclusive + root.delta; int myMaxEnd = maxEndOf(root, deltaUpToRootExclusive); assert startOffset <= myMaxEnd; // try to go right down - IntervalNode right = root.getRight(); + IntervalNode right = root.getRight(); if (right != null) { int rightMaxEnd = maxEndOf(right, delta); if (startOffset <= rightMaxEnd) { @@ -518,7 +520,7 @@ public abstract class IntervalTreeImpl extends RedBla // go up while (true) { - IntervalNode parent = root.getParent(); + IntervalNode parent = root.getParent(); if (parent == null) return null; if (parent.intervalStart() + deltaUpToRootExclusive > endOffset) return null; // can't move right deltaUpToRootExclusive -= parent.delta; @@ -533,7 +535,7 @@ public abstract class IntervalTreeImpl extends RedBla }; } - private boolean overlaps(IntervalNode root, int startOffset, int endOffset, int deltaUpToRootExclusive) { + private boolean overlaps(IntervalNode root, int startOffset, int endOffset, int deltaUpToRootExclusive) { if (root == null) return false; int delta = root.delta + deltaUpToRootExclusive; int start = root.intervalStart() + delta; @@ -559,7 +561,7 @@ public abstract class IntervalTreeImpl extends RedBla return parent; } - protected IntervalNode findOrInsert(@NotNull IntervalNode node) { + protected IntervalNode findOrInsert(@NotNull IntervalNode node) { assertUnderWriteLock(); node.color = Color.RED; node.setParent(null); @@ -569,12 +571,12 @@ public abstract class IntervalTreeImpl extends RedBla node.setLeft(null); node.setRight(null); - List gced = new SmartList(); + List> gced = new SmartList>(); if (root == null) { root = node; } else { - IntervalNode current = getRoot(); + IntervalNode current = getRoot(); while (true) { pushDelta(current); int compResult = compareNodes(node, 0, current, 0, gced); @@ -612,11 +614,11 @@ public abstract class IntervalTreeImpl extends RedBla return node; } - private void deleteNodes(@NotNull List collectedAway) { + private void deleteNodes(@NotNull List> collectedAway) { if (collectedAway.isEmpty()) return; try { l.writeLock().lock(); - for (IntervalNode node : collectedAway) { + for (IntervalNode node : collectedAway) { removeNode(node); } } @@ -625,14 +627,14 @@ public abstract class IntervalTreeImpl extends RedBla } } - public IntervalTreeImpl.IntervalNode addInterval(@NotNull T interval, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer) { + public IntervalTreeImpl.IntervalNode addInterval(@NotNull T interval, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer) { try { l.writeLock().lock(); checkMax(true); processReferenceQueue(); modCount++; - IntervalNode newNode = createNewNode(interval, start, end, greedyToLeft, greedyToRight, layer); - IntervalNode insertedNode = findOrInsert(newNode); + IntervalNode newNode = createNewNode(interval, start, end, greedyToLeft, greedyToRight, layer); + IntervalNode insertedNode = findOrInsert(newNode); if (insertedNode == newNode) { setNode(interval, insertedNode); } @@ -674,7 +676,7 @@ public abstract class IntervalTreeImpl extends RedBla } // returns real (minStart, maxStart, maxEnd) - private Trinity checkMax(IntervalNode root, + private Trinity checkMax(IntervalNode root, int deltaUpToRootExclusive, boolean assertInvalid, Ref allValid, @@ -715,9 +717,9 @@ public abstract class IntervalTreeImpl extends RedBla if (assertInvalid) assert false : root; return Trinity.create(Math.min(minLeftStart, minRightStart), Math.max(maxLeftStart, maxRightStart), Math.max(maxRightEnd, maxLeftEnd)); } - IntervalNode parent = root.getParent(); + IntervalNode parent = root.getParent(); if (parent != null && assertInvalid && root.hasAliveKey(false)) { - int c = compareNodes(root, delta, parent, delta - root.delta, new SmartList()); + int c = compareNodes(root, delta, parent, delta - root.delta, new SmartList>()); assert c != 0; assert c < 0 && parent.getLeft() == root || c > 0 && parent.getRight() == root; } @@ -736,7 +738,7 @@ public abstract class IntervalTreeImpl extends RedBla @Override protected Node maximumNode(Node n) { - IntervalNode root = (IntervalNode)n; + IntervalNode root = (IntervalNode)n; pushDelta(root.getParent()); pushDelta(root); while (root.getRight() != null) { @@ -747,7 +749,7 @@ public abstract class IntervalTreeImpl extends RedBla } protected void checkBelongsToTheTree(T interval, boolean assertInvalid) { - IntervalNode root = lookupNode(interval); + IntervalNode root = lookupNode(interval); if (root == null) return; assert root.getTree() == this : root.getTree() +"; this: "+this; if (!VERIFY) return; @@ -783,7 +785,7 @@ public abstract class IntervalTreeImpl extends RedBla checkMax(true); processReferenceQueue(); - IntervalNode node = lookupNode(interval); + IntervalNode node = lookupNode(interval); if (node == null) return false; reportInvalidation(interval, "Explicit Dispose"); @@ -800,16 +802,16 @@ public abstract class IntervalTreeImpl extends RedBla } // run under write lock - void removeNode(@NotNull IntervalNode node) { + void removeNode(@NotNull IntervalNode node) { deleteNode(node); - IntervalNode parent = node.getParent(); + IntervalNode parent = node.getParent(); correctMaxUp(parent); } @Override protected void deleteNode(@NotNull Node n) { assertUnderWriteLock(); - IntervalNode node = (IntervalNode)n; + IntervalNode node = (IntervalNode)n; pushDeltaFromRoot(node); assertAllDeltasAreNull(node); super.deleteNode(n); @@ -824,9 +826,9 @@ public abstract class IntervalTreeImpl extends RedBla } // returns true if all deltas involved are still 0 - protected boolean pushDelta(IntervalNode root) { + protected boolean pushDelta(IntervalNode root) { if (root == null || !root.isValid()) return true; - IntervalNode parent = root.getParent(); + IntervalNode parent = root.getParent(); assertAllDeltasAreNull(parent); int delta = root.delta; root.modCount = 0; @@ -847,7 +849,7 @@ public abstract class IntervalTreeImpl extends RedBla } // returns true if all deltas involved are still 0 - private boolean incDelta(IntervalNode root, int delta) { + private boolean incDelta(IntervalNode root, int delta) { if (root == null) return true; if (root.isValid()) { int newDelta = root.changeDelta(delta); @@ -862,10 +864,10 @@ public abstract class IntervalTreeImpl extends RedBla } @Override - protected IntervalNode swapWithMaxPred(Node root, Node maxPred) { + protected IntervalNode swapWithMaxPred(Node root, Node maxPred) { checkMax(false); - IntervalNode a = (IntervalNode)root; - IntervalNode d = (IntervalNode)maxPred; + IntervalNode a = (IntervalNode)root; + IntervalNode d = (IntervalNode)maxPred; Color acolor = a.color; Color dcolor = d.color; assert !a.isValid() || a.delta == 0 : a.delta; @@ -889,13 +891,13 @@ public abstract class IntervalTreeImpl extends RedBla assert d.delta == 0 : d.delta; return a; } - private void swapNodes(IntervalNode n1, IntervalNode n2) { - IntervalNode l1 = n1.getLeft(); - IntervalNode r1 = n1.getRight(); - IntervalNode p1 = n1.getParent(); - IntervalNode l2 = n2.getLeft(); - IntervalNode r2 = n2.getRight(); - IntervalNode p2 = n2.getParent(); + private void swapNodes(IntervalNode n1, IntervalNode n2) { + IntervalNode l1 = n1.getLeft(); + IntervalNode r1 = n1.getRight(); + IntervalNode p1 = n1.getParent(); + IntervalNode l2 = n2.getLeft(); + IntervalNode r2 = n2.getRight(); + IntervalNode p2 = n2.getParent(); if (p1 != null) { if (p1.getLeft() == n1) p1.setLeft(n2); else p1.setRight(n2); @@ -923,7 +925,7 @@ public abstract class IntervalTreeImpl extends RedBla } // returns real max endOffset of all intervals below - private int maxEndOf(IntervalNode node, int deltaUpToRootExclusive) { + private int maxEndOf(IntervalNode node, int deltaUpToRootExclusive) { if (node == null) { return 0; } @@ -935,14 +937,14 @@ public abstract class IntervalTreeImpl extends RedBla } // max of n.left's maxend, n.right's maxend and its own interval endOffset - protected void correctMax(@NotNull IntervalNode node, int deltaUpToRoot) { + protected void correctMax(@NotNull IntervalNode node, int deltaUpToRoot) { if (!node.isValid()) return; int realMax = Math.max(Math.max(maxEndOf(node.getLeft(), deltaUpToRoot), maxEndOf(node.getRight(), deltaUpToRoot)), deltaUpToRoot + node.intervalEnd()); node.maxEnd = realMax - deltaUpToRoot; } - private void correctMaxUp(IntervalNode node) { + private void correctMaxUp(IntervalNode node) { int delta = node == null ? 0 : node.computeDeltaUpToRoot(); assert delta == 0 : delta; while (node != null) { @@ -959,9 +961,9 @@ public abstract class IntervalTreeImpl extends RedBla @Override protected void rotateRight(Node n) { checkMax(false); - IntervalNode node1 = (IntervalNode)n; - IntervalNode node2 = node1.getLeft(); - IntervalNode node3 = node1.getRight(); + IntervalNode node1 = (IntervalNode)n; + IntervalNode node2 = node1.getLeft(); + IntervalNode node3 = node1.getRight(); IntervalNode parent = node1.getParent(); int deltaUp = parent == null ? 0 : parent.computeDeltaUpToRoot(); @@ -985,9 +987,9 @@ public abstract class IntervalTreeImpl extends RedBla @Override protected void rotateLeft(Node n) { checkMax(false); - IntervalNode node1 = (IntervalNode)n; - IntervalNode node2 = node1.getLeft(); - IntervalNode node3 = node1.getRight(); + IntervalNode node1 = (IntervalNode)n; + IntervalNode node2 = node1.getLeft(); + IntervalNode node3 = node1.getRight(); IntervalNode parent = node1.getParent(); int deltaUp = parent == null ? 0 : parent.computeDeltaUpToRoot(); @@ -1011,9 +1013,9 @@ public abstract class IntervalTreeImpl extends RedBla @Override protected void replaceNode(@NotNull Node node, Node child) { - IntervalNode myNode = (IntervalNode)node; + IntervalNode myNode = (IntervalNode)node; pushDelta(myNode); - pushDelta((IntervalNode)child); + pushDelta((IntervalNode)child); super.replaceNode(node, child); if (child != null && myNode.isValid()) { @@ -1030,7 +1032,7 @@ public abstract class IntervalTreeImpl extends RedBla assert node.modCount != modCount || node.allDeltasUpAreNull; } - private IntervalNode findMinOverlappingWith(IntervalNode root, Interval interval, int modCountBefore, int deltaUpToRootExclusive) { + private IntervalNode findMinOverlappingWith(IntervalNode root, Interval interval, int modCountBefore, int deltaUpToRootExclusive) { if (root == null) { return null; } @@ -1041,7 +1043,7 @@ public abstract class IntervalTreeImpl extends RedBla return null; // right of the rightmost interval in the subtree } - IntervalNode inLeft = findMinOverlappingWith(root.getLeft(), interval, modCountBefore, delta); + IntervalNode inLeft = findMinOverlappingWith(root.getLeft(), interval, modCountBefore, delta); if (inLeft != null) return inLeft; int myStartOffset = root.intervalStart() + delta; int myEndOffset = root.intervalEnd() + delta; @@ -1060,7 +1062,7 @@ public abstract class IntervalTreeImpl extends RedBla try { l.writeLock().lock(); - IntervalNode node = lookupNode(interval); + IntervalNode node = lookupNode(interval); if (node == null) return; int before = size(); boolean nodeRemoved = node.removeInterval(interval); @@ -1097,7 +1099,7 @@ public abstract class IntervalTreeImpl extends RedBla private void purgeDeadNodes() { assertUnderWriteLock(); - List gced = new SmartList(); + List> gced = new SmartList>(); collectGced(getRoot(), gced); deleteNodes(gced); checkMax(true); @@ -1117,7 +1119,7 @@ public abstract class IntervalTreeImpl extends RedBla keySize = 0; } - private void collectGced(IntervalNode root, List gced) { + private void collectGced(IntervalNode root, List> gced) { if (root == null) return; if (!root.hasAliveKey(true)) gced.add(root); collectGced(root.getLeft(), gced); @@ -1126,7 +1128,7 @@ public abstract class IntervalTreeImpl extends RedBla private void printSorted() { printSorted(getRoot());} - private void printSorted(IntervalNode root) { + private void printSorted(IntervalNode root) { if (root == null) return; printSorted(root.getLeft()); System.out.println(root); @@ -1136,7 +1138,7 @@ public abstract class IntervalTreeImpl extends RedBla void reportInvalidation(T markerEx, Object reason) { } - private class IntervalTreeGuide implements WalkingState.TreeGuide { + private static class IntervalTreeGuide implements WalkingState.TreeGuide { @Override public IntervalNode getNextSibling(@NotNull IntervalNode element) { IntervalNode parent = element.getParent(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/LineIteratorImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/LineIteratorImpl.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/LineIteratorImpl.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/LineIteratorImpl.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/LineSet.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/LineSet.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/LineSet.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/LineSet.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/MutableInterval.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/MutableInterval.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/MutableInterval.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/MutableInterval.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarkerUtil.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarkerUtil.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarkerUtil.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarkerUtil.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java similarity index 96% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java index 2c0105f496c6..452b01d44d9f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java @@ -16,13 +16,12 @@ package com.intellij.openapi.editor.impl; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.event.DocumentEvent; -import com.intellij.openapi.editor.ex.MarkupModelEx; import com.intellij.openapi.editor.ex.PrioritizedDocumentListener; import com.intellij.openapi.editor.ex.RangeMarkerEx; +import com.intellij.openapi.editor.ex.SweepProcessor; import com.intellij.openapi.util.Segment; import com.intellij.util.Processor; import com.intellij.util.SmartList; @@ -36,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class RangeMarkerTree extends IntervalTreeImpl { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.RangeMarkerTree"); - private static final boolean DEBUG = LOG.isDebugEnabled() || ApplicationManager.getApplication().isUnitTestMode() || ApplicationManagerEx.getApplicationEx().isInternal(); + private static final boolean DEBUG = LOG.isDebugEnabled() || ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isInternal(); private final PrioritizedDocumentListener myListener; private final Document myDocument; @@ -59,7 +58,7 @@ public class RangeMarkerTree extends IntervalTreeImpl.IntervalNode i1, @NotNull IntervalTreeImpl.IntervalNode i2) { + protected int compareEqualStartIntervals(@NotNull IntervalTreeImpl.IntervalNode i1, @NotNull IntervalTreeImpl.IntervalNode i2) { RMNode o1 = (RMNode)i1; RMNode o2 = (RMNode)i2; boolean greedyL1 = o1.isGreedyToLeft(); @@ -151,12 +150,12 @@ public class RangeMarkerTree extends IntervalTreeImpl.IntervalNode { + public class RMNode extends IntervalTreeImpl.IntervalNode { private final boolean isExpandToLeft; private final boolean isExpandToRight; public RMNode(@NotNull T key, int start, int end, boolean greedyToLeft, boolean greedyToRight) { - super(key, start, end); + super(RangeMarkerTree.this, key, start, end); isExpandToLeft = greedyToLeft; isExpandToRight = greedyToRight; } @@ -297,7 +296,7 @@ public class RangeMarkerTree extends IntervalTreeImpl sweepProcessor) { + public boolean sweep(final int start, final int end, @NotNull final SweepProcessor sweepProcessor) { return sweep(new Generator() { @Override public boolean generate(Processor processor) { @@ -310,7 +309,7 @@ public class RangeMarkerTree extends IntervalTreeImpl processor); } - public static boolean sweep(@NotNull Generator generator, @NotNull final MarkupModelEx.SweepProcessor sweepProcessor) { + public static boolean sweep(@NotNull Generator generator, @NotNull final SweepProcessor sweepProcessor) { final Queue ends = new PriorityQueue(5, new Comparator() { public int compare(T o1, T o2) { return o1.getEndOffset() - o2.getEndOffset(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/StripedIDGenerator.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/StripedIDGenerator.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/StripedIDGenerator.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/StripedIDGenerator.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextRangeInterval.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/TextRangeInterval.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/TextRangeInterval.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/TextRangeInterval.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java similarity index 100% rename from platform/platform-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java rename to platform/core-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java diff --git a/platform/lang-api/src/com/intellij/facet/FacetTypeRegistry.java b/platform/lang-api/src/com/intellij/facet/FacetTypeRegistry.java index 1b069b998010..7884b7bad32b 100644 --- a/platform/lang-api/src/com/intellij/facet/FacetTypeRegistry.java +++ b/platform/lang-api/src/com/intellij/facet/FacetTypeRegistry.java @@ -42,6 +42,8 @@ public abstract class FacetTypeRegistry { public abstract FacetType[] getFacetTypes(); + public abstract FacetType[] getSortedFacetTypes(); + @Nullable public abstract FacetType findFacetType(String id); diff --git a/platform/lang-api/src/com/intellij/psi/PsiWalkingState.java b/platform/lang-api/src/com/intellij/psi/PsiWalkingState.java index cafc4e254c8a..dd8a75a76450 100644 --- a/platform/lang-api/src/com/intellij/psi/PsiWalkingState.java +++ b/platform/lang-api/src/com/intellij/psi/PsiWalkingState.java @@ -17,6 +17,7 @@ package com.intellij.psi; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.util.WalkingState; import org.jetbrains.annotations.NotNull; /** diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java index 1a47ad44e4cf..175cb35474c1 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java @@ -537,7 +537,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea IMPORT_LAYOUT_TABLE.addEntry(PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY); } } - importOldIndentOptions(element); + boolean oldOptionsImported = importOldIndentOptions(element); for (final CustomCodeStyleSettings settings : myCustomSettings.values()) { settings.readExternal(element); } @@ -563,22 +563,35 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea } } - copyOldIndentOptions("java", JAVA_INDENT_OPTIONS); - copyOldIndentOptions("jsp", JSP_INDENT_OPTIONS); - copyOldIndentOptions("xml", XML_INDENT_OPTIONS); - myCommonSettingsManager.readExternal(element); + + if (oldOptionsImported) { + copyOldIndentOptions("java", JAVA_INDENT_OPTIONS); + copyOldIndentOptions("jsp", JSP_INDENT_OPTIONS); + copyOldIndentOptions("xml", XML_INDENT_OPTIONS); + } } private void copyOldIndentOptions(@NonNls final String extension, final IndentOptions options) { final FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(extension); if (fileType != FileTypes.UNKNOWN && fileType != FileTypes.PLAIN_TEXT && !myAdditionalIndentOptions.containsKey(fileType) && fileType.getDefaultExtension().length() != 0) { registerAdditionalIndentOptions(fileType, options); + // + // Upgrade to version 11 + // + if (fileType instanceof LanguageFileType) { + Language lang = ((LanguageFileType)fileType).getLanguage(); + CommonCodeStyleSettings langSettings = myCommonSettingsManager.getCommonSettings(lang); + if (langSettings != this && langSettings.getIndentOptions() != null) { + langSettings.importOldIndentOptions(this); + } + } } } - private void importOldIndentOptions(@NonNls Element element) { + private boolean importOldIndentOptions(@NonNls Element element) { final List options = element.getChildren("option"); + boolean optionsImported = false; for (Object option1 : options) { @NonNls Element option = (Element)option1; @NonNls final String name = option.getAttributeValue("name"); @@ -588,6 +601,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea JSP_INDENT_OPTIONS.TAB_SIZE = value; XML_INDENT_OPTIONS.TAB_SIZE = value; OTHER_INDENT_OPTIONS.TAB_SIZE = value; + optionsImported = true; } else if ("INDENT_SIZE".equals(name)) { final int value = Integer.valueOf(option.getAttributeValue("value")).intValue(); @@ -595,6 +609,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea JSP_INDENT_OPTIONS.INDENT_SIZE = value; XML_INDENT_OPTIONS.INDENT_SIZE = value; OTHER_INDENT_OPTIONS.INDENT_SIZE = value; + optionsImported = true; } else if ("CONTINUATION_INDENT_SIZE".equals(name)) { final int value = Integer.valueOf(option.getAttributeValue("value")).intValue(); @@ -602,6 +617,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea JSP_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value; XML_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value; OTHER_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value; + optionsImported = true; } else if ("USE_TAB_CHARACTER".equals(name)) { final boolean value = Boolean.valueOf(option.getAttributeValue("value")).booleanValue(); @@ -609,6 +625,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea JSP_INDENT_OPTIONS.USE_TAB_CHARACTER = value; XML_INDENT_OPTIONS.USE_TAB_CHARACTER = value; OTHER_INDENT_OPTIONS.USE_TAB_CHARACTER = value; + optionsImported = true; } else if ("SMART_TABS".equals(name)) { final boolean value = Boolean.valueOf(option.getAttributeValue("value")).booleanValue(); @@ -616,11 +633,14 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea JSP_INDENT_OPTIONS.SMART_TABS = value; XML_INDENT_OPTIONS.SMART_TABS = value; OTHER_INDENT_OPTIONS.SMART_TABS = value; + optionsImported = true; } else if ("SPACE_AFTER_UNARY_OPERATOR".equals(name)) { final boolean value = Boolean.valueOf(option.getAttributeValue("value")).booleanValue(); SPACE_AROUND_UNARY_OPERATOR = value; + optionsImported = true; } } + return optionsImported; } public void writeExternal(Element element) throws WriteExternalException { diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java index 78961aae124e..97c2f1b132a6 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java @@ -53,7 +53,7 @@ public class CommonCodeStyleSettings { } void importOldIndentOptions(@NotNull CodeStyleSettings rootSettings) { - if (myFileType != null && myIndentOptions != null && !myIndentOptions.isFoundForLanguage()) { + if (myFileType != null && myIndentOptions != null) { if (getFileTypeIndentOptionsProvider() == null) { IndentOptions fileTypeIdentOptions = rootSettings.getAdditionalIndentOptions(myFileType); if (fileTypeIdentOptions != null) { @@ -822,9 +822,7 @@ public class CommonCodeStyleSettings { public int LABEL_INDENT_SIZE = 0; public boolean LABEL_INDENT_ABSOLUTE = false; public boolean USE_RELATIVE_INDENTS = false; - - private boolean myFoundForLanguage = false; - + private final static String INDENT_OPTIONS_TAG = "indentOptions"; public void readExternal(Element element) throws InvalidDataException { @@ -851,15 +849,10 @@ public class CommonCodeStyleSettings { public void deserialize(Element element) { Element indentOptionsElement = element.getChild(INDENT_OPTIONS_TAG); if (indentOptionsElement != null) { - myFoundForLanguage = true; XmlSerializer.deserializeInto(this, indentOptionsElement); } } - public boolean isFoundForLanguage() { - return myFoundForLanguage; - } - public Object clone() { try { return super.clone(); diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeCompletion.form b/platform/lang-impl/src/com/intellij/application/options/CodeCompletion.form index bc914ba1a65f..2506873a81ce 100644 --- a/platform/lang-impl/src/com/intellij/application/options/CodeCompletion.form +++ b/platform/lang-impl/src/com/intellij/application/options/CodeCompletion.form @@ -1,9 +1,9 @@ - + - + @@ -18,10 +18,10 @@ - + - + @@ -119,6 +119,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +