mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Maven: disabling some buttons for non-maven projects (IDEA-46413)
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 org.jetbrains.idea.maven.project.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import org.jetbrains.idea.maven.utils.actions.MavenActionUtil;
|
||||
|
||||
public class DownloadActionGroup extends DefaultActionGroup {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
if (MavenActionUtil.getProject(e.getDataContext()) == null) return;
|
||||
e.getPresentation().setEnabled(MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject());
|
||||
}
|
||||
}
|
||||
+5
@@ -26,5 +26,10 @@ public abstract class MavenProjectsManagerAction extends MavenAction {
|
||||
perform(MavenActionUtil.getProjectsManager(e.getDataContext()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAvailable(AnActionEvent e) {
|
||||
return super.isAvailable(e) && MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject();
|
||||
}
|
||||
|
||||
protected abstract void perform(MavenProjectsManager manager);
|
||||
}
|
||||
|
||||
+6
@@ -15,9 +15,15 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.project.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager;
|
||||
|
||||
public class ReimportAction extends MavenProjectsManagerAction {
|
||||
@Override
|
||||
protected boolean isAvailable(AnActionEvent e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void perform(MavenProjectsManager manager) {
|
||||
manager.forceUpdateAllProjectsOrFindAllAvailablePomFiles();
|
||||
|
||||
@@ -293,7 +293,8 @@
|
||||
</action>
|
||||
</group>
|
||||
|
||||
<group id="Maven.DownloadAllGroup" popup="true" icon="/images/download.png">
|
||||
<group id="Maven.DownloadAllGroup" popup="true" class="org.jetbrains.idea.maven.project.actions.DownloadActionGroup"
|
||||
icon="/images/download.png">
|
||||
<reference id="Maven.DownloadAllSources"/>
|
||||
<reference id="Maven.DownloadAllDocs"/>
|
||||
<reference id="Maven.DownloadAllSourcesAndDocs"/>
|
||||
|
||||
Reference in New Issue
Block a user