Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
733a3bd9
Commit
733a3bd9
authored
9 years ago
by
Ekaterina Tuzova
Browse files
Options
Download
Email Patches
Plain Diff
cleaned up main menu for PyCharm Educational
parent
fb412d37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/edu/src/META-INF/PyCharmEduPlugin.xml
+0
-2
python/edu/src/META-INF/PyCharmEduPlugin.xml
python/edu/src/com/jetbrains/python/edu/PyCharmEduInitialConfigurator.java
+58
-2
...m/jetbrains/python/edu/PyCharmEduInitialConfigurator.java
with
58 additions
and
4 deletions
+58
-4
python/edu/src/META-INF/PyCharmEduPlugin.xml
+
0
-
2
View file @
733a3bd9
...
...
@@ -32,8 +32,6 @@
</extensions>
<actions>
<group
overrides=
"true"
class=
"com.intellij.openapi.actionSystem.EmptyActionGroup"
id=
"ToolsMenu"
/>
<group
overrides=
"true"
class=
"com.intellij.openapi.actionSystem.EmptyActionGroup"
id=
"PrintExportGroup"
/>
<group
overrides=
"true"
id=
"FileMainSettingsGroup"
>
<reference
id=
"ShowSettings"
/>
...
...
This diff is collapsed.
Click to expand it.
python/edu/src/com/jetbrains/python/edu/PyCharmEduInitialConfigurator.java
+
58
-
2
View file @
733a3bd9
...
...
@@ -25,6 +25,9 @@ import com.intellij.ide.SelectInTarget;
import
com.intellij.ide.projectView.impl.AbstractProjectViewPane
;
import
com.intellij.ide.scopeView.ScopeViewPane
;
import
com.intellij.ide.ui.UISettings
;
import
com.intellij.ide.ui.customization.ActionUrl
;
import
com.intellij.ide.ui.customization.CustomActionsSchema
;
import
com.intellij.ide.ui.customization.CustomizationUtil
;
import
com.intellij.ide.util.PropertiesComponent
;
import
com.intellij.ide.util.TipAndTrickBean
;
import
com.intellij.notification.EventLog
;
...
...
@@ -37,6 +40,7 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
import
com.intellij.openapi.keymap.Keymap
;
import
com.intellij.openapi.keymap.ex.KeymapManagerEx
;
import
com.intellij.openapi.keymap.impl.KeymapImpl
;
import
com.intellij.openapi.keymap.impl.ui.Group
;
import
com.intellij.openapi.project.*
;
import
com.intellij.openapi.project.ex.ProjectManagerEx
;
import
com.intellij.openapi.startup.StartupManager
;
...
...
@@ -48,13 +52,20 @@ import com.intellij.platform.DirectoryProjectConfigurator;
import
com.intellij.platform.PlatformProjectViewOpener
;
import
com.intellij.psi.codeStyle.CodeStyleSettings
;
import
com.intellij.psi.codeStyle.CodeStyleSettingsManager
;
import
com.intellij.ui.treeStructure.Tree
;
import
com.intellij.util.containers.ContainerUtil
;
import
com.intellij.util.messages.MessageBus
;
import
com.intellij.util.ui.tree.TreeUtil
;
import
com.jetbrains.python.PythonLanguage
;
import
com.jetbrains.python.codeInsight.PyCodeInsightSettings
;
import
org.jetbrains.annotations.NonNls
;
import
org.jetbrains.annotations.NotNull
;
import
javax.swing.*
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultTreeModel
;
import
javax.swing.tree.TreeNode
;
import
javax.swing.tree.TreePath
;
import
java.util.Set
;
/**
...
...
@@ -65,6 +76,7 @@ public class PyCharmEduInitialConfigurator {
@NonNls
private
static
final
String
DISPLAYED_PROPERTY
=
"PyCharmEDU.initialConfigurationShown"
;
@NonNls
private
static
final
String
CONFIGURED
=
"PyCharmEDU.InitialConfiguration"
;
@NonNls
private
static
final
String
CONFIGURED_V1
=
"PyCharmEDU.InitialConfiguration.V1"
;
private
static
final
Set
<
String
>
UNRELATED_TIPS
=
Sets
.
newHashSet
(
"LiveTemplatesDjango.html"
,
"TerminalOpen.html"
,
"Terminal.html"
,
"ConfiguringTerminal.html"
);
...
...
@@ -84,15 +96,22 @@ public class PyCharmEduInitialConfigurator {
final
PropertiesComponent
propertiesComponent
,
FileTypeManager
fileTypeManager
,
final
ProjectManagerEx
projectManager
)
{
final
UISettings
uiSettings
=
UISettings
.
getInstance
();
if
(!
propertiesComponent
.
getBoolean
(
CONFIGURED_V1
,
false
))
{
patchMainMenu
();
uiSettings
.
SHOW_NAVIGATION_BAR
=
false
;
propertiesComponent
.
setValue
(
CONFIGURED_V1
,
"true"
);
}
if
(!
propertiesComponent
.
getBoolean
(
CONFIGURED
,
false
))
{
propertiesComponent
.
setValue
(
CONFIGURED
,
"true"
);
propertiesComponent
.
setValue
(
"toolwindow.stripes.buttons.info.shown"
,
"true"
);
UISettings
uiSettings
=
UISettings
.
getInstance
();
uiSettings
.
HIDE_TOOL_STRIPES
=
false
;
uiSettings
.
SHOW_MEMORY_INDICATOR
=
false
;
uiSettings
.
SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES
=
true
;
uiSettings
.
SHOW_MAIN_TOOLBAR
=
false
;
uiSettings
.
SHOW_NAVIGATION_BAR
=
false
;
codeInsightSettings
.
REFORMAT_ON_PASTE
=
CodeInsightSettings
.
NO_REFORMAT
;
Registry
.
get
(
"ide.new.settings.dialog"
).
setValue
(
true
);
...
...
@@ -178,6 +197,43 @@ public class PyCharmEduInitialConfigurator {
});
}
private
static
void
patchMainMenu
()
{
final
CustomActionsSchema
schema
=
new
CustomActionsSchema
();
final
JTree
actionsTree
=
new
Tree
();
Group
rootGroup
=
new
Group
(
"root"
,
null
,
null
);
final
DefaultMutableTreeNode
root
=
new
DefaultMutableTreeNode
(
rootGroup
);
DefaultTreeModel
model
=
new
DefaultTreeModel
(
root
);
actionsTree
.
setModel
(
model
);
schema
.
fillActionGroups
(
root
);
hideActionFromMainMenu
(
root
,
schema
);
CustomActionsSchema
.
getInstance
().
copyFrom
(
schema
);
}
private
static
void
hideActionFromMainMenu
(
@NotNull
final
DefaultMutableTreeNode
root
,
@NotNull
final
CustomActionsSchema
schema
){
final
TreeNode
mainMenu
=
root
.
getFirstChild
();
final
String
[]
menuItems
=
{
"Tools"
,
"VCS"
,
"Refactor"
,
"Navigate"
,
"Code"
,
"Window"
,
"View"
};
for
(
String
item
:
menuItems
)
{
hideAction
(
schema
,
root
,
mainMenu
,
item
);
}
}
private
static
void
hideAction
(
@NotNull
final
CustomActionsSchema
schema
,
@NotNull
final
DefaultMutableTreeNode
root
,
@NotNull
final
TreeNode
actionGroup
,
@NotNull
final
String
actionId
)
{
for
(
int
i
=
0
;
i
<
actionGroup
.
getChildCount
();
i
++){
final
DefaultMutableTreeNode
child
=
(
DefaultMutableTreeNode
)
actionGroup
.
getChildAt
(
i
);
final
String
childId
=
child
.
getUserObject
()
instanceof
Group
?
((
Group
)
child
.
getUserObject
()).
getName
()
:
null
;
if
(
childId
!=
null
&&
childId
.
equals
(
actionId
)){
final
TreePath
treePath
=
TreeUtil
.
getPath
(
root
,
child
);
final
ActionUrl
url
=
CustomizationUtil
.
getActionUrl
(
treePath
,
ActionUrl
.
DELETED
);
schema
.
addAction
(
url
);
}
}
}
private
static
void
patchRootAreaExtensions
()
{
ExtensionsArea
rootArea
=
Extensions
.
getArea
(
null
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help