You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/01/14 11:26:52 UTC
svn commit: r611752 [5/11] - in /ant/ivy/ivyde/trunk: ./ .settings/ doc/
doc/style/ src/java/org/apache/ivyde/eclipse/
src/java/org/apache/ivyde/eclipse/cpcontainer/
src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/
src/java/org/apache/ivyde/...
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java Mon Jan 14 02:26:37 2008
@@ -1,136 +1,148 @@
-package org.apache.ivyde.eclipse.cpcontainer;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-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 {
-
- /**
- * Adds an Ivy classpath container to the list of existing classpath
- * entries in the given project.
- *
- * @param project
- * the project to which the classpath container should be added
- * @param projectRelativePath
- * the path relative to the project of the module descriptor file
- * to use for the classpath container
- * @param confs
- * the configurations to use in the classpath container.
- */
- public static void addCPContainer(IJavaProject project, IPath projectRelativePath, String confs) {
- try {
- IClasspathEntry newEntry = JavaCore.newContainerEntry(new Path(
- IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID).append(projectRelativePath).append(confs));
-
- IClasspathEntry[] entries = project.getRawClasspath();
-
- List newEntries = new ArrayList(Arrays.asList(entries));
- newEntries.add(newEntry);
- entries = (IClasspathEntry[]) newEntries.toArray(new IClasspathEntry[newEntries.size()]);
-
- project.setRawClasspath(entries, project.getOutputLocation(), null);
- } catch (CoreException e) {
- IvyPlugin.log(e);
- }
- }
-
- /**
- * 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 the selection
- * @return
- * @throws JavaModelException
- */
- public static IvyClasspathContainer getIvyClasspathContainer(IStructuredSelection selection) throws JavaModelException {
- if (selection == null) {
- return null;
- }
- for (Iterator it = selection.iterator(); it.hasNext();) {
- Object element = it.next();
- IvyClasspathContainer cp = null;
- if (element instanceof IvyClasspathContainer) {
- return (IvyClasspathContainer) element;
- }
- if (element instanceof IJavaProject) {
- return getIvyClassPathContainer((IJavaProject) element);
- }
- if (element instanceof IAdaptable) {
- cp = (IvyClasspathContainer) ((IAdaptable) element).getAdapter(IvyClasspathContainer.class);
- if (cp == null) {
- IJavaProject p = (IJavaProject) ((IAdaptable) element).getAdapter(IJavaProject.class);
- if (p != null) {
- cp = getIvyClassPathContainer(p);
- }
- }
- }
- if (cp != null) {
- return cp;
- }
- if (element instanceof ClassPathContainer) {
- // we shouldn't check against internal JDT API but there are not adaptable to useful class
- return getIvyClassPathContainer(((ClassPathContainer) element).getJavaProject());
- }
- }
- return null;
- }
-
- /**
- * Search the Ivy classpath container within the specified Java project
- *
- * @param javaProject the project to search into
- * @return the Ivy classpath container if found, otherwise return <code>null</code>
- * @throws JavaModelException
- */
- public static IvyClasspathContainer getIvyClassPathContainer(IJavaProject javaProject) throws JavaModelException {
- IClasspathEntry[] cpe = javaProject.getRawClasspath();
- for (int i = 0; i < cpe.length; i++) {
- IClasspathEntry entry = cpe[i];
- if (IvyClasspathContainer.isIvyClasspathContainer(entry.getPath())) {
- return (IvyClasspathContainer) JavaCore.getClasspathContainer(entry.getPath(), javaProject);
- }
- }
- return null;
- }
-}
+package org.apache.ivyde.eclipse.cpcontainer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+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 {
+
+ /**
+ * Adds an Ivy classpath container to the list of existing classpath entries in the given
+ * project.
+ *
+ * @param project
+ * the project to which the classpath container should be added
+ * @param projectRelativePath
+ * the path relative to the project of the module descriptor file to use for the
+ * classpath container
+ * @param confs
+ * the configurations to use in the classpath container.
+ */
+ public static void addCPContainer(IJavaProject project, IPath projectRelativePath, String confs) {
+ try {
+ IClasspathEntry newEntry = JavaCore.newContainerEntry(new Path(
+ IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID).append(projectRelativePath)
+ .append(confs));
+
+ IClasspathEntry[] entries = project.getRawClasspath();
+
+ List newEntries = new ArrayList(Arrays.asList(entries));
+ newEntries.add(newEntry);
+ entries = (IClasspathEntry[]) newEntries
+ .toArray(new IClasspathEntry[newEntries.size()]);
+
+ project.setRawClasspath(entries, project.getOutputLocation(), null);
+ } catch (CoreException e) {
+ IvyPlugin.log(e);
+ }
+ }
+
+ /**
+ * 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
+ * the selection
+ * @return
+ * @throws JavaModelException
+ */
+ public static IvyClasspathContainer getIvyClasspathContainer(IStructuredSelection selection)
+ throws JavaModelException {
+ if (selection == null) {
+ return null;
+ }
+ for (Iterator it = selection.iterator(); it.hasNext();) {
+ Object element = it.next();
+ IvyClasspathContainer cp = null;
+ if (element instanceof IvyClasspathContainer) {
+ return (IvyClasspathContainer) element;
+ }
+ if (element instanceof IJavaProject) {
+ return getIvyClassPathContainer((IJavaProject) element);
+ }
+ if (element instanceof IAdaptable) {
+ cp = (IvyClasspathContainer) ((IAdaptable) element)
+ .getAdapter(IvyClasspathContainer.class);
+ if (cp == null) {
+ IJavaProject p = (IJavaProject) ((IAdaptable) element)
+ .getAdapter(IJavaProject.class);
+ if (p != null) {
+ cp = getIvyClassPathContainer(p);
+ }
+ }
+ }
+ if (cp != null) {
+ return cp;
+ }
+ if (element instanceof ClassPathContainer) {
+ // we shouldn't check against internal JDT API but there are not adaptable to useful
+ // class
+ return getIvyClassPathContainer(((ClassPathContainer) element).getJavaProject());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Search the Ivy classpath container within the specified Java project
+ *
+ * @param javaProject
+ * the project to search into
+ * @return the Ivy classpath container if found, otherwise return <code>null</code>
+ * @throws JavaModelException
+ */
+ public static IvyClasspathContainer getIvyClassPathContainer(IJavaProject javaProject)
+ throws JavaModelException {
+ IClasspathEntry[] cpe = javaProject.getRawClasspath();
+ for (int i = 0; i < cpe.length; i++) {
+ IClasspathEntry entry = cpe[i];
+ if (IvyClasspathContainer.isIvyClasspathContainer(entry.getPath())) {
+ return (IvyClasspathContainer) JavaCore.getClasspathContainer(entry.getPath(),
+ javaProject);
+ }
+ }
+ return null;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java Mon Jan 14 02:26:37 2008
@@ -1,338 +1,363 @@
-/*
- * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
- * Copyright Jayasoft 2005 - All rights reserved
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.cpcontainer;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.ParseException;
-
-import org.apache.ivy.core.module.descriptor.Configuration;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
-import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-public class IvydeContainerPage extends NewElementWizardPage
- implements IClasspathContainerPage, IClasspathContainerPageExtension {
-
- private IJavaProject _project;
- private IClasspathEntry _entry;
-
- private Text _ivyFilePathText;
- private CheckboxTableViewer _confTableViewer;
-
- public IvydeContainerPage() {
- super("IvyDE Container");
- }
- public boolean isPageComplete() {
- return true;
- }
- public boolean finish() {
- if(_ivyFilePathText.getText().length()>0 && getConfigurationsText().length()>0 ) {
- return true;
- }
- MessageDialog.openWarning(_ivyFilePathText.getShell(), "Missing information", "Please select a valid file and choose at least one configuration");
- return false;
- }
-
- public IClasspathEntry getSelection() {
- return createEntry();
- }
- public void setSelection(IClasspathEntry entry) {
- _entry = entry != null ? entry : createDefaultEntry();
- }
-
- private IClasspathEntry createEntry() {
- IClasspathEntry entry = JavaCore.newContainerEntry(
- new Path(IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID)
- .append(_ivyFilePathText.getText())
- .append(getConfigurationsText()));
- return entry;
- }
- private String getConfigurationsText() {
- Object[]confs = _confTableViewer.getCheckedElements();
- int tot = _confTableViewer.getTable().getItemCount();
- if(confs != null && confs.length == tot) {
- return "*";
- }
- String text = "";
- for (int i = 0; i < confs.length; i++) {
- Configuration conf = (Configuration)confs[i];
- text+=conf.getName()+(i < confs.length?",":"");
- }
- return text;
- }
- private IClasspathEntry createDefaultEntry() {
- IClasspathEntry entry = JavaCore.newContainerEntry(
- new Path(IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID).append("ivy.xml/*"));
- return entry;
- }
- public void createControl(Composite parent) {
- setTitle("IvyDE Managed Libraries");
- setDescription("Choose ivy file and its configurations.");
- Composite control = new Composite(parent, 0);
- GridLayout layout = new GridLayout(2, false);
- control.setLayout(layout);
- GridData data = new GridData(GridData.FILL);
- data.grabExcessHorizontalSpace = true;
- control.setLayoutData(data);
-
- addMainSection(control);
- setControl(control);
- }
-
- private Composite createDefaultComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
-
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- private void addMainSection(Composite parent) {
- Composite composite = createDefaultComposite(parent);
-
- //Label for ivy file field
- Label pathLabel = new Label(composite, SWT.NONE);
- pathLabel.setText("Ivy File");
-
- _ivyFilePathText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- _ivyFilePathText.setText(IvyClasspathContainer.getIvyFilePath(_entry.getPath()));
- _ivyFilePathText.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- refreshConfigurationTable();
- }
- });
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- _ivyFilePathText.setLayoutData(gridData);
-
- Button btn = new Button(composite, SWT.NONE);
- btn.setText("Browse");
- btn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setValidator(new ISelectionStatusValidator() {
- private final IStatus errorStatus = new Status(IStatus.ERROR, IvyPlugin.ID, 0, "", null); //$NON-NLS-1$
-
- public IStatus validate(Object[] selection) {
- if (selection.length == 0) {
- return errorStatus;
- }
- for (int i = 0; i < selection.length; i++) {
- Object o = selection[i];
- if (!(o instanceof IFile)) {
- return errorStatus;
- }
- }
- return Status.OK_STATUS;
- }
-
- });
- dialog.setTitle("choose ivy file");
- dialog.setMessage("choose the ivy file to use to resolve dependencies");
- dialog.setInput(_project.getProject());
- dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
-
- if (dialog.open() == Window.OK) {
- Object[] elements= dialog.getResult();
- if (elements.length > 0 && elements[0] instanceof IFile) {
- IPath p = ((IFile)elements[0]).getProjectRelativePath();
- _ivyFilePathText.setText(p.toString());
- refreshConfigurationTable();
- }
- }
- }
- });
-
- //Label for ivy configurations field
- Label confLabel = new Label(composite, SWT.NONE);
- confLabel.setText("Configurations");
- gridData = new GridData();
- gridData.verticalAlignment = GridData.BEGINNING;
- confLabel.setLayoutData(gridData);
- //table for configuration selection
- _confTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- _confTableViewer.getTable().setHeaderVisible (true);
- TableColumn col1 = new TableColumn(_confTableViewer.getTable(),SWT.NONE);
- col1.setText("Name");
- col1.setWidth(100);
- TableColumn col2 = new TableColumn(_confTableViewer.getTable(),SWT.NONE);
- col2.setText("Description");
- col2.setWidth(300);
- _confTableViewer.setColumnProperties(new String[]{"Name", "Description" });
- _confTableViewer.getTable().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- _confTableViewer.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- if(inputElement != null && !"".equals(inputElement)) {
- return getConfigurations((String)inputElement);
- }
- return new Configuration[0];
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public void dispose() {
- }
- });
- _confTableViewer.setLabelProvider(new ConfigurationLabelProvider());
- _confTableViewer.setInput(_ivyFilePathText.getText());
- initTableSelection(_ivyFilePathText.getText());
-
- //refresh
- Button refreshConf = new Button(composite, SWT.NONE);
- gridData = new GridData();
- gridData.verticalAlignment = GridData.BEGINNING;
- refreshConf.setLayoutData(gridData);
- refreshConf.setText("Refresh");
- refreshConf.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- _confTableViewer.setInput(_ivyFilePathText.getText());
- }
- });
- Composite spacer = new Composite(composite, SWT.NONE);
- Link select = new Link(composite, SWT.PUSH);
- gridData = new GridData();
- gridData.verticalAlignment = GridData.BEGINNING;
- select.setLayoutData(gridData);
- select.setText("<A>All</A>/<A>None</A>");
- select.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if(e.text.equals("All")) {;
- _confTableViewer.setCheckedElements(getConfigurations(_ivyFilePathText.getText()));
- } else {
- _confTableViewer.setCheckedElements(new Configuration[0]);
- }
- }
- });
- }
- /**
- * @param ivyFile
- */
- private void initTableSelection(final String ivyFile) {
- String selectedConfsString = IvyClasspathContainer.getConfigurationsText(_entry.getPath());
- if("*".equals(selectedConfsString)) {
- _confTableViewer.setCheckedElements(getConfigurations(ivyFile));
- } else {
- String selectedConf[] = IvyClasspathContainer.getConfigurations(_entry.getPath());
- if(selectedConf != null) {
- ModuleDescriptor md = getModuleDescriptor(ivyFile);
- if(md != null) {
- for (int i = 0; i < selectedConf.length; i++) {
- String name = selectedConf[i];
- Configuration configuration = md.getConfiguration(name);
- if(configuration != null) {
- _confTableViewer.setChecked(configuration, true);
- }
- }
- }
- }
- }
- }
-
-
- public void initialize(IJavaProject project, IClasspathEntry currentEntries[]) {
- _project = project;
- }
- /**
- *
- */
- private void refreshConfigurationTable() {
- if(_confTableViewer.getInput() == null || !_confTableViewer.getInput().equals(_ivyFilePathText.getText())) {
- _confTableViewer.setInput(_ivyFilePathText.getText());
- }
- }
- /**
- * @param ivyfile
- * @return
- */
- private Configuration[] getConfigurations(String ivyfile) {
- try {
- ModuleDescriptor moduleDescriptor = getModuleDescriptor(ivyfile);
- if(moduleDescriptor != null) {
- return moduleDescriptor.getConfigurations();
- }
- } catch (Exception e) {}
- return new Configuration[0];
- }
- /**
- * @param ivyfile
- * @return
- * @throws MalformedURLException
- * @throws ParseException
- * @throws IOException
- */
- private ModuleDescriptor getModuleDescriptor(String ivyfile){
- try {
- IFile file = _project.getProject().getFile(ivyfile);
- URL url = new File( file.getLocation().toOSString()).toURL();
- return ModuleDescriptorParserRegistry.getInstance().parseDescriptor(IvyPlugin.getIvy(_project).getSettings(), url, false);
- } catch (Exception e) {}
- return null;
- }
-
- private static class ConfigurationLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if(columnIndex == 0) {
- return ((Configuration)element).getName();
- }
- return ((Configuration)element).getDescription();
- }
- }
-}
+/*
+ * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
+ * Copyright Jayasoft 2005 - All rights reserved
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.cpcontainer;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.ParseException;
+
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
+import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
+import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceSorter;
+
+public class IvydeContainerPage extends NewElementWizardPage implements IClasspathContainerPage,
+ IClasspathContainerPageExtension {
+
+ private IJavaProject _project;
+
+ private IClasspathEntry _entry;
+
+ private Text _ivyFilePathText;
+
+ private CheckboxTableViewer _confTableViewer;
+
+ public IvydeContainerPage() {
+ super("IvyDE Container");
+ }
+
+ public boolean isPageComplete() {
+ return true;
+ }
+
+ public boolean finish() {
+ if (_ivyFilePathText.getText().length() > 0 && getConfigurationsText().length() > 0) {
+ return true;
+ }
+ MessageDialog.openWarning(_ivyFilePathText.getShell(), "Missing information",
+ "Please select a valid file and choose at least one configuration");
+ return false;
+ }
+
+ public IClasspathEntry getSelection() {
+ return createEntry();
+ }
+
+ public void setSelection(IClasspathEntry entry) {
+ _entry = entry != null ? entry : createDefaultEntry();
+ }
+
+ private IClasspathEntry createEntry() {
+ IClasspathEntry entry = JavaCore.newContainerEntry(new Path(
+ IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID)
+ .append(_ivyFilePathText.getText()).append(getConfigurationsText()));
+ return entry;
+ }
+
+ private String getConfigurationsText() {
+ Object[] confs = _confTableViewer.getCheckedElements();
+ int tot = _confTableViewer.getTable().getItemCount();
+ if (confs != null && confs.length == tot) {
+ return "*";
+ }
+ String text = "";
+ for (int i = 0; i < confs.length; i++) {
+ Configuration conf = (Configuration) confs[i];
+ text += conf.getName() + (i < confs.length ? "," : "");
+ }
+ return text;
+ }
+
+ private IClasspathEntry createDefaultEntry() {
+ IClasspathEntry entry = JavaCore.newContainerEntry(new Path(
+ IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID).append("ivy.xml/*"));
+ return entry;
+ }
+
+ public void createControl(Composite parent) {
+ setTitle("IvyDE Managed Libraries");
+ setDescription("Choose ivy file and its configurations.");
+ Composite control = new Composite(parent, 0);
+ GridLayout layout = new GridLayout(2, false);
+ control.setLayout(layout);
+ GridData data = new GridData(GridData.FILL);
+ data.grabExcessHorizontalSpace = true;
+ control.setLayoutData(data);
+
+ addMainSection(control);
+ setControl(control);
+ }
+
+ private Composite createDefaultComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+
+ return composite;
+ }
+
+ private void addMainSection(Composite parent) {
+ Composite composite = createDefaultComposite(parent);
+
+ // Label for ivy file field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText("Ivy File");
+
+ _ivyFilePathText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ _ivyFilePathText.setText(IvyClasspathContainer.getIvyFilePath(_entry.getPath()));
+ _ivyFilePathText.addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent e) {
+ refreshConfigurationTable();
+ }
+ });
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ _ivyFilePathText.setLayoutData(gridData);
+
+ Button btn = new Button(composite, SWT.NONE);
+ btn.setText("Browse");
+ btn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display
+ .getDefault().getActiveShell(), new WorkbenchLabelProvider(),
+ new WorkbenchContentProvider());
+ dialog.setValidator(new ISelectionStatusValidator() {
+ private final IStatus errorStatus = new Status(IStatus.ERROR, IvyPlugin.ID, 0,
+ "", null); //$NON-NLS-1$
+
+ public IStatus validate(Object[] selection) {
+ if (selection.length == 0) {
+ return errorStatus;
+ }
+ for (int i = 0; i < selection.length; i++) {
+ Object o = selection[i];
+ if (!(o instanceof IFile)) {
+ return errorStatus;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ });
+ dialog.setTitle("choose ivy file");
+ dialog.setMessage("choose the ivy file to use to resolve dependencies");
+ dialog.setInput(_project.getProject());
+ dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
+
+ if (dialog.open() == Window.OK) {
+ Object[] elements = dialog.getResult();
+ if (elements.length > 0 && elements[0] instanceof IFile) {
+ IPath p = ((IFile) elements[0]).getProjectRelativePath();
+ _ivyFilePathText.setText(p.toString());
+ refreshConfigurationTable();
+ }
+ }
+ }
+ });
+
+ // Label for ivy configurations field
+ Label confLabel = new Label(composite, SWT.NONE);
+ confLabel.setText("Configurations");
+ gridData = new GridData();
+ gridData.verticalAlignment = GridData.BEGINNING;
+ confLabel.setLayoutData(gridData);
+ // table for configuration selection
+ _confTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.H_SCROLL
+ | SWT.V_SCROLL);
+ _confTableViewer.getTable().setHeaderVisible(true);
+ TableColumn col1 = new TableColumn(_confTableViewer.getTable(), SWT.NONE);
+ col1.setText("Name");
+ col1.setWidth(100);
+ TableColumn col2 = new TableColumn(_confTableViewer.getTable(), SWT.NONE);
+ col2.setText("Description");
+ col2.setWidth(300);
+ _confTableViewer.setColumnProperties(new String[] {"Name", "Description"});
+ _confTableViewer.getTable().setLayoutData(
+ new GridData(GridData.FILL, GridData.FILL, true, true));
+ _confTableViewer.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ if (inputElement != null && !"".equals(inputElement)) {
+ return getConfigurations((String) inputElement);
+ }
+ return new Configuration[0];
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+ });
+ _confTableViewer.setLabelProvider(new ConfigurationLabelProvider());
+ _confTableViewer.setInput(_ivyFilePathText.getText());
+ initTableSelection(_ivyFilePathText.getText());
+
+ // refresh
+ Button refreshConf = new Button(composite, SWT.NONE);
+ gridData = new GridData();
+ gridData.verticalAlignment = GridData.BEGINNING;
+ refreshConf.setLayoutData(gridData);
+ refreshConf.setText("Refresh");
+ refreshConf.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ _confTableViewer.setInput(_ivyFilePathText.getText());
+ }
+ });
+ Composite spacer = new Composite(composite, SWT.NONE);
+ Link select = new Link(composite, SWT.PUSH);
+ gridData = new GridData();
+ gridData.verticalAlignment = GridData.BEGINNING;
+ select.setLayoutData(gridData);
+ select.setText("<A>All</A>/<A>None</A>");
+ select.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (e.text.equals("All")) {
+ ;
+ _confTableViewer.setCheckedElements(getConfigurations(_ivyFilePathText
+ .getText()));
+ } else {
+ _confTableViewer.setCheckedElements(new Configuration[0]);
+ }
+ }
+ });
+ }
+
+ /**
+ * @param ivyFile
+ */
+ private void initTableSelection(final String ivyFile) {
+ String selectedConfsString = IvyClasspathContainer.getConfigurationsText(_entry.getPath());
+ if ("*".equals(selectedConfsString)) {
+ _confTableViewer.setCheckedElements(getConfigurations(ivyFile));
+ } else {
+ String selectedConf[] = IvyClasspathContainer.getConfigurations(_entry.getPath());
+ if (selectedConf != null) {
+ ModuleDescriptor md = getModuleDescriptor(ivyFile);
+ if (md != null) {
+ for (int i = 0; i < selectedConf.length; i++) {
+ String name = selectedConf[i];
+ Configuration configuration = md.getConfiguration(name);
+ if (configuration != null) {
+ _confTableViewer.setChecked(configuration, true);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void initialize(IJavaProject project, IClasspathEntry currentEntries[]) {
+ _project = project;
+ }
+
+ /**
+ *
+ */
+ private void refreshConfigurationTable() {
+ if (_confTableViewer.getInput() == null
+ || !_confTableViewer.getInput().equals(_ivyFilePathText.getText())) {
+ _confTableViewer.setInput(_ivyFilePathText.getText());
+ }
+ }
+
+ /**
+ * @param ivyfile
+ * @return
+ */
+ private Configuration[] getConfigurations(String ivyfile) {
+ try {
+ ModuleDescriptor moduleDescriptor = getModuleDescriptor(ivyfile);
+ if (moduleDescriptor != null) {
+ return moduleDescriptor.getConfigurations();
+ }
+ } catch (Exception e) {
+ }
+ return new Configuration[0];
+ }
+
+ /**
+ * @param ivyfile
+ * @return
+ * @throws MalformedURLException
+ * @throws ParseException
+ * @throws IOException
+ */
+ private ModuleDescriptor getModuleDescriptor(String ivyfile) {
+ try {
+ IFile file = _project.getProject().getFile(ivyfile);
+ URL url = new File(file.getLocation().toOSString()).toURL();
+ return ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
+ IvyPlugin.getIvy(_project).getSettings(), url, false);
+ } catch (Exception e) {
+ }
+ return null;
+ }
+
+ private static class ConfigurationLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return ((Configuration) element).getName();
+ }
+ return ((Configuration) element).getDescription();
+ }
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java Mon Jan 14 02:26:37 2008
@@ -1,20 +1,21 @@
-package org.apache.ivyde.eclipse.cpcontainer.fragmentinfo;
-
-import java.net.URL;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-public interface IPackageFragmentExtraInfo {
-
- public IPath getSourceAttachment(Path path);
-
- public IPath getSourceAttachmentRoot(Path path);
-
- public URL getDocAttachment(Path path);
-
- public void setSourceAttachmentPath(IPath containerPath, String entryPath, IPath sourcePath);
-
- public void setSourceAttachmentRootPath(IPath containerPath, String entryPath, IPath rootPath);
-
- public void setJavaDocLocation(IPath containerPath, String entryPath, URL libraryJavadocLocation);
-}
+package org.apache.ivyde.eclipse.cpcontainer.fragmentinfo;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+public interface IPackageFragmentExtraInfo {
+
+ public IPath getSourceAttachment(Path path);
+
+ public IPath getSourceAttachmentRoot(Path path);
+
+ public URL getDocAttachment(Path path);
+
+ public void setSourceAttachmentPath(IPath containerPath, String entryPath, IPath sourcePath);
+
+ public void setSourceAttachmentRootPath(IPath containerPath, String entryPath, IPath rootPath);
+
+ public void setJavaDocLocation(IPath containerPath, String entryPath, URL libraryJavadocLocation);
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/IPackageFragmentExtraInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java Mon Jan 14 02:26:37 2008
@@ -1,59 +1,65 @@
-package org.apache.ivyde.eclipse.cpcontainer.fragmentinfo;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-public class PreferenceStoreInfo implements IPackageFragmentExtraInfo {
- private static final String SRC_SUFFIX = "-src";
- private static final String SRCROOT_SUFFIX = "-srcroot";
- private static final String DOC_SUFFIX = "-doc";
-
- private IPreferenceStore _preferenceStore;
-
- public PreferenceStoreInfo(IPreferenceStore preferenceStore) {
- _preferenceStore = preferenceStore;
- }
-
- public IPath getSourceAttachment(Path path) {
- String srcPath = _preferenceStore.getString(path.toPortableString()+SRC_SUFFIX);
- if(!"".equals(srcPath)) {
- return new Path(srcPath);
- }
- return null;
- }
-
- public IPath getSourceAttachmentRoot(Path path) {
- String srcPath = _preferenceStore.getString(path.toPortableString()+SRCROOT_SUFFIX);
- if(!"".equals(srcPath)) {
- return new Path(srcPath);
- }
- return null;
- }
-
- public URL getDocAttachment(Path path) {
- String srcPath = _preferenceStore.getString(path.toPortableString()+DOC_SUFFIX);
- if(!"".equals(srcPath)) {
- try {
- return new URL(srcPath);
- } catch (MalformedURLException e) {
- return null;
- }
- }
- return null;
- }
-
- public void setSourceAttachmentPath(IPath containerPath, String entryPath, IPath sourcePath) {
- _preferenceStore.setValue(entryPath+SRC_SUFFIX, sourcePath==null?"":sourcePath.toPortableString());
- }
-
- public void setSourceAttachmentRootPath(IPath containerPath, String entryPath, IPath rootPath) {
- _preferenceStore.setValue(entryPath+SRCROOT_SUFFIX, rootPath==null?"":rootPath.toPortableString());
- }
-
- public void setJavaDocLocation(IPath containerPath, String entryPath, URL libraryJavadocLocation) {
- _preferenceStore.setValue(entryPath+DOC_SUFFIX, libraryJavadocLocation==null?"":libraryJavadocLocation.toString());
- }
-}
+package org.apache.ivyde.eclipse.cpcontainer.fragmentinfo;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class PreferenceStoreInfo implements IPackageFragmentExtraInfo {
+ private static final String SRC_SUFFIX = "-src";
+
+ private static final String SRCROOT_SUFFIX = "-srcroot";
+
+ private static final String DOC_SUFFIX = "-doc";
+
+ private IPreferenceStore _preferenceStore;
+
+ public PreferenceStoreInfo(IPreferenceStore preferenceStore) {
+ _preferenceStore = preferenceStore;
+ }
+
+ public IPath getSourceAttachment(Path path) {
+ String srcPath = _preferenceStore.getString(path.toPortableString() + SRC_SUFFIX);
+ if (!"".equals(srcPath)) {
+ return new Path(srcPath);
+ }
+ return null;
+ }
+
+ public IPath getSourceAttachmentRoot(Path path) {
+ String srcPath = _preferenceStore.getString(path.toPortableString() + SRCROOT_SUFFIX);
+ if (!"".equals(srcPath)) {
+ return new Path(srcPath);
+ }
+ return null;
+ }
+
+ public URL getDocAttachment(Path path) {
+ String srcPath = _preferenceStore.getString(path.toPortableString() + DOC_SUFFIX);
+ if (!"".equals(srcPath)) {
+ try {
+ return new URL(srcPath);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public void setSourceAttachmentPath(IPath containerPath, String entryPath, IPath sourcePath) {
+ _preferenceStore.setValue(entryPath + SRC_SUFFIX, sourcePath == null ? "" : sourcePath
+ .toPortableString());
+ }
+
+ public void setSourceAttachmentRootPath(IPath containerPath, String entryPath, IPath rootPath) {
+ _preferenceStore.setValue(entryPath + SRCROOT_SUFFIX, rootPath == null ? "" : rootPath
+ .toPortableString());
+ }
+
+ public void setJavaDocLocation(IPath containerPath, String entryPath, URL libraryJavadocLocation) {
+ _preferenceStore.setValue(entryPath + DOC_SUFFIX, libraryJavadocLocation == null ? ""
+ : libraryJavadocLocation.toString());
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java Mon Jan 14 02:26:37 2008
@@ -1,73 +1,74 @@
-package org.apache.ivyde.eclipse.ui.actions;
-
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-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.eclipse.ui.PlatformUI;
-
-
-public class CreateContainerAction implements IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
- /**
- * The constructor.
- */
- public CreateContainerAction() {
- }
-
- /**
- * 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) {
- ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection s = (IStructuredSelection)sel;
- Object o = s.getFirstElement();
- if (o instanceof IFile) {
- IFile f = (IFile)o;
-
- addCPContainer(JavaCore.create(f.getProject()), f.getProjectRelativePath(), "*");
- }
- }
- }
-
- private void addCPContainer(IJavaProject project, IPath projectRelativePath, String confs) {
- IvyClasspathUtil.addCPContainer(project, projectRelativePath, confs);
- }
-
- /**
- * 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;
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.actions;
+
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+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.eclipse.ui.PlatformUI;
+
+public class CreateContainerAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+
+ /**
+ * The constructor.
+ */
+ public CreateContainerAction() {
+ }
+
+ /**
+ * 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) {
+ ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
+ .getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection s = (IStructuredSelection) sel;
+ Object o = s.getFirstElement();
+ if (o instanceof IFile) {
+ IFile f = (IFile) o;
+
+ addCPContainer(JavaCore.create(f.getProject()), f.getProjectRelativePath(), "*");
+ }
+ }
+ }
+
+ private void addCPContainer(IJavaProject project, IPath projectRelativePath, String confs) {
+ IvyClasspathUtil.addCPContainer(project, projectRelativePath, confs);
+ }
+
+ /**
+ * 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;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java Mon Jan 14 02:26:37 2008
@@ -1,114 +1,114 @@
-/*
- * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
- * Copyright Jayasoft 2005 - All rights reserved
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.ui.actions;
-
-import org.apache.ivy.util.Message;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-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.jdt.core.JavaModelException;
-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;
- /**
- * The constructor.
- */
- public OpenIvyFileAction() {
- }
-
- /**
- * 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;
- try {
- cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil.getSelectionInJavaPackageView());
- } catch (JavaModelException e) {
- Message.error(e.getMessage());
- return;
- }
- if (cp != null) {
- IFile file = cp.getIvyFile();
- 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;
- }
-
-
-}
+/*
+ * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
+ * Copyright Jayasoft 2005 - All rights reserved
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.ui.actions;
+
+import org.apache.ivy.util.Message;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+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.jdt.core.JavaModelException;
+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;
+
+ /**
+ * The constructor.
+ */
+ public OpenIvyFileAction() {
+ }
+
+ /**
+ * 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;
+ try {
+ cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil
+ .getSelectionInJavaPackageView());
+ } catch (JavaModelException e) {
+ Message.error(e.getMessage());
+ return;
+ }
+ if (cp != null) {
+ IFile file = cp.getIvyFile();
+ 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;
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java Mon Jan 14 02:26:37 2008
@@ -1,66 +1,67 @@
-package org.apache.ivyde.eclipse.ui.actions;
-
-import org.apache.ivy.util.Message;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
-import org.eclipse.jdt.core.JavaModelException;
-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;
- try {
- cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil.getSelectionInJavaPackageView());
- } catch (JavaModelException e) {
- Message.error(e.getMessage());
- return;
- }
- if (cp != null) {
- cp.refresh();
- }
- }
-
- /**
- * 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;
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.actions;
+
+import org.apache.ivy.util.Message;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
+import org.eclipse.jdt.core.JavaModelException;
+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;
+ try {
+ cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil
+ .getSelectionInJavaPackageView());
+ } catch (JavaModelException e) {
+ Message.error(e.getMessage());
+ return;
+ }
+ if (cp != null) {
+ cp.refresh();
+ }
+ }
+
+ /**
+ * 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;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java Mon Jan 14 02:26:37 2008
@@ -1,66 +1,67 @@
-package org.apache.ivyde.eclipse.ui.actions;
-
-import org.apache.ivy.util.Message;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
-import org.eclipse.jdt.core.JavaModelException;
-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;
- try {
- cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil.getSelectionInJavaPackageView());
- } catch (JavaModelException e) {
- Message.error(e.getMessage());
- return;
- }
- if (cp != null) {
- cp.resolve();
- }
- }
-
- /**
- * 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;
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.actions;
+
+import org.apache.ivy.util.Message;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
+import org.eclipse.jdt.core.JavaModelException;
+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;
+ try {
+ cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil
+ .getSelectionInJavaPackageView());
+ } catch (JavaModelException e) {
+ Message.error(e.getMessage());
+ return;
+ }
+ if (cp != null) {
+ cp.resolve();
+ }
+ }
+
+ /**
+ * 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;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java Mon Jan 14 02:26:37 2008
@@ -1,79 +1,78 @@
-package org.apache.ivyde.eclipse.ui.actions;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.ivyde.eclipse.IvyPlugin;
-import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-
-public class ResolveAllAction implements IWorkbenchWindowActionDelegate {
- /**
- * The constructor.
- */
- public ResolveAllAction() {
- }
-
- /**
- * 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) {
- Job resolveAllJob = new Job("Resolve all dependencies") {
- protected IStatus run(IProgressMonitor monitor) {
- Collection containers = IvyPlugin.getDefault().getAllContainers();
- monitor.beginTask("Resolve all dependencies", containers.size());
- for (Iterator iter = containers.iterator(); iter.hasNext();) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
- IvyClasspathContainer cp = (IvyClasspathContainer) iter.next();
- cp.resolve(subMonitor);
- }
-
- return Status.OK_STATUS;
- }
- };
-
- resolveAllJob.setUser(true);
- resolveAllJob.schedule();
- }
-
- /**
- * 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) {
- }
-}
\ No newline at end of file
+package org.apache.ivyde.eclipse.ui.actions;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+public class ResolveAllAction implements IWorkbenchWindowActionDelegate {
+ /**
+ * The constructor.
+ */
+ public ResolveAllAction() {
+ }
+
+ /**
+ * 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) {
+ Job resolveAllJob = new Job("Resolve all dependencies") {
+ protected IStatus run(IProgressMonitor monitor) {
+ Collection containers = IvyPlugin.getDefault().getAllContainers();
+ monitor.beginTask("Resolve all dependencies", containers.size());
+ for (Iterator iter = containers.iterator(); iter.hasNext();) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ IvyClasspathContainer cp = (IvyClasspathContainer) iter.next();
+ cp.resolve(subMonitor);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ resolveAllJob.setUser(true);
+ resolveAllJob.schedule();
+ }
+
+ /**
+ * 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) {
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/console/ConsoleDocument.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/console/ConsoleDocument.java?rev=611752&r1=611751&r2=611752&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/console/ConsoleDocument.java (original)
+++ ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/console/ConsoleDocument.java Mon Jan 14 02:26:37 2008
@@ -1,82 +1,86 @@
-/*
- * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
- * Copyright Jayasoft 2005 - All rights reserved
- *
- * #SNAPSHOT#
- */
-package org.apache.ivyde.eclipse.ui.console;
-
-
-public class ConsoleDocument {
-
- private int[] lineTypes;
- private String[] lines;
-
- private int writeIndex = 0;
- private int readIndex = 0;
-
- private static final int BUFFER_SIZE = 200;
-
- protected static class ConsoleLine {
- public String line;
- public int type;
- ConsoleLine(String line, int type) {
- this.line = line;
- this.type = type;
- }
- }
-
- /**
- * Creates an empty console document.
- */
- public ConsoleDocument() {
- }
-
- /**
- * Clears the console document.
- */
- public void clear() {
- lineTypes = null;
- lines = null;
- writeIndex = 0;
- readIndex = 0;
- }
-
- /**
- * Appends a line of the specified type to the end of the console.
- */
- public void appendConsoleLine(int type, String line) {
- if(lines == null) {
- lines = new String[BUFFER_SIZE];
- lineTypes = new int[BUFFER_SIZE];
- }
- lines[writeIndex] = line; //$NON-NLS-1$
- lineTypes[writeIndex] = type;
-
- if(++writeIndex >= BUFFER_SIZE) {
- writeIndex = 0;
- }
- if(writeIndex == readIndex) {
- if(++readIndex >= BUFFER_SIZE) {
- readIndex = 0;
- }
- }
- }
-
- public ConsoleLine[] getLines() {
- if(isEmpty()) return new ConsoleLine[0];
- ConsoleLine[] docLines = new ConsoleLine[readIndex > writeIndex ? BUFFER_SIZE : writeIndex];
- int index = readIndex;
- for (int i = 0; i < docLines.length; i++) {
- docLines[i] = new ConsoleLine(lines[index], lineTypes[index]);
- if (++index >= BUFFER_SIZE) {
- index = 0;
- }
- }
- return docLines;
- }
-
- public boolean isEmpty() {
- return writeIndex == readIndex;
- }
-}
+/*
+ * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
+ * Copyright Jayasoft 2005 - All rights reserved
+ *
+ * #SNAPSHOT#
+ */
+package org.apache.ivyde.eclipse.ui.console;
+
+public class ConsoleDocument {
+
+ private int[] lineTypes;
+
+ private String[] lines;
+
+ private int writeIndex = 0;
+
+ private int readIndex = 0;
+
+ private static final int BUFFER_SIZE = 200;
+
+ protected static class ConsoleLine {
+ public String line;
+
+ public int type;
+
+ ConsoleLine(String line, int type) {
+ this.line = line;
+ this.type = type;
+ }
+ }
+
+ /**
+ * Creates an empty console document.
+ */
+ public ConsoleDocument() {
+ }
+
+ /**
+ * Clears the console document.
+ */
+ public void clear() {
+ lineTypes = null;
+ lines = null;
+ writeIndex = 0;
+ readIndex = 0;
+ }
+
+ /**
+ * Appends a line of the specified type to the end of the console.
+ */
+ public void appendConsoleLine(int type, String line) {
+ if (lines == null) {
+ lines = new String[BUFFER_SIZE];
+ lineTypes = new int[BUFFER_SIZE];
+ }
+ lines[writeIndex] = line; //$NON-NLS-1$
+ lineTypes[writeIndex] = type;
+
+ if (++writeIndex >= BUFFER_SIZE) {
+ writeIndex = 0;
+ }
+ if (writeIndex == readIndex) {
+ if (++readIndex >= BUFFER_SIZE) {
+ readIndex = 0;
+ }
+ }
+ }
+
+ public ConsoleLine[] getLines() {
+ if (isEmpty())
+ return new ConsoleLine[0];
+ ConsoleLine[] docLines = new ConsoleLine[readIndex > writeIndex ? BUFFER_SIZE : writeIndex];
+ int index = readIndex;
+ for (int i = 0; i < docLines.length; i++) {
+ docLines[i] = new ConsoleLine(lines[index], lineTypes[index]);
+ if (++index >= BUFFER_SIZE) {
+ index = 0;
+ }
+ }
+ return docLines;
+ }
+
+ public boolean isEmpty() {
+ return writeIndex == readIndex;
+ }
+}
Propchange: ant/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/console/ConsoleDocument.java
------------------------------------------------------------------------------
svn:eol-style = native