This commit is contained in:
Vladimir Krivosheev
2016-09-06 15:27:52 +02:00
parent a9111bc805
commit 86f0dd3500
7 changed files with 33 additions and 87 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -16,7 +16,10 @@
package com.intellij.ide.impl;
import com.intellij.facet.*;
import com.intellij.ide.*;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.SelectInContext;
import com.intellij.ide.SelectInTarget;
import com.intellij.ide.StandardTargetWeights;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.module.Module;
@@ -41,7 +44,7 @@ import java.util.Iterator;
/**
* @author nik
*/
public class ProjectStructureSelectInTarget extends SelectInTargetBase implements SelectInTarget, DumbAware {
public class ProjectStructureSelectInTarget implements SelectInTarget, DumbAware {
@Override
public boolean canSelect(final SelectInContext context) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -16,7 +16,7 @@
package com.intellij.ide.impl;
import com.intellij.ide.SelectInContext;
import com.intellij.ide.SelectInTargetBase;
import com.intellij.ide.SelectInTarget;
import com.intellij.ide.StandardTargetWeights;
import com.intellij.ide.actions.RevealFileAction;
import com.intellij.ide.actions.ShowFilePathAction;
@@ -28,7 +28,7 @@ import java.io.File;
/**
* @author Roman.Chernyatchik
*/
public class ProjectViewSelectInExplorerTarget extends SelectInTargetBase implements DumbAware {
public class ProjectViewSelectInExplorerTarget implements DumbAware, SelectInTarget {
@Override
public boolean canSelect(SelectInContext context) {
VirtualFile file = ShowFilePathAction.findLocalFile(context.getVirtualFile());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -33,15 +33,21 @@ public interface SelectInTarget {
/** Tool window this target is supposed to select in */
@Nullable
String getToolWindowId();
default String getToolWindowId() {
return null;
}
/** aux view id specific for tool window, e.g. Project/Packages/J2EE tab inside project View */
@Nullable
String getMinorViewId();
default String getMinorViewId() {
return null;
}
/**
* Weight is used to provide an order in SelectIn popup. Lesser weights come first.
* @return weight of this particular target.
*/
float getWeight();
default float getWeight() {
return 0;
}
}
@@ -1,33 +0,0 @@
/*
* Copyright 2000-2013 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.ide;
public abstract class SelectInTargetBase implements SelectInTarget {
@Override
public String getToolWindowId() {
return null;
}
@Override
public String getMinorViewId() {
return null;
}
@Override
public float getWeight() {
return 0;
}
}
@@ -1,30 +0,0 @@
/*
* Copyright 2000-2013 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.ide;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.util.Consumer;
/**
* @author Konstantin Bulenkov
*/
public interface SimpleSettingsProvider {
void addSettings(Consumer<BooleanOptionDescription> collector);
boolean matches(String pattern, BooleanOptionDescription option);
}
@@ -1,23 +1,23 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2016 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
* 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
* 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.
* 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.plugins.groovy.mvc.projectView;
import com.intellij.ide.SelectInContext;
import com.intellij.ide.SelectInTargetBase;
import com.intellij.ide.SelectInTarget;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
@@ -28,7 +28,7 @@ import org.jetbrains.plugins.groovy.mvc.MvcFramework;
/**
* @author Dmitry Krasilschikov
*/
public class MvcProjectViewSelectInTarget extends SelectInTargetBase implements DumbAware {
public class MvcProjectViewSelectInTarget implements DumbAware, SelectInTarget {
@Override
public boolean canSelect(SelectInContext context) {
final Project project = context.getProject();
@@ -16,7 +16,7 @@
package com.intellij.ide.browsers.actions
import com.intellij.ide.SelectInContext
import com.intellij.ide.SelectInTargetBase
import com.intellij.ide.SelectInTarget
import com.intellij.ide.StandardTargetWeights
import com.intellij.ide.browsers.createOpenInBrowserRequest
import com.intellij.ide.browsers.impl.WebBrowserServiceImpl
@@ -29,7 +29,7 @@ import com.intellij.xml.util.HtmlUtil
private val LOG = Logger.getInstance(SelectInDefaultBrowserTarget::class.java)
internal class SelectInDefaultBrowserTarget : SelectInTargetBase() {
internal class SelectInDefaultBrowserTarget : SelectInTarget {
override fun canSelect(context: SelectInContext): Boolean {
val selectorInFile = context.selectorInFile as? PsiElement ?: return false
val request = createOpenInBrowserRequest(selectorInFile) ?: return false