Skip to content

Commit

Permalink
Move filters Button in Call Hierarchy view to the top level Bar (#1671)
Browse files Browse the repository at this point in the history
* Move filters Button in Call Hierarchy view to the top level Bar

- Added class ShowCallHierarchyFilterDialogAction
- Added fFiltersAction to CallHierarchyViewPart to create an icon in the
top level bar
  • Loading branch information
jannisCode authored Oct 4, 2024
1 parent b46e6a2 commit 68f1142
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 28 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.ui
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.ui; singleton:=true
Bundle-Version: 3.33.100.qualifier
Bundle-Version: 3.33.200.qualifier
Bundle-Activator: org.eclipse.jdt.internal.ui.JavaPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.ui</artifactId>
<version>3.33.100-SNAPSHOT</version>
<version>3.33.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.window.Window;

import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionGroup;

import org.eclipse.jdt.internal.ui.JavaPluginImages;

/**
* Action group to add the filter actions to a view part's toolbar
* menu.
Expand All @@ -37,19 +34,6 @@
*/
public class CallHierarchyFiltersActionGroup extends ActionGroup {

class ShowFilterDialogAction extends Action {
ShowFilterDialogAction() {
setText(CallHierarchyMessages.ShowFilterDialogAction_text);
setImageDescriptor(JavaPluginImages.DESC_ELCL_FILTER);
setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_FILTER);
}

@Override
public void run() {
openFiltersDialog();
}
}

class ShowExpandWithConstructorsDialogAction extends Action {
ShowExpandWithConstructorsDialogAction() {
setText(CallHierarchyMessages.ShowExpandWithConstructorsDialogAction_text);
Expand Down Expand Up @@ -82,7 +66,7 @@ public void fillActionBars(IActionBars actionBars) {

private void fillViewMenu(IMenuManager viewMenu) {
viewMenu.add(new Separator("filters")); //$NON-NLS-1$
viewMenu.add(new ShowFilterDialogAction());
viewMenu.add(new ShowCallHierarchyFilterDialogAction(fPart, null));
viewMenu.add(new ShowExpandWithConstructorsDialogAction());
}

Expand All @@ -93,15 +77,6 @@ public void dispose() {

// ---------- dialog related code ----------

private void openFiltersDialog() {
FiltersDialog dialog= new FiltersDialog(
fPart.getViewSite().getShell());

if(Window.OK == dialog.open()) {
fPart.refresh();
}
}

private void openExpandWithConstructorsDialog() {
Shell parentShell= fPart.getViewSite().getShell();
new ExpandWithConstructorsDialog(parentShell).open();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ protected void open(ISelection selection, boolean activate) {
private IPartListener2 fPartListener;
private boolean fIsPinned;
private PinCallHierarchyViewAction fPinViewAction;
private ShowCallHierarchyFilterDialogAction fFiltersAction;


public CallHierarchyViewPart() {
Expand Down Expand Up @@ -1024,6 +1025,7 @@ private void fillActionBars() {
}
toolBar.add(fHistoryDropDownAction);
toolBar.add(fPinViewAction);
toolBar.add(fFiltersAction);
}

private void makeActions() {
Expand All @@ -1048,6 +1050,8 @@ private void makeActions() {
fExpandWithConstructorsAction= new ExpandWithConstructorsAction(this, fCallHierarchyViewer);
fRemoveFromViewAction= new RemoveFromViewAction(this, fCallHierarchyViewer);
fPinViewAction= new PinCallHierarchyViewAction(this);
fFiltersAction = new ShowCallHierarchyFilterDialogAction(this, CallHierarchyMessages.ShowFilterDialogAction_text);

fToggleOrientationActions = new ToggleOrientationAction[] {
new ToggleOrientationAction(this, VIEW_ORIENTATION_VERTICAL),
new ToggleOrientationAction(this, VIEW_ORIENTATION_HORIZONTAL),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2024 Vector Informatik GmbH and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.callhierarchy;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.Window;

import org.eclipse.jdt.internal.ui.JavaPluginImages;

class ShowCallHierarchyFilterDialogAction extends Action {
private CallHierarchyViewPart fPart;

public ShowCallHierarchyFilterDialogAction(CallHierarchyViewPart view, String tooltipText) {
super();
fPart= view;

setToolTipText(tooltipText);

setText(CallHierarchyMessages.ShowFilterDialogAction_text);
setImageDescriptor(JavaPluginImages.DESC_ELCL_FILTER);
setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_FILTER);
}

@Override
public void run() {
openFiltersDialog();
}

private void openFiltersDialog() {
FiltersDialog dialog= new FiltersDialog(
fPart.getViewSite().getShell());

if (Window.OK == dialog.open()) {
fPart.refresh();
}
}
}

0 comments on commit 68f1142

Please sign in to comment.