Author: hibou
Date: Thu Aug 28 04:26:31 2008
New Revision: 689786
URL: http://svn.apache.org/viewvc?rev=689786&view=rev
Log:
Use less internal Eclipse classes to get the selection in the package view, and
fix how the menu entires for ivy cache management was updated
Added:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
(with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
(with props)
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java?rev=689786&r1=689785&r2=689786&view=diff
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java
(original)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDEException.java
Thu Aug 28 04:26:31 2008
@@ -64,8 +64,7 @@
final String msg = (preMsg == null ? "" : preMsg + "\n\n")
+ getMessage()
+ (getCause() == null ? "" : "\n\nUnderlying error ("
- + getCause().getClass().getName() + "): "
- + getCause().getMessage());
+ + getCause().getClass().getName() + "): " +
getCause().getMessage());
IvyPlugin.getDefault().getWorkbench().getDisplay().syncExec(new
Runnable() {
public void run() {
switch (status) {
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?rev=689786&r1=689785&r2=689786&view=diff
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
(original)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
Thu Aug 28 04:26:31 2008
@@ -37,10 +37,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations;
import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
public class IvyClasspathUtil {
@@ -77,33 +74,6 @@
}
/**
- * Get the current selection in the Java package view
- *
- * @return the selection, <code>null</code> if unsuccessful
- */
- public static IStructuredSelection getSelectionInJavaPackageView() {
- IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
- if (activeWorkbenchWindow == null) {
- return null;
- }
- ISelection sel =
activeWorkbenchWindow.getSelectionService().getSelection();
- IStructuredSelection selection;
- if (sel instanceof IStructuredSelection) {
- selection = (IStructuredSelection) sel;
- } else {
- sel = activeWorkbenchWindow.getSelectionService().getSelection(
- "org.eclipse.jdt.ui.PackageExplorer");
- if (sel instanceof IStructuredSelection) {
- selection = (IStructuredSelection) sel;
- } else {
- return null;
- }
- }
- return selection;
- }
-
- /**
* Get the Ivy classpath container from the selection in the Java package
view
*
* @param selection
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java?rev=689786&r1=689785&r2=689786&view=diff
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java
(original)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java
Thu Aug 28 04:26:31 2008
@@ -22,56 +22,21 @@
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivyde.eclipse.IvyDEException;
import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
import org.apache.ivyde.eclipse.ui.actions.CleanCacheAction.Cleanable;
import
org.apache.ivyde.eclipse.ui.actions.CleanCacheAction.RepositoryCacheCleanable;
import
org.apache.ivyde.eclipse.ui.actions.CleanCacheAction.ResolutionCacheCleanable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-public class CleanCacheMenuAction implements IObjectActionDelegate,
IMenuCreator,
- IWorkbenchWindowPulldownDelegate2 {
+public class CleanCacheMenuAction extends IvyDEContainerMenuAction {
- IStructuredSelection selection;
-
- public void init(IWorkbenchWindow window) {
- }
-
- public void dispose() {
- }
-
- public Menu getMenu(Control parent) {
- Menu menu = new Menu(parent);
- fill(menu);
- return menu;
- }
-
- public Menu getMenu(Menu parent) {
- Menu menu = new Menu(parent);
- fill(menu);
- return menu;
- }
-
- private void fill(Menu menu) {
- IvyClasspathContainer cp =
IvyClasspathUtil.getIvyClasspathContainer(selection);
- if (cp != null) {
- try {
- fill(menu, cp.getConf().getIvy());
- } catch (IvyDEException e) {
- e.log(IStatus.WARNING,
- "Cache delection actions in the context menu could not be
populated. ");
- }
- return;
+ protected void fill(Menu menu, IvyClasspathContainer ivycp) {
+ try {
+ fill(menu, ivycp.getConf().getIvy());
+ } catch (IvyDEException e) {
+ e.log(IStatus.WARNING,
+ "Cache delection actions in the context menu could not be
populated. ");
}
}
@@ -114,18 +79,4 @@
new ActionContributionItem(action).fill(menu, -1);
}
- public void run(IAction action) {
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- action.setMenuCreator(this);
- action.setEnabled(!selection.isEmpty());
- }
- }
-
}
Added:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java?rev=689786&view=auto
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
(added)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
Thu Aug 28 04:26:31 2008
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.actions;
+
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IActionDelegate;
+
+public abstract class IvyDEContainerAction implements IActionDelegate {
+
+ public void selectionChanged(IAction action, ISelection s) {
+ if (s instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) s;
+ IvyClasspathContainer cp =
IvyClasspathUtil.getIvyClasspathContainer(selection);
+ if (cp != null) {
+ action.setEnabled(true);
+ selectionChanged(action, cp);
+ return;
+ }
+ }
+ action.setEnabled(false);
+ }
+
+ abstract protected void selectionChanged(IAction a, IvyClasspathContainer
cp);
+}
Propchange:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java?rev=689786&view=auto
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
(added)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
Thu Aug 28 04:26:31 2008
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.actions;
+
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+public abstract class IvyDEContainerMenuAction extends IvyDEContainerAction
implements IMenuCreator {
+
+ boolean selectionChanged;
+
+ private IAction proxyAction;
+
+ IvyClasspathContainer cp;
+
+ private MenuListener menuListener = new MenuAdapter() {
+ public void menuShown(MenuEvent e) {
+ if (selectionChanged) {
+ Menu m = (Menu) e.widget;
+ MenuItem[] items = m.getItems();
+ for (int i = 0; i < items.length; i++) {
+ items[i].dispose();
+ }
+ fill(m, cp);
+ selectionChanged = false;
+ }
+ }
+ };
+
+ public Menu getMenu(Control parent) {
+ Menu menu = new Menu(parent);
+ fill(menu, cp);
+ menu.addMenuListener(menuListener);
+ return menu;
+ }
+
+ public Menu getMenu(Menu parent) {
+ Menu menu = new Menu(parent);
+ fill(menu, cp);
+ menu.addMenuListener(menuListener);
+ return menu;
+ }
+
+ abstract protected void fill(Menu menu, IvyClasspathContainer ivycp);
+
+ public void run(IAction action) {
+ // nothing to run
+ }
+
+ protected void selectionChanged(IAction a, IvyClasspathContainer ivycp) {
+ this.cp = ivycp;
+ selectionChanged = true;
+ if (proxyAction != a) {
+ proxyAction = a;
+ proxyAction.setMenuCreator(this);
+ }
+ }
+
+ public void dispose() {
+ // nothing to dispose
+ }
+
+}
Propchange:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/IvyDEContainerMenuAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java?rev=689786&r1=689785&r2=689786&view=diff
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
(original)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
Thu Aug 28 04:26:31 2008
@@ -19,104 +19,61 @@
import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainerConfiguration;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
-public class OpenIvyFileAction implements IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
+public class OpenIvyFileAction extends IvyDEContainerAction {
- /**
- * The constructor.
- */
- public OpenIvyFileAction() {
+ private IvyClasspathContainer cp;
+
+ protected void selectionChanged(IAction a, IvyClasspathContainer ivycp) {
+ this.cp = ivycp;
}
- /**
- * The action has been activated. The argument of the method represents
the 'real' action
- * sitting in the workbench UI.
- *
- * @see IWorkbenchWindowActionDelegate#run
- */
public void run(IAction action) {
- IvyClasspathContainer cp =
IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil
- .getSelectionInJavaPackageView());
- if (cp != null) {
- IvyClasspathContainerConfiguration conf = cp .getConf();
- if (conf.getJavaProject() == null) {
- return;
- }
- IFile file =
conf.getJavaProject().getProject().getFile(conf.getIvyXmlPath());
- IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
- if (file != null) {
- try {
- String editorId = "org.apache.ivyde.editors.IvyEditor";
- page.openEditor(new FileEditorInput(file), editorId, true);
- // only remember the default editor if the open succeeds
- IDE.setDefaultEditor(file, editorId);
- } catch (PartInitException e) {
- Shell parent = page.getWorkbenchWindow().getShell();
- String title = "Problems Opening Editor";
- String message = e.getMessage();
- // Check for a nested CoreException
- CoreException nestedException = null;
- IStatus status = e.getStatus();
- if (status != null && status.getException() instanceof
CoreException) {
- nestedException = (CoreException)
status.getException();
- }
- if (nestedException != null) {
- // Open an error dialog and include the extra
- // status information from the nested CoreException
- ErrorDialog.openError(parent, title, message,
nestedException.getStatus());
- } else {
- // Open a regular error dialog since there is no
- // extra information to display
- MessageDialog.openError(parent, title, message);
- }
+ IvyClasspathContainerConfiguration conf = cp.getConf();
+ if (conf.getJavaProject() == null) {
+ return;
+ }
+ IFile file =
conf.getJavaProject().getProject().getFile(conf.getIvyXmlPath());
+ IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if (file != null) {
+ try {
+ String editorId = "org.apache.ivyde.editors.IvyEditor";
+ page.openEditor(new FileEditorInput(file), editorId, true);
+ // only remember the default editor if the open succeeds
+ IDE.setDefaultEditor(file, editorId);
+ } catch (PartInitException e) {
+ Shell parent = page.getWorkbenchWindow().getShell();
+ String title = "Problems Opening Editor";
+ String message = e.getMessage();
+ // Check for a nested CoreException
+ CoreException nestedException = null;
+ IStatus status = e.getStatus();
+ if (status != null && status.getException() instanceof
CoreException) {
+ nestedException = (CoreException) status.getException();
+ }
+ if (nestedException != null) {
+ // Open an error dialog and include the extra
+ // status information from the nested CoreException
+ ErrorDialog.openError(parent, title, message,
nestedException.getStatus());
+ } else {
+ // Open a regular error dialog since there is no
+ // extra information to display
+ MessageDialog.openError(parent, title, message);
}
}
}
}
- /**
- * Selection in the workbench has been changed. We can change the state of
the 'real' action
- * here if we want, but this can only happen after the delegate has been
created.
- *
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system resources we previously
allocated.
- *
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
- }
-
- /**
- * We will cache window object in order to be able to provide parent shell
for the message
- * dialog.
- *
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
}
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java?rev=689786&r1=689785&r2=689786&view=diff
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java
(original)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java
Thu Aug 28 04:26:31 2008
@@ -18,59 +18,18 @@
package org.apache.ivyde.eclipse.ui.actions;
import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class RefreshAction implements IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
-
- /**
- * The constructor.
- */
- public RefreshAction() {
- }
- /**
- * The action has been activated. The argument of the method represents
the 'real' action
- * sitting in the workbench UI.
- *
- * @see IWorkbenchWindowActionDelegate#run
- */
- public void run(IAction action) {
- IvyClasspathContainer cp =
IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil
- .getSelectionInJavaPackageView());
- if (cp != null) {
- cp.launchResolve(true, true, null);
- }
- }
+public class RefreshAction extends IvyDEContainerAction {
- /**
- * Selection in the workbench has been changed. We can change the state of
the 'real' action
- * here if we want, but this can only happen after the delegate has been
created.
- *
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
+ private IvyClasspathContainer cp;
- /**
- * We can use this method to dispose of any system resources we previously
allocated.
- *
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
+ protected void selectionChanged(IAction a, IvyClasspathContainer ivycp) {
+ this.cp = ivycp;
}
- /**
- * We will cache window object in order to be able to provide parent shell
for the message
- * dialog.
- *
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
+ public void run(IAction action) {
+ cp.launchResolve(true, true, null);
}
+
}
Modified:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java
URL:
http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java?rev=689786&r1=689785&r2=689786&view=diff
==============================================================================
---
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java
(original)
+++
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java
Thu Aug 28 04:26:31 2008
@@ -18,59 +18,18 @@
package org.apache.ivyde.eclipse.ui.actions;
import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class ResolveAction implements IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
-
- /**
- * The constructor.
- */
- public ResolveAction() {
- }
- /**
- * The action has been activated. The argument of the method represents
the 'real' action
- * sitting in the workbench UI.
- *
- * @see IWorkbenchWindowActionDelegate#run
- */
- public void run(IAction action) {
- IvyClasspathContainer cp =
IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil
- .getSelectionInJavaPackageView());
- if (cp != null) {
- cp.launchResolve(false, true, null);
- }
- }
+public class ResolveAction extends IvyDEContainerAction {
- /**
- * Selection in the workbench has been changed. We can change the state of
the 'real' action
- * here if we want, but this can only happen after the delegate has been
created.
- *
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
+ private IvyClasspathContainer cp;
- /**
- * We can use this method to dispose of any system resources we previously
allocated.
- *
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
+ protected void selectionChanged(IAction a, IvyClasspathContainer ivycp) {
+ this.cp = ivycp;
}
- /**
- * We will cache window object in order to be able to provide parent shell
for the message
- * dialog.
- *
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
+ public void run(IAction action) {
+ cp.launchResolve(false, true, null);
}
+
}