]> git.uio.no Git - ifi-stolz-refaktor.git/blobdiff - case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/actions/AbstractToggleLinkingAction.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui / org / eclipse / jdt / internal / ui / actions / AbstractToggleLinkingAction.java
diff --git a/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/actions/AbstractToggleLinkingAction.java b/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/actions/AbstractToggleLinkingAction.java
new file mode 100644 (file)
index 0000000..f6c1b38
--- /dev/null
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.commands.ActionHandler;
+
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
+import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jdt.internal.ui.search.OccurrencesSearchResultPage;
+
+
+/**
+ * This is an action template for actions that toggle whether
+ * it links its selection to the active editor.
+ *
+ * @since 3.0
+ */
+public abstract class AbstractToggleLinkingAction extends Action {
+
+       /**
+        * Constructs a new action.
+        */
+       public AbstractToggleLinkingAction() {
+               super(ActionMessages.ToggleLinkingAction_label);
+               setDescription(ActionMessages.ToggleLinkingAction_description);
+               setToolTipText(ActionMessages.ToggleLinkingAction_tooltip);
+               JavaPluginImages.setLocalImageDescriptors(this, "synced.gif"); //$NON-NLS-1$
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.LINK_EDITOR_ACTION);
+               setChecked(false);
+       }
+
+       /**
+        * Runs the action.
+        */
+       @Override
+       public abstract void run();
+
+       public void generated_392288802297276408(OccurrencesSearchResultPage occurrencessearchresultpage, IMenuManager menu) {
+               menu.add(this);
+       
+               IHandlerService handlerService= (IHandlerService) occurrencessearchresultpage.getSite().getService(IHandlerService.class);
+               handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(this));
+       }
+}