From 387d37c0d92e244d3fa4a617ba782075119c971f Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 17 Nov 2009 16:43:37 +0300 Subject: [PATCH] Jump to numbered bookmark actions are back --- .../GoToMnemonicBookmarkActionBase.java | 55 +++++++++++++ .../actions/GotoBookmark0Action.java | 26 ++++++ .../actions/GotoBookmark1Action.java | 26 ++++++ .../actions/GotoBookmark2Action.java | 26 ++++++ .../actions/GotoBookmark3Action.java | 26 ++++++ .../actions/GotoBookmark4Action.java | 26 ++++++ .../actions/GotoBookmark5Action.java | 26 ++++++ .../actions/GotoBookmark6Action.java | 26 ++++++ .../actions/GotoBookmark7Action.java | 26 ++++++ .../actions/GotoBookmark8Action.java | 26 ++++++ .../actions/GotoBookmark9Action.java | 26 ++++++ .../src/idea/DefaultKeymap.xml | 81 +++++++++++++++++++ .../src/idea/LangActions.xml | 12 +++ 13 files changed, 408 insertions(+) create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GoToMnemonicBookmarkActionBase.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark0Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark1Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark2Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark3Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark4Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark5Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark6Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark7Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark8Action.java create mode 100644 platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark9Action.java diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GoToMnemonicBookmarkActionBase.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GoToMnemonicBookmarkActionBase.java new file mode 100644 index 000000000000..a2aa879e66c8 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GoToMnemonicBookmarkActionBase.java @@ -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(); + } + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark0Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark0Action.java new file mode 100644 index 000000000000..8cac187101da --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark0Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark1Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark1Action.java new file mode 100644 index 000000000000..568d5363307c --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark1Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark2Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark2Action.java new file mode 100644 index 000000000000..3a8ffd623020 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark2Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark3Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark3Action.java new file mode 100644 index 000000000000..abdf0c5c356e --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark3Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark4Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark4Action.java new file mode 100644 index 000000000000..a40ad7f63939 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark4Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark5Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark5Action.java new file mode 100644 index 000000000000..3906eafdc813 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark5Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark6Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark6Action.java new file mode 100644 index 000000000000..a00896bef78c --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark6Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark7Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark7Action.java new file mode 100644 index 000000000000..b1b99f822dbb --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark7Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark8Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark8Action.java new file mode 100644 index 000000000000..75caabf6c860 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark8Action.java @@ -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); + } +} diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark9Action.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark9Action.java new file mode 100644 index 000000000000..91b25dedb5c3 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/actions/GotoBookmark9Action.java @@ -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); + } +} diff --git a/platform/platform-resources/src/idea/DefaultKeymap.xml b/platform/platform-resources/src/idea/DefaultKeymap.xml index 29a81a004436..f745feea5a57 100644 --- a/platform/platform-resources/src/idea/DefaultKeymap.xml +++ b/platform/platform-resources/src/idea/DefaultKeymap.xml @@ -147,6 +147,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -979,6 +1009,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2094,6 +2155,16 @@ + + + + + + + + + + @@ -2296,6 +2367,16 @@ + + + + + + + + + + diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index aee45ce405fc..48f24dded32b 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -354,6 +354,18 @@ + + + + + + + + + + + +