You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by hi...@apache.org on 2011/02/22 15:09:32 UTC
svn commit: r1073358 [4/6] - in /incubator/easyant/easyant4e/trunk:
org.apache.easyant4e.releng/ org.apache.easyant4e.releng/build-files/
org.apache.easyant4e.releng/build-files/automatedTests/
org.apache.easyant4e.tests/datas/simplejavaproject/ org.ap...
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleBlock.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleBlock.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleBlock.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleBlock.java Tue Feb 22 15:09:30 2011
@@ -66,231 +66,231 @@ import com.google.inject.Inject;
//import com.google.inject.Inject;
public class BuildLifecycleBlock extends MasterDetailsBlock {
- private FormPage page;
+ private FormPage page;
- private BuildLifeCycleContentProvider buildLifeCycleContentProvider;
- private BuildLifecycleLabelProvider buildLifecycleLabelProvider;
- private EasyantProjectService easyantProjectService;
- private PhaseDetailsPage phaseDetailsPage;
- private TargetDetailsPage targetDetailsPage;
- private EasyAntConsole console;
- private ImageProvider imageProvider;
- private boolean enableInfoLogLevel = false;
- private boolean enableVerboseLogLevel = false;
- private boolean enableDebugLogLevel = false;
-
-
- public BuildLifecycleBlock() {}
-
- @Inject
- public void setImageProvider(ImageProvider imageProvider) {
- this.imageProvider = imageProvider;
- }
-
- @Inject
- public void setConsole(EasyAntConsole console) {
- this.console = console;
- }
-
- @Inject
- public void setPhaseDetailsPage(PhaseDetailsPage phaseDetailsPage) {
- this.phaseDetailsPage = phaseDetailsPage;
- }
-
- @Inject
- public void setTargetDetailsPage(TargetDetailsPage targetDetailsPage) {
- this.targetDetailsPage = targetDetailsPage;
- }
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
-
- @Inject
- public void setBuildLifecycleLabelProvider(BuildLifecycleLabelProvider buildLifecycleLabelProvider) {
- this.buildLifecycleLabelProvider = buildLifecycleLabelProvider;
- }
-
- @Inject
- public void setBuildLifeCycleContentProvider(BuildLifeCycleContentProvider buildLifeCycleContentProvider) {
- this.buildLifeCycleContentProvider = buildLifeCycleContentProvider;
- }
-
- public void setPage(FormPage page) {
- this.page = page;
- }
-
- @Override
- protected void createMasterPart(final IManagedForm managedForm, final Composite parent) {
- createBuildLifecyclePart(managedForm, parent);
- }
-
- protected void createBuildLifecyclePart(final IManagedForm managedForm, final Composite parent) {
- FormToolkit toolkit = managedForm.getToolkit();
- Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
- section.setText("Build Lifecycle");
- section.setDescription("The build lifecycle has the following build phases:");
- section.marginWidth = 10;
- section.marginHeight = 5;
- Composite client = toolkit.createComposite(section, SWT.WRAP);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 2;
- layout.marginHeight = 2;
- client.setLayout(layout);
- toolkit.paintBordersFor(client);
-
- section.setClient(client);
- final SectionPart spart = new SectionPart(section);
- managedForm.addPart(spart);
- TreeViewer viewer = new TreeViewer(client);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 20;
- gd.widthHint = 100;
- viewer.getTree().setLayoutData(gd);
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- managedForm.fireSelectionChanged(spart, event.getSelection());
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener(){
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if(selection instanceof StructuredSelection){
- StructuredSelection structuredSelection = (StructuredSelection)selection;
- if(!structuredSelection.isEmpty()){
- Object o = structuredSelection.getFirstElement();
- if(o instanceof PhaseReport){
- runPhase((PhaseReport)o);
- }else if(o instanceof TargetReport){
- runTarget((TargetReport)o);
- }
- }
- }
- }
- });
- viewer.setContentProvider(buildLifeCycleContentProvider);
- viewer.setLabelProvider(buildLifecycleLabelProvider);
- viewer.setInput(page.getEditor().getEditorInput());
- // viewer.expandAll();
- }
-
- private void runPhase(final PhaseReport phase){
- Job job = new WorkspaceJob("Easyant running phase " + phase.getName() + "...") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- easyantProjectService.runBuild(getProject(), phase.getName(), getLogLevel(), monitor);
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
-
- private void runTarget(final TargetReport target){
- Job job = new WorkspaceJob("Easyant running target " + target.getName() + "...") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- easyantProjectService.runBuild(getProject(), target.getName(), getLogLevel(), monitor);
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
-
- private int getLogLevel(){
- int logLevel = EasyAntConstants.ANT_LOGLEVEL_WARN;
- if(enableInfoLogLevel){
- logLevel = EasyAntConstants.ANT_LOGLEVEL_INFO;
- }
- if(enableVerboseLogLevel){
- logLevel = EasyAntConstants.ANT_LOGLEVEL_VERBOSE;
- }
- if(enableDebugLogLevel){
- logLevel = EasyAntConstants.ANT_LOGLEVEL_DEBUG;
- }
- return logLevel;
- }
-
- protected void registerPages(DetailsPart detailsPart) {
- phaseDetailsPage.setProject(getProject());
- detailsPart.registerPage(PhaseReport.class, phaseDetailsPage);
- targetDetailsPage.setProject(getProject());
- detailsPart.registerPage(TargetReport.class, targetDetailsPage);
- }
-
- @Override
- protected void createToolBarActions(IManagedForm managedForm) {
- final ScrolledForm form = managedForm.getForm();
- Action setLogLevelAction = new LogLevelDropDownAction();
- form.getToolBarManager().add(setLogLevelAction);
- }
-
- private IProject getProject() {
- if (page.getEditor().getEditorInput() instanceof IFileEditorInput) {
- IFileEditorInput fileEditorInput = (IFileEditorInput) page.getEditor().getEditorInput();
- IFile ivyFile = fileEditorInput.getFile();
- return ivyFile.getProject();
- }
- return null;
- }
-
- private class LogLevelDropDownAction extends Action implements IMenuCreator {
- private Menu menu;
-
- public LogLevelDropDownAction(){
- super("setDebugLogLevel", Action.AS_DROP_DOWN_MENU);
- setMenuCreator(this);
- setToolTipText("Set the log level in console view.");
- setImageDescriptor(imageProvider.getDebugLogLevelImage());
- }
-
- public Menu getMenu(Menu parent) { return null; }
- public Menu getMenu(Control parent) {
- if (menu == null){
- menu = new Menu(parent);
- MenuItem info = new MenuItem(menu, SWT.CHECK);
- info.setText("INFO");
- info.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- enableInfoLogLevel=!enableInfoLogLevel;
- phaseDetailsPage.setLogLevel(getLogLevel());
- targetDetailsPage.setLogLevel(getLogLevel());
- }
- public void widgetDefaultSelected(SelectionEvent e) {}
- });
- MenuItem verbose = new MenuItem(menu, SWT.CHECK);
- verbose.setText("VERBOSE");
- verbose.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- enableVerboseLogLevel=!enableVerboseLogLevel;
- phaseDetailsPage.setLogLevel(getLogLevel());
- targetDetailsPage.setLogLevel(getLogLevel());
- }
- public void widgetDefaultSelected(SelectionEvent e) {}
- });
- MenuItem debug = new MenuItem(menu, SWT.CHECK);
- debug.setText("DEBUG");
- debug.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- enableDebugLogLevel=!enableDebugLogLevel;
- phaseDetailsPage.setLogLevel(getLogLevel());
- targetDetailsPage.setLogLevel(getLogLevel());
- }
- public void widgetDefaultSelected(SelectionEvent e) {}
- });
- }
- return menu;
- }
-
- public void dispose() {
- if (menu != null){
- menu.dispose();
- menu=null;
- }
- }
-
- public void run() {}
- }
-
-}
\ No newline at end of file
+ private BuildLifeCycleContentProvider buildLifeCycleContentProvider;
+ private BuildLifecycleLabelProvider buildLifecycleLabelProvider;
+ private EasyantProjectService easyantProjectService;
+ private PhaseDetailsPage phaseDetailsPage;
+ private TargetDetailsPage targetDetailsPage;
+ private EasyAntConsole console;
+ private ImageProvider imageProvider;
+ private boolean enableInfoLogLevel = false;
+ private boolean enableVerboseLogLevel = false;
+ private boolean enableDebugLogLevel = false;
+
+
+ public BuildLifecycleBlock() {}
+
+ @Inject
+ public void setImageProvider(ImageProvider imageProvider) {
+ this.imageProvider = imageProvider;
+ }
+
+ @Inject
+ public void setConsole(EasyAntConsole console) {
+ this.console = console;
+ }
+
+ @Inject
+ public void setPhaseDetailsPage(PhaseDetailsPage phaseDetailsPage) {
+ this.phaseDetailsPage = phaseDetailsPage;
+ }
+
+ @Inject
+ public void setTargetDetailsPage(TargetDetailsPage targetDetailsPage) {
+ this.targetDetailsPage = targetDetailsPage;
+ }
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
+
+ @Inject
+ public void setBuildLifecycleLabelProvider(BuildLifecycleLabelProvider buildLifecycleLabelProvider) {
+ this.buildLifecycleLabelProvider = buildLifecycleLabelProvider;
+ }
+
+ @Inject
+ public void setBuildLifeCycleContentProvider(BuildLifeCycleContentProvider buildLifeCycleContentProvider) {
+ this.buildLifeCycleContentProvider = buildLifeCycleContentProvider;
+ }
+
+ public void setPage(FormPage page) {
+ this.page = page;
+ }
+
+ @Override
+ protected void createMasterPart(final IManagedForm managedForm, final Composite parent) {
+ createBuildLifecyclePart(managedForm, parent);
+ }
+
+ protected void createBuildLifecyclePart(final IManagedForm managedForm, final Composite parent) {
+ FormToolkit toolkit = managedForm.getToolkit();
+ Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
+ section.setText("Build Lifecycle");
+ section.setDescription("The build lifecycle has the following build phases:");
+ section.marginWidth = 10;
+ section.marginHeight = 5;
+ Composite client = toolkit.createComposite(section, SWT.WRAP);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 2;
+ layout.marginHeight = 2;
+ client.setLayout(layout);
+ toolkit.paintBordersFor(client);
+
+ section.setClient(client);
+ final SectionPart spart = new SectionPart(section);
+ managedForm.addPart(spart);
+ TreeViewer viewer = new TreeViewer(client);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 20;
+ gd.widthHint = 100;
+ viewer.getTree().setLayoutData(gd);
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ managedForm.fireSelectionChanged(spart, event.getSelection());
+ }
+ });
+ viewer.addDoubleClickListener(new IDoubleClickListener(){
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if(selection instanceof StructuredSelection){
+ StructuredSelection structuredSelection = (StructuredSelection)selection;
+ if(!structuredSelection.isEmpty()){
+ Object o = structuredSelection.getFirstElement();
+ if(o instanceof PhaseReport){
+ runPhase((PhaseReport)o);
+ }else if(o instanceof TargetReport){
+ runTarget((TargetReport)o);
+ }
+ }
+ }
+ }
+ });
+ viewer.setContentProvider(buildLifeCycleContentProvider);
+ viewer.setLabelProvider(buildLifecycleLabelProvider);
+ viewer.setInput(page.getEditor().getEditorInput());
+ // viewer.expandAll();
+ }
+
+ private void runPhase(final PhaseReport phase){
+ Job job = new WorkspaceJob("Easyant running phase " + phase.getName() + "...") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ easyantProjectService.runBuild(getProject(), phase.getName(), getLogLevel(), monitor);
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+
+ private void runTarget(final TargetReport target){
+ Job job = new WorkspaceJob("Easyant running target " + target.getName() + "...") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ easyantProjectService.runBuild(getProject(), target.getName(), getLogLevel(), monitor);
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+
+ private int getLogLevel(){
+ int logLevel = EasyAntConstants.ANT_LOGLEVEL_WARN;
+ if(enableInfoLogLevel){
+ logLevel = EasyAntConstants.ANT_LOGLEVEL_INFO;
+ }
+ if(enableVerboseLogLevel){
+ logLevel = EasyAntConstants.ANT_LOGLEVEL_VERBOSE;
+ }
+ if(enableDebugLogLevel){
+ logLevel = EasyAntConstants.ANT_LOGLEVEL_DEBUG;
+ }
+ return logLevel;
+ }
+
+ protected void registerPages(DetailsPart detailsPart) {
+ phaseDetailsPage.setProject(getProject());
+ detailsPart.registerPage(PhaseReport.class, phaseDetailsPage);
+ targetDetailsPage.setProject(getProject());
+ detailsPart.registerPage(TargetReport.class, targetDetailsPage);
+ }
+
+ @Override
+ protected void createToolBarActions(IManagedForm managedForm) {
+ final ScrolledForm form = managedForm.getForm();
+ Action setLogLevelAction = new LogLevelDropDownAction();
+ form.getToolBarManager().add(setLogLevelAction);
+ }
+
+ private IProject getProject() {
+ if (page.getEditor().getEditorInput() instanceof IFileEditorInput) {
+ IFileEditorInput fileEditorInput = (IFileEditorInput) page.getEditor().getEditorInput();
+ IFile ivyFile = fileEditorInput.getFile();
+ return ivyFile.getProject();
+ }
+ return null;
+ }
+
+ private class LogLevelDropDownAction extends Action implements IMenuCreator {
+ private Menu menu;
+
+ public LogLevelDropDownAction(){
+ super("setDebugLogLevel", Action.AS_DROP_DOWN_MENU);
+ setMenuCreator(this);
+ setToolTipText("Set the log level in console view.");
+ setImageDescriptor(imageProvider.getDebugLogLevelImage());
+ }
+
+ public Menu getMenu(Menu parent) { return null; }
+ public Menu getMenu(Control parent) {
+ if (menu == null){
+ menu = new Menu(parent);
+ MenuItem info = new MenuItem(menu, SWT.CHECK);
+ info.setText("INFO");
+ info.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ enableInfoLogLevel=!enableInfoLogLevel;
+ phaseDetailsPage.setLogLevel(getLogLevel());
+ targetDetailsPage.setLogLevel(getLogLevel());
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ });
+ MenuItem verbose = new MenuItem(menu, SWT.CHECK);
+ verbose.setText("VERBOSE");
+ verbose.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ enableVerboseLogLevel=!enableVerboseLogLevel;
+ phaseDetailsPage.setLogLevel(getLogLevel());
+ targetDetailsPage.setLogLevel(getLogLevel());
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ });
+ MenuItem debug = new MenuItem(menu, SWT.CHECK);
+ debug.setText("DEBUG");
+ debug.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ enableDebugLogLevel=!enableDebugLogLevel;
+ phaseDetailsPage.setLogLevel(getLogLevel());
+ targetDetailsPage.setLogLevel(getLogLevel());
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ });
+ }
+ return menu;
+ }
+
+ public void dispose() {
+ if (menu != null){
+ menu.dispose();
+ menu=null;
+ }
+ }
+
+ public void run() {}
+ }
+
+}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleLabelProvider.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleLabelProvider.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleLabelProvider.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifecycleLabelProvider.java Tue Feb 22 15:09:30 2011
@@ -30,33 +30,33 @@ import com.google.inject.Inject;
public class BuildLifecycleLabelProvider extends BaseLabelProvider implements ILabelProvider {
- @Inject
- private ImageProvider imageProvider;
-
- public BuildLifecycleLabelProvider(){
-
- }
-
- public Image getImage(Object element) {
- if (element instanceof PhaseReport) {
- return imageProvider.getPhaseImage();
- }
- if (element instanceof TargetReport) {
- return imageProvider.getTargetImage();
- }
- return null;
- }
+ @Inject
+ private ImageProvider imageProvider;
+
+ public BuildLifecycleLabelProvider(){
+
+ }
+
+ public Image getImage(Object element) {
+ if (element instanceof PhaseReport) {
+ return imageProvider.getPhaseImage();
+ }
+ if (element instanceof TargetReport) {
+ return imageProvider.getTargetImage();
+ }
+ return null;
+ }
- public String getText(Object element) {
- if (element instanceof PhaseReport) {
- PhaseReport phaseReport = (PhaseReport) element;
- return phaseReport.getName();
- }
- if (element instanceof TargetReport) {
- TargetReport targetReport = (TargetReport) element;
- return targetReport.getName();
- }
- return element.toString();
- }
+ public String getText(Object element) {
+ if (element instanceof PhaseReport) {
+ PhaseReport phaseReport = (PhaseReport) element;
+ return phaseReport.getName();
+ }
+ if (element instanceof TargetReport) {
+ TargetReport targetReport = (TargetReport) element;
+ return targetReport.getName();
+ }
+ return element.toString();
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildPage.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildPage.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildPage.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildPage.java Tue Feb 22 15:09:30 2011
@@ -29,46 +29,46 @@ import com.google.inject.Inject;
public class BuildPage extends FormPage implements IvyEditorPage {
- private static final String ID = "build";
- private static final String NAME = "Build";
- private BuildLifecycleBlock buildLifecycleBlock;
- private ImageProvider imageProvider;
- private EasyAntConsole console;
-
- @Inject
- public void setEasyAntConsole(EasyAntConsole console){
- this.console = console;
- }
-
- @Inject
- public void setBuildLifecycleBlock(BuildLifecycleBlock buildLifecycleBlock) {
- this.buildLifecycleBlock = buildLifecycleBlock;
- }
-
- @Inject
- public void setImageProvider(ImageProvider imageProvider) {
- this.imageProvider = imageProvider;
- }
-
- public BuildPage() {
- super(ID, NAME);
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
- buildLifecycleBlock.setPage(this);
-
- final ScrolledForm form = managedForm.getForm();
- form.setText("EasyAnt Build");
- form.setBackgroundImage(imageProvider.getFormBackgroundImage());
- buildLifecycleBlock.createContent(managedForm);
-
- console.show();
- }
-
- public String getPageName() {
- return NAME;
- }
+ private static final String ID = "build";
+ private static final String NAME = "Build";
+ private BuildLifecycleBlock buildLifecycleBlock;
+ private ImageProvider imageProvider;
+ private EasyAntConsole console;
+
+ @Inject
+ public void setEasyAntConsole(EasyAntConsole console){
+ this.console = console;
+ }
+
+ @Inject
+ public void setBuildLifecycleBlock(BuildLifecycleBlock buildLifecycleBlock) {
+ this.buildLifecycleBlock = buildLifecycleBlock;
+ }
+
+ @Inject
+ public void setImageProvider(ImageProvider imageProvider) {
+ this.imageProvider = imageProvider;
+ }
+
+ public BuildPage() {
+ super(ID, NAME);
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+ buildLifecycleBlock.setPage(this);
+
+ final ScrolledForm form = managedForm.getForm();
+ form.setText("EasyAnt Build");
+ form.setBackgroundImage(imageProvider.getFormBackgroundImage());
+ buildLifecycleBlock.createContent(managedForm);
+
+ console.show();
+ }
+
+ public String getPageName() {
+ return NAME;
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/PhaseDetailsPage.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/PhaseDetailsPage.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/PhaseDetailsPage.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/PhaseDetailsPage.java Tue Feb 22 15:09:30 2011
@@ -53,153 +53,153 @@ import com.google.inject.Inject;
//import com.google.inject.Inject;
public class PhaseDetailsPage implements IDetailsPage {
- private IManagedForm mform;
- private PhaseReport phase;
- private IProject project;
-
- private Text description;
- private Text depends;
-
- private EasyantProjectService easyantProjectService;
-
- private ImageProvider imageProvider;
-
- private int logLevel=EasyAntConstants.ANT_LOGLEVEL_WARN;
-
- public void setLogLevel(int logLevel){
- this.logLevel=logLevel;
- }
-
- public PhaseDetailsPage() {
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
- @Inject
- public void setImageProvider(ImageProvider imageProvider) {
- this.imageProvider = imageProvider;
- }
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
-
- public void initialize(IManagedForm mform) {
- this.mform = mform;
- }
-
- public void createContents(Composite parent) {
- TableWrapLayout layout = new TableWrapLayout();
- layout.topMargin = 5;
- layout.leftMargin = 5;
- layout.rightMargin = 2;
- layout.bottomMargin = 2;
- parent.setLayout(layout);
-
- FormToolkit toolkit = mform.getToolkit();
- Section section1 = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
- section1.marginWidth = 10;
- section1.setText("Phase Details");
- section1
- .setDescription("Phases define an ordered set of build phases. Build phases are responsible for the build choreography at macro level.");
- TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
- td.grabHorizontal = true;
- section1.setLayoutData(td);
- Composite client = toolkit.createComposite(section1);
- GridLayout glayout = new GridLayout();
- glayout.marginWidth = glayout.marginHeight = 0;
- client.setLayout(glayout);
-
- createSpacer(toolkit, client, 2);
-
- toolkit.createLabel(client, "Description:");
- description = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
- GridData gdDescription = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gdDescription.widthHint = 10;
- description.setLayoutData(gdDescription);
-
- createSpacer(toolkit, client, 2);
-
- toolkit.createLabel(client, "Depends:");
- depends = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
- GridData gdDepends = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gdDepends.widthHint = 10;
- depends.setLayoutData(gdDepends);
-
- createSpacer(toolkit, client, 2);
-
- ImageHyperlink buildLink = toolkit.createImageHyperlink(client, SWT.NULL);
- buildLink.setText("Run this phase...");
- buildLink.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLUE));
- buildLink.setImage(imageProvider.getBuildImage());
- buildLink.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- Job job = new WorkspaceJob("Easyant running phase " + phase.getName() + "...") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- easyantProjectService.runBuild(project, phase.getName(), logLevel, monitor);
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
- });
-
- section1.setClient(client);
- }
-
- private void createSpacer(FormToolkit toolkit, Composite parent, int span) {
- Label spacer = toolkit.createLabel(parent, ""); //$NON-NLS-1$
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- spacer.setLayoutData(gd);
- }
-
- private void update() {
- if (phase.getDescription() != null) {
- description.setText(phase.getDescription());
- }
- if (phase.getDepends() != null) {
- depends.setText(phase.getDepends());
- }
- }
-
- public void selectionChanged(IFormPart part, ISelection selection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- if (ssel.size() == 1) {
- phase = (PhaseReport) ssel.getFirstElement();
- } else {
- phase = null;
- }
- update();
- }
-
- public void commit(boolean onSave) {
- }
-
- public void setFocus() {
- }
-
- public void dispose() {
- }
-
- public boolean isDirty() {
- return false;
- }
-
- public boolean isStale() {
- return false;
- }
-
- public void refresh() {
- update();
- }
-
- public boolean setFormInput(Object input) {
- return false;
- }
+ private IManagedForm mform;
+ private PhaseReport phase;
+ private IProject project;
+
+ private Text description;
+ private Text depends;
+
+ private EasyantProjectService easyantProjectService;
+
+ private ImageProvider imageProvider;
+
+ private int logLevel=EasyAntConstants.ANT_LOGLEVEL_WARN;
+
+ public void setLogLevel(int logLevel){
+ this.logLevel=logLevel;
+ }
+
+ public PhaseDetailsPage() {
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ @Inject
+ public void setImageProvider(ImageProvider imageProvider) {
+ this.imageProvider = imageProvider;
+ }
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
+
+ public void initialize(IManagedForm mform) {
+ this.mform = mform;
+ }
+
+ public void createContents(Composite parent) {
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 5;
+ layout.leftMargin = 5;
+ layout.rightMargin = 2;
+ layout.bottomMargin = 2;
+ parent.setLayout(layout);
+
+ FormToolkit toolkit = mform.getToolkit();
+ Section section1 = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
+ section1.marginWidth = 10;
+ section1.setText("Phase Details");
+ section1
+ .setDescription("Phases define an ordered set of build phases. Build phases are responsible for the build choreography at macro level.");
+ TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
+ td.grabHorizontal = true;
+ section1.setLayoutData(td);
+ Composite client = toolkit.createComposite(section1);
+ GridLayout glayout = new GridLayout();
+ glayout.marginWidth = glayout.marginHeight = 0;
+ client.setLayout(glayout);
+
+ createSpacer(toolkit, client, 2);
+
+ toolkit.createLabel(client, "Description:");
+ description = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
+ GridData gdDescription = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ gdDescription.widthHint = 10;
+ description.setLayoutData(gdDescription);
+
+ createSpacer(toolkit, client, 2);
+
+ toolkit.createLabel(client, "Depends:");
+ depends = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
+ GridData gdDepends = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ gdDepends.widthHint = 10;
+ depends.setLayoutData(gdDepends);
+
+ createSpacer(toolkit, client, 2);
+
+ ImageHyperlink buildLink = toolkit.createImageHyperlink(client, SWT.NULL);
+ buildLink.setText("Run this phase...");
+ buildLink.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ buildLink.setImage(imageProvider.getBuildImage());
+ buildLink.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ Job job = new WorkspaceJob("Easyant running phase " + phase.getName() + "...") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ easyantProjectService.runBuild(project, phase.getName(), logLevel, monitor);
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ });
+
+ section1.setClient(client);
+ }
+
+ private void createSpacer(FormToolkit toolkit, Composite parent, int span) {
+ Label spacer = toolkit.createLabel(parent, ""); //$NON-NLS-1$
+ GridData gd = new GridData();
+ gd.horizontalSpan = span;
+ spacer.setLayoutData(gd);
+ }
+
+ private void update() {
+ if (phase.getDescription() != null) {
+ description.setText(phase.getDescription());
+ }
+ if (phase.getDepends() != null) {
+ depends.setText(phase.getDepends());
+ }
+ }
+
+ public void selectionChanged(IFormPart part, ISelection selection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() == 1) {
+ phase = (PhaseReport) ssel.getFirstElement();
+ } else {
+ phase = null;
+ }
+ update();
+ }
+
+ public void commit(boolean onSave) {
+ }
+
+ public void setFocus() {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isDirty() {
+ return false;
+ }
+
+ public boolean isStale() {
+ return false;
+ }
+
+ public void refresh() {
+ update();
+ }
+
+ public boolean setFormInput(Object input) {
+ return false;
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/TargetDetailsPage.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/TargetDetailsPage.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/TargetDetailsPage.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/TargetDetailsPage.java Tue Feb 22 15:09:30 2011
@@ -51,152 +51,152 @@ import org.eclipse.ui.forms.widgets.Tabl
import com.google.inject.Inject;
public class TargetDetailsPage implements IDetailsPage {
- private IManagedForm mform;
- private TargetReport target;
+ private IManagedForm mform;
+ private TargetReport target;
- private IProject project;
+ private IProject project;
- private Text description;
- private Text depends;
-
- private EasyantProjectService easyantProjectService;
-
- private ImageProvider imageProvider;
-
- private int logLevel=EasyAntConstants.ANT_LOGLEVEL_WARN;
-
- public void setLogLevel(int logLevel){
- this.logLevel=logLevel;
- }
-
- public TargetDetailsPage() {}
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
- @Inject
- public void setImageProvider(ImageProvider imageProvider) {
- this.imageProvider = imageProvider;
- }
-
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
-
- public void createContents(Composite parent) {
- TableWrapLayout layout = new TableWrapLayout();
- layout.topMargin = 5;
- layout.leftMargin = 5;
- layout.rightMargin = 2;
- layout.bottomMargin = 2;
- parent.setLayout(layout);
-
- FormToolkit toolkit = mform.getToolkit();
- Section section1 = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
- section1.marginWidth = 10;
- section1.setText("Target Details");
- section1.setDescription("Targets define a build unit.");
- TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
- td.grabHorizontal = true;
- section1.setLayoutData(td);
- Composite client = toolkit.createComposite(section1);
- GridLayout glayout = new GridLayout();
- glayout.marginWidth = glayout.marginHeight = 0;
- client.setLayout(glayout);
-
- createSpacer(toolkit, client, 2);
-
- toolkit.createLabel(client, "Description:");
- description = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
- GridData gdDescription = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gdDescription.widthHint = 10;
- description.setLayoutData(gdDescription);
-
- createSpacer(toolkit, client, 2);
-
- toolkit.createLabel(client, "Depends:");
- depends = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
- GridData gdDepends = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gdDepends.widthHint = 10;
- depends.setLayoutData(gdDepends);
-
- createSpacer(toolkit, client, 2);
-
- ImageHyperlink buildLink = toolkit.createImageHyperlink(client, SWT.NULL);
- buildLink.setText("Run this target...");
- buildLink.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLUE));
- buildLink.setImage(imageProvider.getBuildImage());
- buildLink.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- Job job = new WorkspaceJob("Easyant running target " + target.getName() + "...") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- easyantProjectService.runBuild(project, target.getName(), logLevel, monitor);
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
- });
- section1.setClient(client);
- }
-
- private void createSpacer(FormToolkit toolkit, Composite parent, int span) {
- Label spacer = toolkit.createLabel(parent, ""); //$NON-NLS-1$
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- spacer.setLayoutData(gd);
- }
-
- public void initialize(IManagedForm form) {
- this.mform = form;
- }
-
- public void selectionChanged(IFormPart part, ISelection selection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- if (ssel.size() == 1) {
- target = (TargetReport) ssel.getFirstElement();
- } else {
- target = null;
- }
- update();
- }
-
- private void update() {
- if(target.getDescription()!=null){
- description.setText(target.getDescription());
- }
- if(target.getDepends()!=null){
- depends.setText(target.getDepends());
- }
- }
-
-
- public void commit(boolean onSave) {
- }
-
- public void dispose() {
- }
-
- public boolean isDirty() {
- return false;
- }
-
- public boolean isStale() {
- return false;
- }
-
- public void refresh() {
- }
-
- public void setFocus() {
- }
-
- public boolean setFormInput(Object input) {
- return false;
- }
+ private Text description;
+ private Text depends;
+
+ private EasyantProjectService easyantProjectService;
+
+ private ImageProvider imageProvider;
+
+ private int logLevel=EasyAntConstants.ANT_LOGLEVEL_WARN;
+
+ public void setLogLevel(int logLevel){
+ this.logLevel=logLevel;
+ }
+
+ public TargetDetailsPage() {}
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ @Inject
+ public void setImageProvider(ImageProvider imageProvider) {
+ this.imageProvider = imageProvider;
+ }
+
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
+
+ public void createContents(Composite parent) {
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 5;
+ layout.leftMargin = 5;
+ layout.rightMargin = 2;
+ layout.bottomMargin = 2;
+ parent.setLayout(layout);
+
+ FormToolkit toolkit = mform.getToolkit();
+ Section section1 = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
+ section1.marginWidth = 10;
+ section1.setText("Target Details");
+ section1.setDescription("Targets define a build unit.");
+ TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
+ td.grabHorizontal = true;
+ section1.setLayoutData(td);
+ Composite client = toolkit.createComposite(section1);
+ GridLayout glayout = new GridLayout();
+ glayout.marginWidth = glayout.marginHeight = 0;
+ client.setLayout(glayout);
+
+ createSpacer(toolkit, client, 2);
+
+ toolkit.createLabel(client, "Description:");
+ description = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
+ GridData gdDescription = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ gdDescription.widthHint = 10;
+ description.setLayoutData(gdDescription);
+
+ createSpacer(toolkit, client, 2);
+
+ toolkit.createLabel(client, "Depends:");
+ depends = toolkit.createText(client, "", SWT.MULTI | SWT.WRAP);
+ GridData gdDepends = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ gdDepends.widthHint = 10;
+ depends.setLayoutData(gdDepends);
+
+ createSpacer(toolkit, client, 2);
+
+ ImageHyperlink buildLink = toolkit.createImageHyperlink(client, SWT.NULL);
+ buildLink.setText("Run this target...");
+ buildLink.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ buildLink.setImage(imageProvider.getBuildImage());
+ buildLink.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ Job job = new WorkspaceJob("Easyant running target " + target.getName() + "...") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ easyantProjectService.runBuild(project, target.getName(), logLevel, monitor);
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ });
+ section1.setClient(client);
+ }
+
+ private void createSpacer(FormToolkit toolkit, Composite parent, int span) {
+ Label spacer = toolkit.createLabel(parent, ""); //$NON-NLS-1$
+ GridData gd = new GridData();
+ gd.horizontalSpan = span;
+ spacer.setLayoutData(gd);
+ }
+
+ public void initialize(IManagedForm form) {
+ this.mform = form;
+ }
+
+ public void selectionChanged(IFormPart part, ISelection selection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() == 1) {
+ target = (TargetReport) ssel.getFirstElement();
+ } else {
+ target = null;
+ }
+ update();
+ }
+
+ private void update() {
+ if(target.getDescription()!=null){
+ description.setText(target.getDescription());
+ }
+ if(target.getDepends()!=null){
+ depends.setText(target.getDepends());
+ }
+ }
+
+
+ public void commit(boolean onSave) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isDirty() {
+ return false;
+ }
+
+ public boolean isStale() {
+ return false;
+ }
+
+ public void refresh() {
+ }
+
+ public void setFocus() {
+ }
+
+ public boolean setFormInput(Object input) {
+ return false;
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAnt4EclipseModule.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAnt4EclipseModule.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAnt4EclipseModule.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAnt4EclipseModule.java Tue Feb 22 15:09:30 2011
@@ -38,25 +38,25 @@ import com.google.inject.Singleton;
public class EasyAnt4EclipseModule extends AbstractModule{
- @Override
- protected void configure() {
- bind(EasyAntConsole.class).to(EasyAntConsoleImpl.class).in(Singleton.class);
- bind(ImageProvider.class).to(ImageProviderImpl.class).in(Singleton.class);
- bind(EasyantCoreService.class).to(EasyantCoreServiceImpl.class).in(Singleton.class);
- bind(EasyantProjectService.class).to(EasyantProjectServiceImpl.class).in(Singleton.class);
-
- bind(BuildLifecycleBlock.class).in(Singleton.class);
- bind(BuildLifeCycleContentProvider.class).in(Singleton.class);
- bind(BuildLifecycleLabelProvider.class).in(Singleton.class);
- bind(PhaseDetailsPage.class).in(Singleton.class);
- bind(TargetDetailsPage.class).in(Singleton.class);
-
- bind(EasyAntImportWizardPage.class);//.in(Singleton.class);
-
- // Bind to instance
+ @Override
+ protected void configure() {
+ bind(EasyAntConsole.class).to(EasyAntConsoleImpl.class).in(Singleton.class);
+ bind(ImageProvider.class).to(ImageProviderImpl.class).in(Singleton.class);
+ bind(EasyantCoreService.class).to(EasyantCoreServiceImpl.class).in(Singleton.class);
+ bind(EasyantProjectService.class).to(EasyantProjectServiceImpl.class).in(Singleton.class);
+
+ bind(BuildLifecycleBlock.class).in(Singleton.class);
+ bind(BuildLifeCycleContentProvider.class).in(Singleton.class);
+ bind(BuildLifecycleLabelProvider.class).in(Singleton.class);
+ bind(PhaseDetailsPage.class).in(Singleton.class);
+ bind(TargetDetailsPage.class).in(Singleton.class);
+
+ bind(EasyAntImportWizardPage.class);//.in(Singleton.class);
+
+ // Bind to instance
//binder.bind(Appendable.class).toInstance(System.out);
-
- }
+
+ }
-
+
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAntCoreModule.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAntCoreModule.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAntCoreModule.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/modules/EasyAntCoreModule.java Tue Feb 22 15:09:30 2011
@@ -32,17 +32,17 @@ import com.google.inject.Singleton;
public class EasyAntCoreModule extends AbstractModule{
- @Override
- protected void configure() {
- bind(EasyAntEngine.class).toProvider(new Provider<EasyAntEngine>() {
- public EasyAntEngine get() {
- URL url = Activator.getDefault().getBundle().getResource(PLUGINS_SETTINGS);
- EasyAntConfiguration configuration= EasyantConfigurationFactory.getInstance().createDefaultConfiguration();
- configuration.setEasyantIvySettingsUrl(url);
- return new EasyAntEngine(configuration);
- }
-
- }).in(Singleton.class);
- }
+ @Override
+ protected void configure() {
+ bind(EasyAntEngine.class).toProvider(new Provider<EasyAntEngine>() {
+ public EasyAntEngine get() {
+ URL url = Activator.getDefault().getBundle().getResource(PLUGINS_SETTINGS);
+ EasyAntConfiguration configuration= EasyantConfigurationFactory.getInstance().createDefaultConfiguration();
+ configuration.setEasyantIvySettingsUrl(url);
+ return new EasyAntEngine(configuration);
+ }
+
+ }).in(Singleton.class);
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureAction.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureAction.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureAction.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureAction.java Tue Feb 22 15:09:30 2011
@@ -34,43 +34,43 @@ import com.google.inject.Inject;
* Add the EasyAnt nature to the project.
*/
public class AddEasyAntNatureAction implements IObjectActionDelegate {
-
- // The selected project
- private IProject selectedProject;
- private EasyantProjectService easyantProjectService;
+
+ // The selected project
+ private IProject selectedProject;
+ private EasyantProjectService easyantProjectService;
- public AddEasyAntNatureAction(){
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
+ public AddEasyAntNatureAction(){
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
- public void run(IAction action) {
- if (selectedProject != null) {
- // Add the nature on the selected project
- easyantProjectService.addNature(selectedProject);
- }
- }
+ public void run(IAction action) {
+ if (selectedProject != null) {
+ // Add the nature on the selected project
+ easyantProjectService.addNature(selectedProject);
+ }
+ }
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- if (!structuredSelection.isEmpty() && structuredSelection.getFirstElement() instanceof IProject) {
- IProject project = (IProject) structuredSelection.getFirstElement();
- if (project.isAccessible()) {
- this.selectedProject = project;
- if (action != null) {
- action.setEnabled(!easyantProjectService.hasEasyAntNature(project));
- }
- }
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structuredSelection = (StructuredSelection) selection;
+ if (!structuredSelection.isEmpty() && structuredSelection.getFirstElement() instanceof IProject) {
+ IProject project = (IProject) structuredSelection.getFirstElement();
+ if (project.isAccessible()) {
+ this.selectedProject = project;
+ if (action != null) {
+ action.setEnabled(!easyantProjectService.hasEasyAntNature(project));
+ }
+ }
- }
- }
- }
+ }
+ }
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureOperation.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureOperation.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureOperation.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/AddEasyAntNatureOperation.java Tue Feb 22 15:09:30 2011
@@ -32,31 +32,31 @@ import org.eclipse.jface.operation.IRunn
*/
public class AddEasyAntNatureOperation implements IRunnableWithProgress {
- private IProject project;
+ private IProject project;
- public AddEasyAntNatureOperation(IProject project) {
- this.project = project;
- }
+ public AddEasyAntNatureOperation(IProject project) {
+ this.project = project;
+ }
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (project != null) {
- try {
- if (!project.hasNature(EasyAntNature.NATURE_ID)) {
- monitor.subTask("Add the EasyAnt nature to the project " + project.getName());
- IProjectDescription description = project.getDescription();
- String[] oldNatures = description.getNatureIds();
- String[] newNatures = new String[oldNatures.length + 1];
- System.arraycopy(oldNatures, 0, newNatures, 1, oldNatures.length);
- newNatures[0] = EasyAntNature.NATURE_ID;
- description.setNatureIds(newNatures);
- project.setDescription(description, new SubProgressMonitor(monitor, 1));
- }
- } catch (CoreException e) {
- Activator.getEasyAntPlugin().log(e);
- }
- monitor.done();
- }
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ if (project != null) {
+ try {
+ if (!project.hasNature(EasyAntNature.NATURE_ID)) {
+ monitor.subTask("Add the EasyAnt nature to the project " + project.getName());
+ IProjectDescription description = project.getDescription();
+ String[] oldNatures = description.getNatureIds();
+ String[] newNatures = new String[oldNatures.length + 1];
+ System.arraycopy(oldNatures, 0, newNatures, 1, oldNatures.length);
+ newNatures[0] = EasyAntNature.NATURE_ID;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, new SubProgressMonitor(monitor, 1));
+ }
+ } catch (CoreException e) {
+ Activator.getEasyAntPlugin().log(e);
+ }
+ monitor.done();
+ }
- }
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java Tue Feb 22 15:09:30 2011
@@ -53,192 +53,192 @@ import com.google.inject.Inject;
*/
public class EasyAntNature implements IProjectNature {
- public static final String NATURE_ID = "org.apache.easyant4e.EasyAntNature";
+ public static final String NATURE_ID = "org.apache.easyant4e.EasyAntNature";
- public static final String BUILDER_ID = "org.apache.easyant4e.EasyAntBuilder";
+ public static final String BUILDER_ID = "org.apache.easyant4e.EasyAntBuilder";
- public EasyAntNature(){
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- /**
- * The project to which this project nature applies.
- */
- private IProject project = null;
-
- private EasyantProjectService easyantProjectService;
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService){
- this.easyantProjectService = easyantProjectService;
- }
-
-
- public void configure() throws CoreException {
- //TODO maybe add an extension point to delegate this step for java, scala, ...
- //Configurer.configure(IProject, EasyAntModuleDescriptor);
- //Add Java Nature
- //TODO add checkbox or list of configurer (reuse by skeleton) in import and new project wizard to add JavaNature, ScalaNature, GroovyNature ...
- //or use a dedicated eclipse plugin ?
- if (!project.hasNature(JavaCore.NATURE_ID)) {
- IProjectDescription desc = project.getDescription();
- List<String> natures = new ArrayList<String>();
- natures.addAll(Arrays.asList(desc.getNatureIds()));
- natures.add(JavaCore.NATURE_ID);
- desc.setNatureIds(natures.toArray(new String[natures.size()]));
- project.setDescription(desc, null);
- }
-
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
- //flush classpath
- javaProject.setRawClasspath(new IClasspathEntry[0], null);
- addSourceFolders(javaProject);
- addDefaultJREContainer(javaProject);
- addIvyClasspathContainer();
- addBuilder(BUILDER_ID);
- }
- }
-
- private void addIvyClasspathContainer() {
- /*
- IPath projectRelativePath = new Path("module.ivy");
- IJavaProject javaProject = JavaCore.create(project);
- IClasspathEntry newEntry = JavaCore.newContainerEntry(new Path(
+ public EasyAntNature(){
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ /**
+ * The project to which this project nature applies.
+ */
+ private IProject project = null;
+
+ private EasyantProjectService easyantProjectService;
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService){
+ this.easyantProjectService = easyantProjectService;
+ }
+
+
+ public void configure() throws CoreException {
+ //TODO maybe add an extension point to delegate this step for java, scala, ...
+ //Configurer.configure(IProject, EasyAntModuleDescriptor);
+ //Add Java Nature
+ //TODO add checkbox or list of configurer (reuse by skeleton) in import and new project wizard to add JavaNature, ScalaNature, GroovyNature ...
+ //or use a dedicated eclipse plugin ?
+ if (!project.hasNature(JavaCore.NATURE_ID)) {
+ IProjectDescription desc = project.getDescription();
+ List<String> natures = new ArrayList<String>();
+ natures.addAll(Arrays.asList(desc.getNatureIds()));
+ natures.add(JavaCore.NATURE_ID);
+ desc.setNatureIds(natures.toArray(new String[natures.size()]));
+ project.setDescription(desc, null);
+ }
+
+ if (project.hasNature(JavaCore.NATURE_ID)) {
+ IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
+ //flush classpath
+ javaProject.setRawClasspath(new IClasspathEntry[0], null);
+ addSourceFolders(javaProject);
+ addDefaultJREContainer(javaProject);
+ addIvyClasspathContainer();
+ addBuilder(BUILDER_ID);
+ }
+ }
+
+ private void addIvyClasspathContainer() {
+ /*
+ IPath projectRelativePath = new Path("module.ivy");
+ IJavaProject javaProject = JavaCore.create(project);
+ IClasspathEntry newEntry = JavaCore.newContainerEntry(new Path(
IvyClasspathContainer.CONTAINER_ID).append(projectRelativePath).append(confs));
- */
- IJavaProject javaProject = JavaCore.create(project);
- //Configure project preferences
- StringBuffer projectConf = new StringBuffer();
- //TODO search *.ivy file
- projectConf.append("?ivyXmlPath=module.ivy");
- try {
- appendConfProp(projectConf, "confs", "*");
- appendConfProp(projectConf, "resolveInWorkspace", Boolean.TRUE.toString());
- String projectIvySettings = easyantProjectService.getProperty(javaProject.getProject(), "project.ivy.settings.url").getValue();
- if(projectIvySettings==null){
- projectIvySettings = easyantProjectService.getProperty(javaProject.getProject(), "project.ivy.settings.file").getValue();
- if(projectIvySettings!=null){
- projectIvySettings = "file://"+resolveRelativePath(projectIvySettings);
- }
- }
- if(projectIvySettings!=null){
- appendConfProp(projectConf, "ivySettingsPath", projectIvySettings);
- }
- } catch (UnsupportedEncodingException e) {
- Activator.getEasyAntPlugin().log(IStatus.ERROR, e.getMessage(), e);
- }
-
- // add the classpath entry
- IPath path = new Path(IvyClasspathContainer.CONTAINER_ID).append(projectConf.toString());
- IClasspathEntry newEntry = JavaCore.newContainerEntry(path);
- addClassPathEntry(javaProject, newEntry);
- }
-
- private String resolveRelativePath(String path){
- if(path!=null && path.startsWith(".")){
- String projectPath = project.getLocation().toPortableString();
- path= new File(projectPath+"/"+path).getAbsolutePath();
- }
- return path;
- }
-
- private void appendConfProp(StringBuffer path, String name, String value) throws UnsupportedEncodingException {
- path.append('&');
- path.append(name);
- path.append('=');
- path.append(URLEncoder.encode(value, "UTF-8"));
- }
-
- //FIXME with scala project or others
- private void addSourceFolders(IJavaProject javaProject)throws CoreException {
- PropertyDescriptor srcMainJavaProp = easyantProjectService.getProperty(project, "src.main.java");
- String srcMainJava = removeBaseDirVar(srcMainJavaProp.getValue());
- PropertyDescriptor srcMainResourcesProp = easyantProjectService.getProperty(project, "src.main.resources");
- String srcMainResources = removeBaseDirVar(srcMainResourcesProp.getValue());
- PropertyDescriptor srcTestJavaProp = easyantProjectService.getProperty(project, "src.test.java");
- String srcTestJava = removeBaseDirVar(srcTestJavaProp.getValue());
- PropertyDescriptor srcTestResourcesProp = easyantProjectService.getProperty(project, "src.test.resources");
- String srcTestResources = removeBaseDirVar(srcTestResourcesProp.getValue());
- addSourceFolders(javaProject, srcMainJava,srcMainResources, srcTestJava, srcTestResources);
- }
-
- private String removeBaseDirVar(String s){
- String baseDirVar = "${basedir}";
- if(s!=null && s.contains(baseDirVar)){
- return s.substring(s.indexOf(baseDirVar)+baseDirVar.length()+1);
- }else{
- return s;
- }
- }
-
- public void deconfigure() throws CoreException {
- if (project.hasNature(JavaCore.NATURE_ID)) {
- removeBuilder(BUILDER_ID);
- removeIvyClasspathContainer();
- }
- }
-
- public IProject getProject() {
- return project;
- }
-
- public void setProject(IProject project) {
- this.project = project;
-
- }
-
- private void addDefaultJREContainer(IJavaProject javaProject) throws JavaModelException{
- List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
- entries.add(JavaRuntime.getDefaultJREContainerEntry());
- javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
-
- }
-
- private void addSourceFolders(IJavaProject javaProject, String...path) throws JavaModelException{
- List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
- IResource outputLocation = javaProject.getProject().findMember("target");
- if(outputLocation==null){
- outputLocation = createSourceFolder(javaProject.getProject(), "target");
- }
- javaProject.setOutputLocation(outputLocation.getFullPath(), null);
- for(String p : path){
- IResource sourceFolder = javaProject.getProject().findMember(p);
- if(sourceFolder==null){
- sourceFolder = createSourceFolder(javaProject.getProject(), p);
- }
- if(sourceFolder!=null){
- IPath[] exclusionPatterns = new IPath[] { outputLocation.getFullPath() };
- IClasspathEntry srcEntry = JavaCore.newSourceEntry(sourceFolder.getFullPath(),exclusionPatterns, outputLocation.getFullPath());
- entries.add(srcEntry);
- }
- }
- javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
- }
-
- private IResource createSourceFolder( IProject project, String sourcefolder ){
- IPath path = new Path(sourcefolder);
- IContainer container = project;
- try {
- for (int i = 1; i <= path.segmentCount(); i++) {
- IFolder newSourceFolder = project.getFolder( path.uptoSegment( i ) );
- if (!newSourceFolder.exists()) {
- newSourceFolder.create( true, true, null );
- }
- container = newSourceFolder;
- }
- return container;
- } catch (CoreException e) {
- Activator.getEasyAntPlugin().log(e);
- return null;
- }
- }
-
- private void addClassPathEntry(IJavaProject javaProject, IClasspathEntry newEntry){
- try {
- IClasspathEntry[] entries = javaProject.getRawClasspath();
+ */
+ IJavaProject javaProject = JavaCore.create(project);
+ //Configure project preferences
+ StringBuffer projectConf = new StringBuffer();
+ //TODO search *.ivy file
+ projectConf.append("?ivyXmlPath=module.ivy");
+ try {
+ appendConfProp(projectConf, "confs", "*");
+ appendConfProp(projectConf, "resolveInWorkspace", Boolean.TRUE.toString());
+ String projectIvySettings = easyantProjectService.getProperty(javaProject.getProject(), "project.ivy.settings.url").getValue();
+ if(projectIvySettings==null){
+ projectIvySettings = easyantProjectService.getProperty(javaProject.getProject(), "project.ivy.settings.file").getValue();
+ if(projectIvySettings!=null){
+ projectIvySettings = "file://"+resolveRelativePath(projectIvySettings);
+ }
+ }
+ if(projectIvySettings!=null){
+ appendConfProp(projectConf, "ivySettingsPath", projectIvySettings);
+ }
+ } catch (UnsupportedEncodingException e) {
+ Activator.getEasyAntPlugin().log(IStatus.ERROR, e.getMessage(), e);
+ }
+
+ // add the classpath entry
+ IPath path = new Path(IvyClasspathContainer.CONTAINER_ID).append(projectConf.toString());
+ IClasspathEntry newEntry = JavaCore.newContainerEntry(path);
+ addClassPathEntry(javaProject, newEntry);
+ }
+
+ private String resolveRelativePath(String path){
+ if(path!=null && path.startsWith(".")){
+ String projectPath = project.getLocation().toPortableString();
+ path= new File(projectPath+"/"+path).getAbsolutePath();
+ }
+ return path;
+ }
+
+ private void appendConfProp(StringBuffer path, String name, String value) throws UnsupportedEncodingException {
+ path.append('&');
+ path.append(name);
+ path.append('=');
+ path.append(URLEncoder.encode(value, "UTF-8"));
+ }
+
+ //FIXME with scala project or others
+ private void addSourceFolders(IJavaProject javaProject)throws CoreException {
+ PropertyDescriptor srcMainJavaProp = easyantProjectService.getProperty(project, "src.main.java");
+ String srcMainJava = removeBaseDirVar(srcMainJavaProp.getValue());
+ PropertyDescriptor srcMainResourcesProp = easyantProjectService.getProperty(project, "src.main.resources");
+ String srcMainResources = removeBaseDirVar(srcMainResourcesProp.getValue());
+ PropertyDescriptor srcTestJavaProp = easyantProjectService.getProperty(project, "src.test.java");
+ String srcTestJava = removeBaseDirVar(srcTestJavaProp.getValue());
+ PropertyDescriptor srcTestResourcesProp = easyantProjectService.getProperty(project, "src.test.resources");
+ String srcTestResources = removeBaseDirVar(srcTestResourcesProp.getValue());
+ addSourceFolders(javaProject, srcMainJava,srcMainResources, srcTestJava, srcTestResources);
+ }
+
+ private String removeBaseDirVar(String s){
+ String baseDirVar = "${basedir}";
+ if(s!=null && s.contains(baseDirVar)){
+ return s.substring(s.indexOf(baseDirVar)+baseDirVar.length()+1);
+ }else{
+ return s;
+ }
+ }
+
+ public void deconfigure() throws CoreException {
+ if (project.hasNature(JavaCore.NATURE_ID)) {
+ removeBuilder(BUILDER_ID);
+ removeIvyClasspathContainer();
+ }
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+
+ }
+
+ private void addDefaultJREContainer(IJavaProject javaProject) throws JavaModelException{
+ List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
+ entries.add(JavaRuntime.getDefaultJREContainerEntry());
+ javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
+
+ }
+
+ private void addSourceFolders(IJavaProject javaProject, String...path) throws JavaModelException{
+ List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
+ IResource outputLocation = javaProject.getProject().findMember("target");
+ if(outputLocation==null){
+ outputLocation = createSourceFolder(javaProject.getProject(), "target");
+ }
+ javaProject.setOutputLocation(outputLocation.getFullPath(), null);
+ for(String p : path){
+ IResource sourceFolder = javaProject.getProject().findMember(p);
+ if(sourceFolder==null){
+ sourceFolder = createSourceFolder(javaProject.getProject(), p);
+ }
+ if(sourceFolder!=null){
+ IPath[] exclusionPatterns = new IPath[] { outputLocation.getFullPath() };
+ IClasspathEntry srcEntry = JavaCore.newSourceEntry(sourceFolder.getFullPath(),exclusionPatterns, outputLocation.getFullPath());
+ entries.add(srcEntry);
+ }
+ }
+ javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
+ }
+
+ private IResource createSourceFolder( IProject project, String sourcefolder ){
+ IPath path = new Path(sourcefolder);
+ IContainer container = project;
+ try {
+ for (int i = 1; i <= path.segmentCount(); i++) {
+ IFolder newSourceFolder = project.getFolder( path.uptoSegment( i ) );
+ if (!newSourceFolder.exists()) {
+ newSourceFolder.create( true, true, null );
+ }
+ container = newSourceFolder;
+ }
+ return container;
+ } catch (CoreException e) {
+ Activator.getEasyAntPlugin().log(e);
+ return null;
+ }
+ }
+
+ private void addClassPathEntry(IJavaProject javaProject, IClasspathEntry newEntry){
+ try {
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
List newEntries = new ArrayList(Arrays.asList(entries));
newEntries.add(newEntry);
entries = (IClasspathEntry[]) newEntries.toArray(new IClasspathEntry[newEntries.size()]);
@@ -248,73 +248,73 @@ public class EasyAntNature implements IP
// unless there are issues with the JDT, this should never happen
Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot add ClassPath entry", e);
}
- }
-
- private void removeIvyClasspathContainer() {
- IJavaProject javaProject = JavaCore.create(project);
- ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
- //FIXME call IvyDE command
- try {
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- for (int i = 0; i < entries.length; i++) {
- IClasspathEntry entry = entries[i];
- if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
- IPath path = entry.getPath();
- if (IvyClasspathUtil.isIvyClasspathContainer(path)) {
- continue;
- }
- }
- newEntries.add(entry);
- }
- // TODO add progress monitor
- IClasspathEntry[] newClasspathEntries = newEntries.toArray(new IClasspathEntry[newEntries.size()]);
- javaProject.setRawClasspath(newClasspathEntries, null);
- } catch (JavaModelException e) {
- Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot remove Ivy ClassPath container", e);
- }
- }
-
- private void addBuilder(String builderID) throws CoreException {
- if (!isBuilderApplied(builderID)) {
- IProjectDescription description = getProject().getDescription();
- ICommand[] commands = description.getBuildSpec();
- ICommand command = description.newCommand();
- command.setBuilderName(builderID);
- ICommand[] newCommands = new ICommand[commands.length + 1];
- System.arraycopy(commands, 0, newCommands, 0, commands.length);
- newCommands[commands.length] = command;
- description.setBuildSpec(newCommands);
- getProject().setDescription(description, null);
- }
- }
-
- private void removeBuilder(String builderID) throws CoreException {
- if (isBuilderApplied(builderID)) {
- IProjectDescription description = getProject().getDescription();
- ICommand[] commands = description.getBuildSpec();
- ICommand[] newCommands = new ICommand[commands.length - 1];
- int i = 0;
- for (ICommand command : commands) {
- if (command.getBuilderName().equals(builderID)) {
- // Remove the given builder
- } else {
- newCommands[i] = command;
- i++;
- }
- }
- description.setBuildSpec(newCommands);
- getProject().setDescription(description, null);
- }
- }
-
- private boolean isBuilderApplied(String builderID) throws CoreException {
- IProjectDescription description = getProject().getDescription();
- for (ICommand cmd : description.getBuildSpec()) {
- if (cmd.getBuilderName().equals(builderID)) {
- return true;
- }
- }
- return false;
- }
+ }
+
+ private void removeIvyClasspathContainer() {
+ IJavaProject javaProject = JavaCore.create(project);
+ ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
+ //FIXME call IvyDE command
+ try {
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry = entries[i];
+ if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ IPath path = entry.getPath();
+ if (IvyClasspathUtil.isIvyClasspathContainer(path)) {
+ continue;
+ }
+ }
+ newEntries.add(entry);
+ }
+ // TODO add progress monitor
+ IClasspathEntry[] newClasspathEntries = newEntries.toArray(new IClasspathEntry[newEntries.size()]);
+ javaProject.setRawClasspath(newClasspathEntries, null);
+ } catch (JavaModelException e) {
+ Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot remove Ivy ClassPath container", e);
+ }
+ }
+
+ private void addBuilder(String builderID) throws CoreException {
+ if (!isBuilderApplied(builderID)) {
+ IProjectDescription description = getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ ICommand command = description.newCommand();
+ command.setBuilderName(builderID);
+ ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+ newCommands[commands.length] = command;
+ description.setBuildSpec(newCommands);
+ getProject().setDescription(description, null);
+ }
+ }
+
+ private void removeBuilder(String builderID) throws CoreException {
+ if (isBuilderApplied(builderID)) {
+ IProjectDescription description = getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ ICommand[] newCommands = new ICommand[commands.length - 1];
+ int i = 0;
+ for (ICommand command : commands) {
+ if (command.getBuilderName().equals(builderID)) {
+ // Remove the given builder
+ } else {
+ newCommands[i] = command;
+ i++;
+ }
+ }
+ description.setBuildSpec(newCommands);
+ getProject().setDescription(description, null);
+ }
+ }
+
+ private boolean isBuilderApplied(String builderID) throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ for (ICommand cmd : description.getBuildSpec()) {
+ if (cmd.getBuilderName().equals(builderID)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureAction.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureAction.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureAction.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureAction.java Tue Feb 22 15:09:30 2011
@@ -35,43 +35,43 @@ import com.google.inject.Inject;
*/
public class RemoveEasyAntNatureAction implements IObjectActionDelegate {
- // The selected project
- private IProject selectedProject;
- private EasyantProjectService easyantProjectService;
-
- public RemoveEasyAntNatureAction(){
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
- public void run(IAction action) {
- if (selectedProject != null) {
- // Remove the nature on the selected project
- easyantProjectService.removeNature(selectedProject);
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- if (!structuredSelection.isEmpty() && structuredSelection.getFirstElement() instanceof IProject) {
- IProject project = (IProject) structuredSelection.getFirstElement();
- if (project.isAccessible()) {
- this.selectedProject = project;
- if (action != null) {
- action.setEnabled(easyantProjectService.hasEasyAntNature(project));
- }
- }
-
- }
- }
- }
+ // The selected project
+ private IProject selectedProject;
+ private EasyantProjectService easyantProjectService;
+
+ public RemoveEasyAntNatureAction(){
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ if (selectedProject != null) {
+ // Remove the nature on the selected project
+ easyantProjectService.removeNature(selectedProject);
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structuredSelection = (StructuredSelection) selection;
+ if (!structuredSelection.isEmpty() && structuredSelection.getFirstElement() instanceof IProject) {
+ IProject project = (IProject) structuredSelection.getFirstElement();
+ if (project.isAccessible()) {
+ this.selectedProject = project;
+ if (action != null) {
+ action.setEnabled(easyantProjectService.hasEasyAntNature(project));
+ }
+ }
+
+ }
+ }
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java Tue Feb 22 15:09:30 2011
@@ -33,35 +33,35 @@ import org.eclipse.jface.operation.IRunn
*/
public class RemoveEasyAntNatureOperation implements IRunnableWithProgress {
- private IProject project;
+ private IProject project;
- public RemoveEasyAntNatureOperation(IProject project) {
- this.project = project;
- }
+ public RemoveEasyAntNatureOperation(IProject project) {
+ this.project = project;
+ }
- @SuppressWarnings("unchecked")
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (project != null) {
- try {
- if (project.getNature(EasyAntNature.NATURE_ID) != null) {
- monitor.subTask("Remove the EasyAnt nature to the project " + project.getName());
- IProjectDescription description = project.getDescription();
- String[] oldNatures = description.getNatureIds();
- ArrayList newNatures = new ArrayList();
- for (int i = 0; i < oldNatures.length; i++) {
- if (!oldNatures[i].equals(EasyAntNature.NATURE_ID)) {
- newNatures.add(oldNatures[i]);
- }
- }
- description.setNatureIds((String[]) newNatures.toArray(new String[newNatures.size()]));
- project.setDescription(description, new SubProgressMonitor(monitor, 1));
- }
- } catch (CoreException e) {
- Activator.getEasyAntPlugin().log(e);
- }
- monitor.done();
- }
+ @SuppressWarnings("unchecked")
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ if (project != null) {
+ try {
+ if (project.getNature(EasyAntNature.NATURE_ID) != null) {
+ monitor.subTask("Remove the EasyAnt nature to the project " + project.getName());
+ IProjectDescription description = project.getDescription();
+ String[] oldNatures = description.getNatureIds();
+ ArrayList newNatures = new ArrayList();
+ for (int i = 0; i < oldNatures.length; i++) {
+ if (!oldNatures[i].equals(EasyAntNature.NATURE_ID)) {
+ newNatures.add(oldNatures[i]);
+ }
+ }
+ description.setNatureIds((String[]) newNatures.toArray(new String[newNatures.size()]));
+ project.setDescription(description, new SubProgressMonitor(monitor, 1));
+ }
+ } catch (CoreException e) {
+ Activator.getEasyAntPlugin().log(e);
+ }
+ monitor.done();
+ }
- }
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/providers/ImageProvider.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/providers/ImageProvider.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/providers/ImageProvider.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/providers/ImageProvider.java Tue Feb 22 15:09:30 2011
@@ -22,20 +22,20 @@ import org.eclipse.swt.graphics.Image;
public interface ImageProvider {
- ImageDescriptor getConsoleImageDescriptor();
+ ImageDescriptor getConsoleImageDescriptor();
- ImageDescriptor getLogoImageDescriptor();
-
- Image getPhaseImage();
-
- Image getTargetImage();
-
- Image getFormBackgroundImage();
-
- Image getBuildImage();
-
- ImageDescriptor getInfoLogLevelImage();
-
- ImageDescriptor getDebugLogLevelImage();
-
+ ImageDescriptor getLogoImageDescriptor();
+
+ Image getPhaseImage();
+
+ Image getTargetImage();
+
+ Image getFormBackgroundImage();
+
+ Image getBuildImage();
+
+ ImageDescriptor getInfoLogLevelImage();
+
+ ImageDescriptor getDebugLogLevelImage();
+
}