本文整理汇总了Java中com.intellij.openapi.actionSystem.Separator.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Separator.getInstance方法的具体用法?Java Separator.getInstance怎么用?Java Separator.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.Separator
的用法示例。
在下文中一共展示了Separator.getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponentAction
import com.intellij.openapi.actionSystem.Separator; //导入方法依赖的package包/类
@Nullable
public AnAction getComponentAction(){
if (myComponent instanceof Separator){
return Separator.getInstance();
}
if (myComponent instanceof String){
return ActionManager.getInstance().getAction((String)myComponent);
}
if (myComponent instanceof Group){
final String id = ((Group)myComponent).getId();
if (id == null || id.length() == 0){
return ((Group)myComponent).constructActionGroup(true);
}
return ActionManager.getInstance().getAction(id);
}
return null;
}
示例2: readExternal
import com.intellij.openapi.actionSystem.Separator; //导入方法依赖的package包/类
@Override
public void readExternal(Element element) throws InvalidDataException {
myGroupPath = new ArrayList<String>();
for (Object o : element.getChildren(PATH)) {
myGroupPath.add(((Element)o).getAttributeValue(VALUE));
}
final String attributeValue = element.getAttributeValue(VALUE);
if (element.getAttributeValue(IS_ACTION) != null) {
myComponent = attributeValue;
}
else if (element.getAttributeValue(SEPARATOR) != null) {
myComponent = Separator.getInstance();
}
else if (element.getAttributeValue(IS_GROUP) != null) {
final AnAction action = ActionManager.getInstance().getAction(attributeValue);
myComponent = action instanceof ActionGroup
? ActionsTreeUtil.createGroup((ActionGroup)action, true, null)
: new Group(attributeValue, attributeValue, null);
}
myActionType = Integer.parseInt(element.getAttributeValue(ACTION_TYPE));
myAbsolutePosition = Integer.parseInt(element.getAttributeValue(POSITION));
DefaultJDOMExternalizer.readExternal(this, element);
}
示例3: getChildren
import com.intellij.openapi.actionSystem.Separator; //导入方法依赖的package包/类
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return AnAction.EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) {
return AnAction.EMPTY_ARRAY;
}
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new AddToNewFavoritesListAction()};
}
AnAction[] actions = new AnAction[availableFavoritesLists.size() + 2];
int idx = 0;
for (String favoritesList : availableFavoritesLists) {
actions[idx++] = new AddToFavoritesAction(favoritesList);
}
actions[idx++] = Separator.getInstance();
actions[idx] = new AddToNewFavoritesListAction();
return actions;
}
示例4: getChildren
import com.intellij.openapi.actionSystem.Separator; //导入方法依赖的package包/类
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return AnAction.EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) {
return AnAction.EMPTY_ARRAY;
}
final List<String> listNames = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new AddAllOpenFilesToNewFavoritesListAction()};
}
AnAction[] actions = new AnAction[listNames.size() + 2];
int idx = 0;
for (String favoritesList : listNames) {
actions[idx++] = new AddAllOpenFilesToFavorites(favoritesList);
}
actions[idx++] = Separator.getInstance();
actions[idx] = new AddAllOpenFilesToNewFavoritesListAction();
return actions;
}
示例5: readExternal
import com.intellij.openapi.actionSystem.Separator; //导入方法依赖的package包/类
public void readExternal(Element element) throws InvalidDataException {
myGroupPath = new ArrayList<String>();
for (Object o : element.getChildren(PATH)) {
myGroupPath.add(((Element)o).getAttributeValue(VALUE));
}
final String attributeValue = element.getAttributeValue(VALUE);
if (element.getAttributeValue(IS_ACTION) != null) {
myComponent = attributeValue;
}
else if (element.getAttributeValue(SEPARATOR) != null) {
myComponent = Separator.getInstance();
}
else if (element.getAttributeValue(IS_GROUP) != null) {
final AnAction action = ActionManager.getInstance().getAction(attributeValue);
myComponent = action instanceof ActionGroup
? ActionsTreeUtil.createGroup((ActionGroup)action, true, null)
: new Group(attributeValue, attributeValue, null);
}
myActionType = Integer.parseInt(element.getAttributeValue(ACTION_TYPE));
myAbsolutePosition = Integer.parseInt(element.getAttributeValue(POSITION));
DefaultJDOMExternalizer.readExternal(this, element);
}
示例6: getChildren
import com.intellij.openapi.actionSystem.Separator; //导入方法依赖的package包/类
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) return EMPTY_ARRAY;
final Collection<String> filePaths = TestHistoryConfiguration.getInstance(project).getFiles();
final File testHistoryRoot = TestStateStorage.getTestHistoryRoot(project);
final List<File> fileNames = ContainerUtil.map(filePaths, new Function<String, File>() {
@Override
public File fun(String fileName) {
return new File(testHistoryRoot, fileName);
}
});
Collections.sort(fileNames, new Comparator<File>() {
@Override
public int compare(File f1, File f2) {
return f1.lastModified() > f2.lastModified() ? -1 : 1;
}
});
final int historySize = fileNames.size();
final AnAction[] actions = new AnAction[historySize + 2];
for (int i = 0; i < historySize; i++) {
actions[i] = new ImportTestsFromHistoryAction(myProperties, project, fileNames.get(i).getName());
}
actions[historySize] = Separator.getInstance();
actions[historySize + 1] = new ImportTestsFromFileAction(myProperties);
return actions;
}