Jump to numbered bookmark actions are back

This commit is contained in:
Maxim Shafirov
2009-11-17 16:44:07 +03:00
parent c591acbf8b
commit 387d37c0d9
13 changed files with 408 additions and 0 deletions
@@ -0,0 +1,55 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
import com.intellij.ide.bookmarks.Bookmark;
import com.intellij.ide.bookmarks.BookmarkManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
public abstract class GoToMnemonicBookmarkActionBase extends AnAction implements DumbAware {
private int myNumber;
public GoToMnemonicBookmarkActionBase(int n) {
myNumber = n;
}
@Override
public void update(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
e.getPresentation().setEnabled(project != null);
}
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
final Bookmark bookmark = BookmarkManager.getInstance(project).findBookmarkForMnemonic((char)('0' + myNumber));
if (bookmark != null) {
bookmark.navigate();
}
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark0Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark0Action() {
super(0);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark1Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark1Action() {
super(1);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark2Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark2Action() {
super(2);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark3Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark3Action() {
super(3);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark4Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark4Action() {
super(4);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark5Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark5Action() {
super(5);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark6Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark6Action() {
super(6);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark7Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark7Action() {
super(7);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark8Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark8Action() {
super(8);
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.ide.bookmarks.actions;
public class GotoBookmark9Action extends GoToMnemonicBookmarkActionBase {
public GotoBookmark9Action() {
super(9);
}
}
@@ -147,6 +147,36 @@
<mouse-shortcut keystroke="ctrl shift button1"/>
<mouse-shortcut keystroke="shift button2"/>
</action>
<action id="GotoBookmark0">
<keyboard-shortcut first-keystroke="control 0"/>
</action>
<action id="GotoBookmark1">
<keyboard-shortcut first-keystroke="control 1"/>
</action>
<action id="GotoBookmark2">
<keyboard-shortcut first-keystroke="control 2"/>
</action>
<action id="GotoBookmark3">
<keyboard-shortcut first-keystroke="control 3"/>
</action>
<action id="GotoBookmark4">
<keyboard-shortcut first-keystroke="control 4"/>
</action>
<action id="GotoBookmark5">
<keyboard-shortcut first-keystroke="control 5"/>
</action>
<action id="GotoBookmark6">
<keyboard-shortcut first-keystroke="control 6"/>
</action>
<action id="GotoBookmark7">
<keyboard-shortcut first-keystroke="control 7"/>
</action>
<action id="GotoBookmark8">
<keyboard-shortcut first-keystroke="control 8"/>
</action>
<action id="GotoBookmark9">
<keyboard-shortcut first-keystroke="control 9"/>
</action>
<action id="$Undo">
<keyboard-shortcut first-keystroke="control Z"/>
@@ -979,6 +1009,37 @@
<action id="RunGc"/>
<action id="RunClass"/>
<action id="GotoBookmark0">
<keyboard-shortcut first-keystroke="control 0"/>
</action>
<action id="GotoBookmark1">
<keyboard-shortcut first-keystroke="control 1"/>
</action>
<action id="GotoBookmark2">
<keyboard-shortcut first-keystroke="control 2"/>
</action>
<action id="GotoBookmark3">
<keyboard-shortcut first-keystroke="control 3"/>
</action>
<action id="GotoBookmark4">
<keyboard-shortcut first-keystroke="control 4"/>
</action>
<action id="GotoBookmark5">
<keyboard-shortcut first-keystroke="control 5"/>
</action>
<action id="GotoBookmark6">
<keyboard-shortcut first-keystroke="control 6"/>
</action>
<action id="GotoBookmark7">
<keyboard-shortcut first-keystroke="control 7"/>
</action>
<action id="GotoBookmark8">
<keyboard-shortcut first-keystroke="control 8"/>
</action>
<action id="GotoBookmark9">
<keyboard-shortcut first-keystroke="control 9"/>
</action>
<action id="MethodUp">
<keyboard-shortcut first-keystroke="control UP"/>
</action>
@@ -2094,6 +2155,16 @@
<action id="FindWordAtCaret">
<keyboard-shortcut first-keystroke="control 3" />
</action>
<action id="GotoBookmark0" />
<action id="GotoBookmark1" />
<action id="GotoBookmark2" />
<action id="GotoBookmark3" />
<action id="GotoBookmark4" />
<action id="GotoBookmark5" />
<action id="GotoBookmark6" />
<action id="GotoBookmark7" />
<action id="GotoBookmark8" />
<action id="GotoBookmark9" />
<action id="HighlightUsagesInFile">
<keyboard-shortcut first-keystroke="shift control 7" />
</action>
@@ -2296,6 +2367,16 @@
<action id="GotoAction">
<keyboard-shortcut first-keystroke="control I" />
</action>
<action id="GotoBookmark0" />
<action id="GotoBookmark1" />
<action id="GotoBookmark2" />
<action id="GotoBookmark3" />
<action id="GotoBookmark4" />
<action id="GotoBookmark5" />
<action id="GotoBookmark6" />
<action id="GotoBookmark7" />
<action id="GotoBookmark8" />
<action id="GotoBookmark9" />
<action id="GotoClass">
<keyboard-shortcut first-keystroke="control O" />
</action>
@@ -354,6 +354,18 @@
<reference ref="ShowBookmarks"/>
<reference ref="GotoNextBookmark"/>
<reference ref="GotoPreviousBookmark"/>
<action id="GotoBookmark0" class="com.intellij.ide.bookmarks.actions.GotoBookmark0Action"/>
<action id="GotoBookmark1" class="com.intellij.ide.bookmarks.actions.GotoBookmark1Action"/>
<action id="GotoBookmark2" class="com.intellij.ide.bookmarks.actions.GotoBookmark2Action"/>
<action id="GotoBookmark3" class="com.intellij.ide.bookmarks.actions.GotoBookmark3Action"/>
<action id="GotoBookmark4" class="com.intellij.ide.bookmarks.actions.GotoBookmark4Action"/>
<action id="GotoBookmark5" class="com.intellij.ide.bookmarks.actions.GotoBookmark5Action"/>
<action id="GotoBookmark6" class="com.intellij.ide.bookmarks.actions.GotoBookmark6Action"/>
<action id="GotoBookmark7" class="com.intellij.ide.bookmarks.actions.GotoBookmark7Action"/>
<action id="GotoBookmark8" class="com.intellij.ide.bookmarks.actions.GotoBookmark8Action"/>
<action id="GotoBookmark9" class="com.intellij.ide.bookmarks.actions.GotoBookmark9Action"/>
</group>
<group id="ProjectViewPopupMenuRefactoringGroup">