[workspace] convert to plugin

GitOrigin-RevId: c1682d99eeb8526db7176deade6dbcc97bfbfe8e
This commit is contained in:
Dmitry Avdeev
2024-06-20 17:36:46 +02:00
committed by intellij-monorepo-bot
parent 36367cddfe
commit 6f5ebf0d46
39 changed files with 2 additions and 1275 deletions

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WorkspaceSettings">
<project name="untitled" path="$PROJECT_DIR$/../untitled" />
<project name="untitled1" path="$PROJECT_DIR$/../untitled1" />
<option name="workspace" value="true" />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/untitled.iml" filepath="$PROJECT_DIR$/.idea/untitled.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/untitled1.iml" filepath="$PROJECT_DIR$/.idea/untitled1.iml" />
</modules>
</component>
</project>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="GENERAL_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../untitled" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="GENERAL_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../untitled1" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,62 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.workspace
import com.intellij.ide.DataManager
import com.intellij.ide.impl.HeadlessDataManager
import com.intellij.ide.projectView.impl.ProjectViewImpl
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode
import com.intellij.ide.util.treeView.AbstractTreeNode
import com.intellij.openapi.actionSystem.*
import com.intellij.projectView.BaseProjectViewTestCase
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.util.ui.tree.TreeUtil
import java.nio.file.Path
class WorkspaceProjectTreeStructureTest: BaseProjectViewTestCase() {
override fun getTestDirectoryName() = "workspace"
override fun getProjectDirOrFile(isDirectoryBasedProject: Boolean): Path {
return Path.of(testDataPath, testPath, testDirectoryName, "workspace")
}
override fun setUpModule() {
}
override fun setUp() {
super.setUp()
HeadlessDataManager.fallbackToProductionDataManager(testRootDisposable)
}
fun testStructure() {
val rootElement = myStructure.rootElement as AbstractTreeNode<*>
val workspace = myStructure.getChildElements(rootElement).filterIsInstance<PsiDirectoryNode>().first()
assertStructureEqual("Workspace: workspace\n" +
" Subproject: untitled\n" +
" HtmlFile:foo.html\n" +
" Subproject: untitled1\n" +
" HtmlFile:bar.html", workspace)
}
fun testActions() {
val projectView = ProjectViewImpl.getInstance(project) as ProjectViewImpl
val tree = projectView.currentProjectViewPane.tree
PlatformTestUtil.waitForPromise(TreeUtil.promiseExpandAll(tree))
tree.setSelectionRow(0)
val context = DataManager.getInstance().getDataContext(projectView.component)
assertTrue(isActionEnabled(context))
tree.setSelectionRow(1)
val context1 = DataManager.getInstance().getDataContext(projectView.component)
assertFalse(isActionEnabled(context1))
}
private fun isActionEnabled(context: DataContext): Boolean {
val action = ActionManager.getInstance().getAction("AddToWorkspace")
val presentation = Presentation()
val actionEvent = AnActionEvent.createFromDataContext(ActionPlaces.PROJECT_VIEW_POPUP, presentation, context)
action.update(actionEvent)
return presentation.isEnabled
}
}