[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions ...

Robert Stryker rob.stryker at jboss.com
Wed Apr 18 20:14:20 EDT 2007


  User: rawb    
  Date: 07/04/18 20:14:20

  Modified:    core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions  
                        ActionWithDelegate.java
  Added:       core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions  
                        BuildProjectAction.java
  Log:
  Added build project to project menu
  
  Revision  Changes    Path
  1.2       +18 -0     jbosside/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/ActionWithDelegate.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ActionWithDelegate.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/ActionWithDelegate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ActionWithDelegate.java	18 Apr 2007 21:23:59 -0000	1.1
  +++ ActionWithDelegate.java	19 Apr 2007 00:14:20 -0000	1.2
  @@ -2,6 +2,7 @@
   
   import org.eclipse.jface.action.Action;
   import org.eclipse.jface.action.IAction;
  +import org.eclipse.jface.resource.ImageDescriptor;
   import org.eclipse.jface.viewers.ISelection;
   import org.eclipse.jface.viewers.IStructuredSelection;
   import org.eclipse.ui.IActionDelegate;
  @@ -10,9 +11,26 @@
   
   public abstract class ActionWithDelegate extends Action implements IActionDelegate, ISelectionListener {
   	
  +/*
  + * Constructors
  + */
   	public ActionWithDelegate () { 
   	}
   	
  +	public ActionWithDelegate(String text) {
  +		super(text);
  +	}
  +
  +	public ActionWithDelegate(String text, ImageDescriptor image) {
  +		super(text, image);
  +	}
  +
  +	public ActionWithDelegate(String text, int style) {
  +		super(text, style);
  +	}
  +
  +	
  +	
   	public abstract void run ();
   	
   	public void run(IAction action) {
  
  
  
  1.1      date: 2007/04/19 00:14:20;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildProjectAction.java
  
  Index: BuildProjectAction.java
  ===================================================================
  package org.jboss.ide.eclipse.archives.ui.actions;
  
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.resources.IResource;
  import org.eclipse.core.runtime.IAdaptable;
  import org.eclipse.jface.action.IAction;
  import org.eclipse.jface.viewers.ISelection;
  import org.eclipse.jface.viewers.IStructuredSelection;
  import org.eclipse.ui.IWorkbenchWindow;
  import org.eclipse.ui.IWorkbenchWindowActionDelegate;
  import org.jboss.ide.eclipse.archives.core.model.IArchive;
  import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
  import org.jboss.ide.eclipse.archives.core.model.PackagesCore;
  import org.jboss.ide.eclipse.archives.ui.PackagesSharedImages;
  
  //public class BuildProjectAction extends ActionWithDelegate  {
  //
  //
  //	public IStructuredSelection getSelection() {
  //		return ProjectArchivesView.getInstance().getSelection();
  //	}
  //	
  //	public Object getSelectedObject() {
  //		IStructuredSelection sel = getSelection();
  //		if( sel != null && !sel.isEmpty() ) {
  //			return sel.getFirstElement();
  //		}
  //		return null;
  //	}
  //}
  
  public class BuildProjectAction implements IWorkbenchWindowActionDelegate {
  	private IProject selectedProject;
  	public void dispose() {
  	}
  
  	public void init(IWorkbenchWindow window) {
  	}
  
  	public void run(IAction action) {
  		if( selectedProject != null ) 
  			PackagesCore.buildProject(selectedProject, null);
  	}
  
  	public void selectionChanged(IAction action, ISelection selection) {
  		if( !selection.isEmpty() && selection instanceof IStructuredSelection ) {
  			Object o = ((IStructuredSelection)selection).getFirstElement();
  			if( o instanceof IAdaptable ) {
  				IResource res = (IResource)  ((IAdaptable)o).getAdapter(IResource.class);
  				if( res != null ) {
  					selectedProject = res.getProject();				
  					return;
  				}
  			}
  		}
  		selectedProject = null;
  	}
  	
  }
  
  



More information about the jboss-cvs-commits mailing list