You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ri...@apache.org on 2007/01/03 08:45:03 UTC
svn commit: r492067 [2/3] - in
/maven/continuum/sandbox/continuum-eclipse-plugin: ./ .settings/ META-INF/
icons/ lib/ src/ src/org/ src/org/apache/ src/org/apache/continuum/
src/org/apache/continuum/internal/ src/org/apache/continuum/internal/model/
sr...
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractNewDialog.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractNewDialog.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractNewDialog.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractNewDialog.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Common base class to aid creation of <em>new</em> model entities.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public abstract class AbstractNewDialog extends AbstractDialog {
+
+ public AbstractNewDialog(IShellProvider parentShell) {
+ super (parentShell);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ /**
+ * @param parentShell
+ */
+ public AbstractNewDialog(Shell parentShell) {
+ super (parentShell);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractNewDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractNewDialog.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractOpenDialogAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractOpenDialogAction.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractOpenDialogAction.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractOpenDialogAction.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,61 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Common base class for all action that need to invoke a dialog.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public abstract class AbstractOpenDialogAction extends Action {
+
+ public AbstractOpenDialogAction() {
+ super ();
+ }
+
+
+ /**
+ * Invokes a dialog.
+ */
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench ();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow ();
+ Dialog newDlg = createDialog (window);
+ newDlg.open ();
+ }
+
+
+ /**
+ * Creates an empty {@link TitleAreaDialog} by default. Subclasses should
+ * override and provide their own implementation of the dialogs to display.
+ *
+ * @param window
+ * parent for the dialog
+ * @return newly created dialog.
+ */
+ protected TitleAreaDialog createDialog(IWorkbenchWindow window) {
+ return new TitleAreaDialog (window.getPartService ().getActivePart ().getSite ().getShell ());
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractOpenDialogAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractOpenDialogAction.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractTablePropertySection.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractTablePropertySection.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractTablePropertySection.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractTablePropertySection.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,254 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * Common base class that provides a section with a table widget.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public abstract class AbstractTablePropertySection extends AbstractPropertySection {
+
+ /**
+ * the Table control for the section.
+ */
+ protected Table table;
+
+ /**
+ * the columns headers for the section table.
+ */
+ protected List columns;
+
+ /**
+ * the add button for the section.
+ */
+ protected Button addButton;
+
+ /**
+ * the remove button for the section.
+ */
+ protected Button removeButton;
+
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls (parent, aTabbedPropertySheetPage);
+ Composite composite = getWidgetFactory ().createFlatFormComposite (parent);
+ FormData data;
+
+ table = getWidgetFactory ().createTable (composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ table.setHeaderVisible (true);
+ table.setLinesVisible (true);
+
+ List labels = getColumnLabelText ();
+ columns = new ArrayList ();
+
+ for (Iterator i = labels.iterator (); i.hasNext ();) {
+ TableColumn column = new TableColumn (table, SWT.NONE);
+ column.setText ((String) i.next ());
+ columns.add (column);
+ }
+
+ Shell shell = new Shell ();
+ GC gc = new GC (shell);
+ gc.setFont (shell.getFont ());
+ Point point = gc.textExtent ("");
+ int buttonHeight = point.y + 11;
+ gc.dispose ();
+ shell.dispose ();
+
+ addButton = getWidgetFactory ().createButton (composite, MessageFormat.format ("Add {0}", new String[] { getButtonLabelText ()}), SWT.PUSH);
+ data = new FormData ();
+ data.left = new FormAttachment (0, 0);
+ data.bottom = new FormAttachment (100, 0);
+ data.top = new FormAttachment (100, -buttonHeight);
+ addButton.setLayoutData (data);
+ addButton.addSelectionListener (new SelectionAdapter () {
+
+ public void widgetSelected(SelectionEvent event) {
+ IAction action = new NewBuildDefinitionAction ();
+ action.run ();
+ }
+ });
+
+ removeButton = getWidgetFactory ().createButton (composite, MessageFormat.format ("Delete {0}", new String[] { getButtonLabelText ()}), SWT.PUSH);
+ data = new FormData ();
+ data.left = new FormAttachment (addButton, ITabbedPropertyConstants.VSPACE, SWT.BOTTOM);
+ data.bottom = new FormAttachment (100, 0);
+ data.top = new FormAttachment (100, -buttonHeight);
+ removeButton.setLayoutData (data);
+ removeButton.addSelectionListener (new SelectionAdapter () {
+
+ public void widgetSelected(SelectionEvent event) {
+ // TODO do something
+ }
+ });
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, 0);
+ data.right = new FormAttachment (100, 0);
+ data.top = new FormAttachment (0, ITabbedPropertyConstants.VSPACE);
+ data.bottom = new FormAttachment (addButton, -ITabbedPropertyConstants.VSPACE);
+ data.width = 400;
+ table.setLayoutData (data);
+
+ table.addSelectionListener (new SelectionAdapter () {
+
+ public void widgetSelected(SelectionEvent event) {
+ removeButton.setEnabled (true);
+ }
+ });
+ table.addMouseListener (new MouseAdapter () {
+
+ public void mouseDoubleClick(MouseEvent e) {
+ // TODO: do something
+ }
+ });
+ }
+
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
+ */
+ public boolean shouldUseExtraSpace() {
+ return true;
+ }
+
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ table.removeAll ();
+ removeButton.setEnabled (false);
+
+ for (Iterator i = getOwnedRows ().iterator (); i.hasNext ();) {
+ Object next = i.next ();
+ String key = getKeyForRow (next);
+
+ // find index (for sorting purposes)
+ int k = 0;
+ int size = table.getItemCount ();
+ while (k < size) {
+ String currentKey = table.getItem (k).getText ();
+ if (key.compareToIgnoreCase (currentKey) < 0) {
+ break;
+ }
+ k++;
+ }
+
+ // create the table item
+ TableItem item = new TableItem (table, SWT.NONE, k);
+ String [] values = new String[columns.size ()];
+ List valuesForRow = getValuesForRow (next);
+ for (int j = 0; j < columns.size (); j++) {
+ values[j] = (String) valuesForRow.get (j);
+ }
+ item.setText (values);
+ item.setData (next);
+ }
+
+ for (Iterator i = columns.iterator (); i.hasNext ();) {
+ ((TableColumn) i.next ()).pack ();
+ }
+ }
+
+
+ /**
+ * Allow child classes to setup custom button label text.
+ * <p>
+ * Get the text for the labels that will be used for the Add and Remove
+ * buttons.
+ *
+ * @return the label text.
+ */
+ protected abstract String getButtonLabelText();
+
+
+ /**
+ * Get the row objects for the table.
+ *
+ * @return the list of the row objects.
+ */
+ protected abstract List getOwnedRows();
+
+
+ /**
+ * Get the key for the table that is used for sorting. Usually the table is
+ * sorted by Name or some key string..
+ *
+ * @param object
+ * an object in the row of the table.
+ * @return the string for the key.
+ */
+ protected abstract String getKeyForRow(Object object);
+
+
+ /**
+ * Get the values for the row in the table.
+ *
+ * @param object
+ * an object in the row of the table.
+ * @return the list of string values for the row.
+ */
+ protected abstract List getValuesForRow(Object object);
+
+
+ /**
+ * Get the labels for the columns for the table.
+ *
+ * @return the labels for the columns.
+ */
+ protected abstract List getColumnLabelText();
+
+
+ /**
+ * Get a new child instance for the result of clicking the add button.
+ *
+ * @return a new child instance.
+ */
+ protected abstract Object getNewChild();
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractTablePropertySection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/AbstractTablePropertySection.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/BuildDefinitionInfoSection.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/BuildDefinitionInfoSection.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/BuildDefinitionInfoSection.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/BuildDefinitionInfoSection.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,171 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.continuum.ui.views;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Displays the section with Project details for a selected project.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class BuildDefinitionInfoSection extends AbstractTablePropertySection {
+
+ private static final String LABEL_BUILD_DEFINITION = "Build Definition";
+
+ /**
+ * Array of Table headers for the Category Document view.
+ */
+ private static ColumnHeaders [] headers = ColumnHeaders.values ();
+
+
+ /**
+ *
+ */
+ protected List getColumnLabelText() {
+ List<String> list = new ArrayList<String> ();
+ // add the column names here
+ for (int i = 0; i < headers.length; i++)
+ list.add (headers[i].label);
+ return list;
+ }
+
+
+ /**
+ *
+ */
+ protected String getKeyForRow(Object object) {
+ // TODO do something.
+ return null;
+ }
+
+
+ /**
+ *
+ */
+ protected List getValuesForRow(Object object) {
+ List list = new ArrayList ();
+ // TODO do something
+ return list;
+ }
+
+
+ /**
+ *
+ */
+ protected String getButtonLabelText() {
+ return LABEL_BUILD_DEFINITION;
+ }
+
+
+ /**
+ *
+ */
+ protected List getOwnedRows() {
+ List list = new ArrayList ();
+ // TODO: do something
+ return list;
+ }
+
+
+ /**
+ *
+ */
+ protected Object getNewChild() {
+ // TODO: do something
+ return null;
+ }
+
+ /**
+ * ColumnHeader ENUM for rendering column headers.
+ */
+ public enum ColumnHeaders {
+ /**
+ * Enum instances to be used to render column headers for the Document
+ * list view.
+ */
+ ID("Id", 4, true), NAME("Name", 4, true), IS_DEFAULT("Default?", 4, true), GOALS("Goals", 4, true), ARGUMENTS("Arguments", 4, true), PROFILE("Profile", 4, true), SCHEDULE("Schedule", 4, true), PROJECT("Project Name", 4, true), LAST_BUILD("Last Run", 4, true);
+
+ /**
+ * Label to display.
+ */
+ private String label;
+
+ /**
+ * Determines if the column is resizable.
+ */
+ private boolean isResizable;
+
+ /**
+ * Weight for the column relative to other columns.
+ */
+ private int weight;
+
+
+ /**
+ * Creates an instance of {@link ColumnHeaders} enum with specified
+ * properties.
+ *
+ * @param label
+ * String label to be used to display the Column name.
+ * @param weight
+ * relative weight to be used for layout/sizing purposes.
+ * @param isResizable
+ * true, if this column is re-sizeable, else false.
+ */
+ ColumnHeaders(String label, int weight, boolean isResizable) {
+ this.label = label;
+ this.isResizable = isResizable;
+ this.weight = weight;
+ }
+
+
+ /**
+ * Returns <code>true</code> if the column represented by this enum
+ * instance is resizeable.
+ *
+ * @return the isResizable
+ */
+ public boolean isResizable() {
+ return isResizable;
+ }
+
+
+ /**
+ * Returns the label as <code>String</code> for the column represented
+ * by this enum.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+
+ /**
+ * Returns the relative weight for the column represented by this enum.
+ * <p>
+ * Weight is used for setting up relative column width.
+ *
+ * @return the weight as int.
+ */
+ public int getWeight() {
+ return weight;
+ }
+
+ }
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/BuildDefinitionInfoSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/BuildDefinitionInfoSection.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ConnectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ConnectAction.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ConnectAction.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ConnectAction.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,68 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import org.apache.maven.continuum.model.project.Project;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+/**
+ * TODO: Review and factor out common view elements and actions to common
+ * packages.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class ConnectAction extends SelectionProviderAction {
+
+ private Shell shell;
+
+
+ protected ConnectAction(Shell shell, ISelectionProvider provider, String name) {
+ super (provider, name);
+ this.shell = shell;
+ }
+
+
+ /**
+ * Connects to the selected Connection Profile and obtains a list of
+ * {@link Project}s from the remote server.
+ */
+ @Override
+ public void run() {
+ super.run ();
+ System.err.println ("Connecting to remote Continuum instance...");
+ // TODO Auto-generated method stub
+ System.err.println ("Connected!");
+
+ }
+
+
+ /**
+ * Enable/Disable the state of this action based on the selection.
+ * <p>
+ * Say if a 'project' was selected in the view then we don't need the
+ * Connect Action to be active.
+ */
+ @Override
+ public void selectionChanged(ISelection selection) {
+ // TODO Auto-generated method stub
+ super.selectionChanged (selection);
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ConnectAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ConnectAction.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditBuildDefinitionDialog.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditBuildDefinitionDialog.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditBuildDefinitionDialog.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditBuildDefinitionDialog.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,132 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Accepts {@link Project} instance and creates a dialog around it for
+ * edit/update.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class EditBuildDefinitionDialog extends AbstractEditDialog {
+
+ /**
+ * Project instance to edit and update.
+ */
+ private BuildDefinition buildDefinition;
+
+ private ArrayList defaultValues = null;
+
+
+ /**
+ * @param shell
+ * @param buildDefinition
+ * {@link Project} instance to edit/update.
+ */
+ public EditBuildDefinitionDialog(IShellProvider shell, BuildDefinition buildDefinition) {
+ this (shell.getShell (), buildDefinition);
+ }
+
+
+ /**
+ * @param parentShell
+ * @param project
+ * {@link Project} instance to edit/update.
+ */
+ public EditBuildDefinitionDialog(Shell parentShell, BuildDefinition buildDefinition) {
+ super (parentShell);
+ this.buildDefinition = buildDefinition;
+ this.defaultValues = getDefaultValues (buildDefinition);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.continuum.ui.views.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea (parent);
+ // Add UI elements.
+ createDialogContents (composite, "Build Definition Details");
+ return composite;
+ }
+
+
+ /**
+ * Creates labels and controls for the Dialog box.
+ *
+ * @param composite
+ * @param groupTitle
+ */
+ private void createDialogContents(Composite composite, String groupTitle) {
+ Group group = createGroup (composite, groupTitle, 4);
+ List subGroupList = new ArrayList ();
+ for (Iterator i = defaultValues.iterator (); i.hasNext ();) {
+ DefaultValue defaultValue = (DefaultValue) i.next ();
+ Label label = null;
+ Class setType = defaultValue.method.getParameterTypes ()[0];
+
+ // based on setType, layout the labels and respective controls.
+ if (setType.equals (String.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createTextField (group);
+ // ((Text) defaultValue.widget).setText
+ // (defaultValue.method.getName ().substring (3));
+ ((Text) defaultValue.widget).setText ("");
+ } else if (setType.equals (int.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createTextField (group);
+ ((Text) defaultValue.widget).setText ("");
+ } else if (setType.equals (float.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createTextField (group);
+ ((Text) defaultValue.widget).setText ("");
+ } else if (setType.equals (Boolean.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createButton (group, "", SWT.CHECK | SWT.LEFT);
+ } else if (setType.equals (List.class)) {
+ // Group subGroup = createGroup (group, defaultValue.label, 2);
+ subGroupList.add (defaultValue);
+ }
+ }
+ // render subgroups here with lookup Buttons.
+ for (Iterator it = subGroupList.iterator (); it.hasNext ();) {
+ DefaultValue defaultValue = (DefaultValue) it.next ();
+ defaultValue.widget = null;
+ Label label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createButton (group, " View ", SWT.PUSH | SWT.CENTER);
+ }
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditBuildDefinitionDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditBuildDefinitionDialog.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditProjectDialog.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditProjectDialog.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditProjectDialog.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditProjectDialog.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,131 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.continuum.model.project.Project;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Accepts {@link Project} instance and creates a dialog around it for
+ * edit/update.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class EditProjectDialog extends AbstractEditDialog {
+
+ /**
+ * Project instance to edit and update.
+ */
+ private Project project;
+
+ private ArrayList defaultValues = null;
+
+
+ /**
+ * @param parentShell
+ * @param project
+ * {@link Project} instance to edit/update.
+ */
+ public EditProjectDialog(IShellProvider parentShell, Project project) {
+ this (parentShell.getShell (), project);
+ }
+
+
+ /**
+ * @param parentShell
+ * @param project
+ * {@link Project} instance to edit/update.
+ */
+ public EditProjectDialog(Shell parentShell, Project project) {
+ super (parentShell);
+ this.project = project;
+ this.defaultValues = getDefaultValues (project);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.continuum.ui.views.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea (parent);
+ // Add UI elements.
+ createDialogContents (composite, "Project Details");
+ return composite;
+ }
+
+
+ /**
+ * Creates labels and controls for the Dialog box.
+ *
+ * @param composite
+ * @param groupTitle
+ */
+ private void createDialogContents(Composite composite, String groupTitle) {
+ Group group = createGroup (composite, groupTitle, 4);
+ List subGroupList = new ArrayList ();
+ for (Iterator i = defaultValues.iterator (); i.hasNext ();) {
+ DefaultValue defaultValue = (DefaultValue) i.next ();
+ Label label = null;
+ Class setType = defaultValue.method.getParameterTypes ()[0];
+
+ // based on setType, layout the labels and respective controls.
+ if (setType.equals (String.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createTextField (group);
+ // ((Text) defaultValue.widget).setText
+ // (defaultValue.method.getName ().substring (3));
+ ((Text) defaultValue.widget).setText ("");
+ } else if (setType.equals (int.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createTextField (group);
+ ((Text) defaultValue.widget).setText ("");
+ } else if (setType.equals (float.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createTextField (group);
+ ((Text) defaultValue.widget).setText ("");
+ } else if (setType.equals (Boolean.class)) {
+ label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createButton (group, "", SWT.CHECK | SWT.LEFT);
+ } else if (setType.equals (List.class)) {
+ // Group subGroup = createGroup (group, defaultValue.label, 2);
+ subGroupList.add (defaultValue);
+ }
+ }
+ // render subgroups here with lookup Buttons.
+ for (Iterator it = subGroupList.iterator (); it.hasNext ();) {
+ DefaultValue defaultValue = (DefaultValue) it.next ();
+ defaultValue.widget = null;
+ Label label = createLabel (group, defaultValue.label);
+ defaultValue.widget = createButton (group, " View ", SWT.PUSH | SWT.CENTER);
+ }
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditProjectDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/EditProjectDialog.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewBuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewBuildDefinitionAction.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewBuildDefinitionAction.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewBuildDefinitionAction.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.continuum.ui.views;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ * Displays a Dialog to capture user input to create new Build definition.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class NewBuildDefinitionAction extends AbstractOpenDialogAction {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.continuum.ui.views.AbstractNewDialogAction#createDialog(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ protected TitleAreaDialog createDialog(IWorkbenchWindow window) {
+
+ return super.createDialog (window);
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewBuildDefinitionAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewBuildDefinitionAction.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewConnectionAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewConnectionAction.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewConnectionAction.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewConnectionAction.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import org.apache.continuum.ui.wizard.CreateConnectionProfileWizard;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ * TODO: Review and factor out common view elements and actions to common
+ * packages.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class NewConnectionAction extends AbstractOpenDialogAction {
+
+ public NewConnectionAction() {
+ super ();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.continuum.ui.views.AbstractNewDialogAction#createDialog(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ protected TitleAreaDialog createDialog(IWorkbenchWindow window) {
+ ISelection selection = window.getSelectionService ().getSelection ();
+ IStructuredSelection structuredSelection = StructuredSelection.EMPTY;
+ if (selection instanceof IStructuredSelection)
+ structuredSelection = (IStructuredSelection) selection;
+ IWorkbench workbench = window.getWorkbench ();
+ // Create the New Connection Wizard dialog and return for display.
+ CreateConnectionProfileWizard wizard = new CreateConnectionProfileWizard ();
+ wizard.init (workbench, structuredSelection);
+ WizardDialog newDlg = new WizardDialog (workbench.getActiveWorkbenchWindow ().getShell (), wizard);
+ return newDlg;
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewConnectionAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/NewConnectionAction.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/OpenProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/OpenProjectAction.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/OpenProjectAction.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/OpenProjectAction.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import org.apache.maven.continuum.model.project.Project;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+/**
+ * Opens up a Project Details View in a new Edit Part for the user to update.
+ * <p>
+ * This should check permissions if the user is allowed to access/edit the
+ * selected project or not.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class OpenProjectAction extends SelectionProviderAction {
+
+ private Shell shell;
+
+
+ protected OpenProjectAction(Shell shell, ISelectionProvider provider, String name) {
+ super (provider, name);
+ this.shell = shell;
+ }
+
+
+ /**
+ * Connects to the selected Connection Profile and obtains a list of
+ * {@link Project}s from the remote server.
+ */
+ @Override
+ public void run() {
+ super.run ();
+ System.err.println ("Opening Project 'Unknown'");
+ // TODO Auto-generated method stub
+ System.err.println ("Opened!");
+
+ }
+
+
+ /**
+ * Enable/Disable the state of this action based on the selection.
+ * <p>
+ * Say if a 'project' was selected in the view then we don't need the
+ * Connect Action to be active.
+ */
+ @Override
+ public void selectionChanged(ISelection selection) {
+ // TODO Auto-generated method stub
+ super.selectionChanged (selection);
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/OpenProjectAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/OpenProjectAction.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectInfoSection.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectInfoSection.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectInfoSection.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectInfoSection.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,164 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.continuum.ui.views;
+
+import org.apache.continuum.internal.model.ProjectAdapter;
+import org.apache.maven.continuum.model.project.Project;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.IPropertySource2;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * Displays the section with Project details for a selected project.
+ * <p>
+ * TODO: Factor out Label Strings to use Message Bundle.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class ProjectInfoSection extends AbstractPropertySection {
+
+ private CLabel labelGroupId;
+
+ private CLabel labelArtifactId;
+
+ private CLabel labelVersion;
+
+ private CLabel labelTotalBuilds;
+
+ private ProjectAdapter adapter;
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ // TODO Auto-generated method stub
+ super.createControls (parent, aTabbedPropertySheetPage);
+ Composite composite = getWidgetFactory ().createFlatFormComposite (parent);
+ FormData data = null;
+ CLabel label = null;
+
+ // Laying controls right-to-left
+ data = new FormData ();
+ data.left = new FormAttachment (0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment (75, 0);
+ data.top = new FormAttachment (0, ITabbedPropertyConstants.VSPACE);
+ labelGroupId = getWidgetFactory ().createCLabel (composite, "");
+ labelGroupId.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, 0);
+ data.right = new FormAttachment (labelGroupId, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment (labelGroupId, 0, SWT.CENTER);
+ label = getWidgetFactory ().createCLabel (composite, "Group Id: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment (75, 0);
+ data.top = new FormAttachment (labelGroupId, ITabbedPropertyConstants.VSPACE);
+ labelArtifactId = getWidgetFactory ().createCLabel (composite, "");
+ labelArtifactId.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, 0);
+ data.right = new FormAttachment (labelArtifactId, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment (labelGroupId, ITabbedPropertyConstants.VSPACE);
+ label = getWidgetFactory ().createCLabel (composite, "Artifact Id: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment (75, 0);
+ data.top = new FormAttachment (labelArtifactId, ITabbedPropertyConstants.VSPACE);
+ labelVersion = getWidgetFactory ().createCLabel (composite, "");
+ labelVersion.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, 0);
+ data.right = new FormAttachment (labelVersion, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment (labelArtifactId, ITabbedPropertyConstants.VSPACE);
+ label = getWidgetFactory ().createCLabel (composite, "Version: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment (75, 0);
+ data.top = new FormAttachment (labelVersion, ITabbedPropertyConstants.VSPACE);
+ labelTotalBuilds = getWidgetFactory ().createCLabel (composite, "");
+ labelTotalBuilds.setLayoutData (data);
+
+ data = new FormData ();
+ data.left = new FormAttachment (0, 0);
+ data.right = new FormAttachment (labelTotalBuilds, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment (labelVersion, ITabbedPropertyConstants.VSPACE);
+ label = getWidgetFactory ().createCLabel (composite, "Total Builds: ");
+ label.setLayoutData (data);
+
+ // TODO Add Edit button that pops up the Edit Project Dialog.
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#setInput(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput (part, selection);
+ Assert.isTrue (selection instanceof IStructuredSelection);
+ Object input = ((IStructuredSelection) selection).getFirstElement ();
+ if (input instanceof ProjectAdapter) {
+ this.adapter = (ProjectAdapter) input;
+ }
+ // ignore others
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ super.refresh ();
+ adapter.getAdapter (IPropertySource2.class);
+ Project p = adapter.getProject ();
+ labelGroupId.setText (p.getGroupId ());
+ labelArtifactId.setText (p.getArtifactId ());
+ labelVersion.setText (p.getVersion ());
+ labelTotalBuilds.setText (Integer.toString (p.getBuildNumber ()));
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectInfoSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectInfoSection.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectListViewer.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectListViewer.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectListViewer.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectListViewer.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,279 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.continuum.Activator;
+import org.apache.continuum.internal.ConnectionProfileManager;
+import org.apache.continuum.internal.model.BuildDefinitionAdapter;
+import org.apache.continuum.internal.model.ProjectAdapter;
+import org.apache.continuum.model.ConnectionProfile;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.rpc.ProjectsReader;
+import org.apache.xmlrpc.XmlRpcException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * Controller entity of the MVC paradigm.
+ * <p>
+ * This renders the Project view.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ */
+public class ProjectListViewer extends TreeViewer {
+
+ /**
+ * Array of Table headers for the Category Document view.
+ */
+ // private static ColumnHeaders [] headers = ColumnHeaders.values ();
+ // View that is rendered by this viewer.
+ private ProjectsView view;
+
+
+ /**
+ * Create an instance of table-based {@link ProjectListViewer}.
+ *
+ * @param view
+ * {@link Composite} parent to use for creating this viewer.
+ * @param treeTable
+ * set of SWT.* options that could be used for styling up this
+ * viewer.
+ */
+ public ProjectListViewer(ProjectsView view, Tree treeTable) {
+ super (treeTable);
+ this.view = view;
+ setContentProvider (new ViewContentProvider ());
+ setLabelProvider (new LabelProvider ());
+ // No input initially.
+ setInput ("ROOT");
+ IActionBars actionBars = view.getViewSite ().getActionBars ();
+ // FIXME: Add appropriate action handler here
+ actionBars.setGlobalActionHandler (ActionFactory.DELETE.getId (), new NewConnectionAction ());
+ }
+
+ // ------------------------------------------------------------------------
+ // Content Provider Implementation for the viewer.
+ // ------------------------------------------------------------------------
+
+ public class ViewContentProvider implements ITreeContentProvider {
+
+ /**
+ * TODO: Review this implementation.
+ */
+ public Object [] getElements(Object elt) {
+ return getChildren (elt);
+ }
+
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+ System.err.println ("VieweContentProvider.inputChanged()");
+ }
+
+
+ /**
+ * @param elt
+ * Parent Element.
+ */
+ public Object [] getChildren(Object elt) {
+ if (elt instanceof ConnectionProfile) {
+ ConnectionProfile cp = (ConnectionProfile) elt;
+ // Obtain projects for this connection profile
+ String url = cp.getConnectionUrl ();
+ try {
+ ProjectsReader pr = new ProjectsReader (new URL (url));
+ Project [] projects = pr.readProjects ();
+ // return projects;
+ // Return Adaptable instances for Project
+ ProjectAdapter [] adapters = new ProjectAdapter[projects.length];
+ for (int i = 0; i < projects.length; i++) {
+ adapters[i] = new ProjectAdapter (projects[i]);
+ }
+ return adapters;
+ } catch (MalformedURLException e) {
+ // TODO: better error reporting.
+ Activator.getDefault ().getLog ().log (new Status (IStatus.ERROR, Activator.PLUGIN_ID, -1, e.getLocalizedMessage (), e));
+ } catch (XmlRpcException e) {
+ // TODO: better error reporting.
+ Activator.getDefault ().getLog ().log (new Status (IStatus.ERROR, Activator.PLUGIN_ID, -1, e.getLocalizedMessage (), e));
+ } catch (IOException e) {
+ // TODO: better error reporting.
+ Activator.getDefault ().getLog ().log (new Status (IStatus.ERROR, Activator.PLUGIN_ID, -1, e.getLocalizedMessage (), e));
+ } catch (Exception e) {
+ // TODO: better error reporting.
+ Activator.getDefault ().getLog ().log (new Status (IStatus.ERROR, Activator.PLUGIN_ID, -1, e.getLocalizedMessage (), e));
+ }
+ }
+
+ if (elt instanceof ProjectAdapter) {
+ List builds = ((ProjectAdapter) elt).getProject ().getBuildDefinitions ();
+ // we return BuildAdapter[]
+ BuildDefinitionAdapter [] ba = new BuildDefinitionAdapter[builds.size ()];
+ for (int i = 0; i < ba.length; i++) {
+ ba[i] = new BuildDefinitionAdapter ((BuildDefinition) builds.get (i));
+ }
+ return ba;
+ }
+
+ // Else, we are creating view contents afresh
+ System.err.println ("Loading Connection Profiles...");
+ List<ConnectionProfile> list = new ArrayList<ConnectionProfile> ();
+ try {
+ list = ConnectionProfileManager.loadConnectionProfiles ();
+ } catch (CoreException e) {
+ // log and swallow for the moment
+ Activator.getDefault ().getLog ().log (new Status (IStatus.ERROR, Activator.PLUGIN_ID, -1, e.getLocalizedMessage (), e));
+ // TODO: better Error reporting mechanism.
+ }
+ return list.toArray ();
+ }
+
+
+ public Object getParent(Object elt) {
+ // TODO: Obtain parent node based class of passed in element.
+ System.err.println ("VieweContentProvider.getParent()");
+ return null;
+ }
+
+
+ /**
+ * Determines if a node element in the viewer has children.
+ *
+ * @return <code>true</code> if a selected node element had children.
+ */
+ public boolean hasChildren(Object elt) {
+ if (elt instanceof ConnectionProfile) {
+ ConnectionProfile cpd = (ConnectionProfile) elt;
+ try {
+ // Obtain projects for this connection profile
+ String url = cpd.getConnectionUrl ();
+ ProjectsReader pr = new ProjectsReader (new URL (url));
+ Project [] projects = pr.readProjects ();
+ return (null != projects && projects.length > 0);
+ } catch (Exception e) {
+ MessageDialog.openError (view.getSite ().getShell (), "Error", e.getMessage ());
+ return false;
+ }
+ }
+
+ if (elt instanceof ProjectAdapter) {
+ Project p = ((ProjectAdapter) elt).getProject ();
+ return (null != p.getBuildDefinitions () && p.getBuildDefinitions ().size () > 0);
+ }
+
+ return false;
+ }
+
+ }
+
+ // ------------------------------------------------------------------------
+ // Label Provider Implementation for the viewer.
+ // ------------------------------------------------------------------------
+
+ public class LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ // TODO Return proper image.
+ return null;
+ }
+
+
+ public String getColumnText(Object elt, int colIdx) {
+ if (elt instanceof ConnectionProfile) {
+ ConnectionProfile cpd = (ConnectionProfile) elt;
+ if (colIdx == 0)
+ return cpd.getId ();
+ }
+
+ // FIXME : Build column labels appropriately, currently testing
+ // only.
+ if (elt instanceof ProjectAdapter) {
+ Project p = ((ProjectAdapter) elt).getProject ();
+ if (colIdx == 0)
+ return p.getName ();
+ if (colIdx == 1)
+ return Integer.toString (p.getState ());
+ if (colIdx == 2)
+ return p.getGroupId ();
+ }
+
+ if (elt instanceof BuildDefinitionAdapter) {
+ BuildDefinition bd = ((BuildDefinitionAdapter) elt).getBuildDefinition ();
+ if (colIdx == 0)
+ return Integer.toString (bd.getId ());
+ if (colIdx == 1)
+ return bd.getGoals ();
+ if (colIdx == 2)
+ return bd.getArguments ();
+ if (colIdx == 3)
+ return (null != bd.getSchedule ()) ? bd.getSchedule ().getName () : "";
+ }
+
+ return "";
+ }
+
+
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectListViewer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectListViewer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectsView.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectsView.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectsView.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectsView.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,318 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.continuum.ui.views;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.continuum.Activator;
+import org.apache.continuum.internal.model.BuildDefinitionAdapter;
+import org.apache.continuum.internal.model.ProjectAdapter;
+import org.apache.continuum.model.ConnectionProfile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * Class that plugs in a Project List view into the workbench. The view shows
+ * data obtained from the model.
+ * <p>
+ * <em>The sample creates a dummy model on the fly, but a real implementation would
+ * connect to the model available either in this or another plug-in (e.g. the
+ * workspace). The view is connected to the model using a content provider.
+ * </em>
+ * <p>
+ * The view uses a label provider to define how model objects should be
+ * presented in the view. Each view can present the same model objects using
+ * different labels and icons, if needed. Alternatively, a single label provider
+ * can be shared between views in order to ensure that objects of the same type
+ * are presented in the same way everywhere.
+ * <p>
+ */
+
+public class ProjectsView extends ViewPart implements ITabbedPropertySheetPageContributor {
+
+ private static final int DEFAULT_COLUMN_WIDTH = 200;
+
+ private static final int MIN_COLUMN_WIDTH = 5;
+
+ /**
+ * Key to persist View's column widths.
+ */
+ private static final String TAG_COLUMN_WIDTH = "columnWidth";
+
+ /**
+ * number of columns.
+ */
+ protected int [] cols = new int[4];
+
+ protected Tree treeTable;
+
+ private ProjectListViewer tableViewer;
+
+ // actions on a project/project-build
+ protected List<Action> actions = new ArrayList<Action> ();
+
+ protected MenuManager restartMenu;
+
+
+ public ProjectsView() {
+ super ();
+ }
+
+
+ @Override
+ public void createPartControl(Composite parent) {
+ treeTable = new Tree (parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
+ treeTable.setHeaderVisible (true);
+ treeTable.setLinesVisible (false);
+ treeTable.setLayoutData (new GridData (GridData.FILL_BOTH));
+ treeTable.setFont (parent.getFont ());
+
+ // add columns
+ TreeColumn c1 = new TreeColumn (treeTable, SWT.SINGLE);
+ c1.setText ("Connection/Project");
+ c1.setWidth (cols[0]);
+
+ TreeColumn c2 = new TreeColumn (treeTable, SWT.SINGLE);
+ c2.setText ("Status");
+ c2.setWidth (cols[1]);
+
+ TreeColumn c3 = new TreeColumn (treeTable, SWT.SINGLE);
+ c3.setText ("Group Id");
+ c3.setWidth (cols[2]);
+
+ TreeColumn c4 = new TreeColumn (treeTable, SWT.SINGLE);
+ c4.setText ("Artifact Id");
+ c4.setWidth (cols[3]);
+
+ tableViewer = new ProjectListViewer (this, treeTable);
+ initializeActions (tableViewer);
+
+ // setup listener and wire them to actions.
+ treeTable.addSelectionListener (new SelectionAdapter () {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+ super.widgetSelected (e);
+ }
+
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent evt) {
+ try {
+ TreeItem item = treeTable.getSelection ()[0];
+ Object data = item.getData ();
+ if (data instanceof BuildDefinitionAdapter)
+ return;
+ if (data instanceof ProjectAdapter) {
+ ProjectAdapter pa = (ProjectAdapter) data;
+ // TODO: Open Project details View/Editor.
+ System.err.println ("Opening Project Details Editor...");
+ }
+
+ if (data instanceof ConnectionProfile) {
+ ConnectionProfile cp = (ConnectionProfile) data;
+ // TODO: Open Connection Profile Editor.
+ System.err.println ("Opening Connection Profile Editor...");
+ }
+ } catch (Exception e) {
+ // TODO: Better error logging
+ Activator.getDefault ().getLog ().log (new Status (IStatus.ERROR, Activator.PLUGIN_ID, -1, e.getLocalizedMessage (), e));
+ }
+ }
+
+ });
+
+ hookContextMenu ();
+
+ getSite ().setSelectionProvider (tableViewer);
+
+ }
+
+
+ /**
+ * Setup Context Menu.
+ */
+ private void hookContextMenu() {
+ MenuManager menuManager = new MenuManager ("#PopupMenu");
+ menuManager.setRemoveAllWhenShown (true);
+ final Shell shell = treeTable.getShell ();
+ menuManager.addMenuListener (new IMenuListener () {
+
+ public void menuAboutToShow(IMenuManager mgr) {
+ fillContextMenu (shell, mgr);
+ }
+ });
+ Menu menu = menuManager.createContextMenu (tableViewer.getControl ());
+ treeTable.setMenu (menu);
+ getSite ().registerContextMenu (menuManager, tableViewer);
+ }
+
+
+ /**
+ * Setup Context menu for this view.
+ * <p>
+ * Items in a context menu are determined by the target selection for the
+ * context menu.
+ *
+ * @param shell
+ * @param menu
+ */
+ protected void fillContextMenu(Shell shell, IMenuManager menu) {
+ IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection ();
+ if (!selection.isEmpty ()) {
+ Iterator it = selection.iterator ();
+ Object obj = it.next ();
+ if (obj instanceof ProjectAdapter) {
+ ProjectAdapter p = (ProjectAdapter) obj;
+ // TODO Create Context menu for Project selection
+ }
+ }
+ // If there was nothing under selection then create a context menu
+ // with
+ // 'New Connection' action.
+ menu.add (new GroupMarker (IWorkbenchActionConstants.MB_ADDITIONS));
+
+ Action newConnectionAction = new NewConnectionAction ();
+ newConnectionAction.setToolTipText ("Create New Continuum Connection");
+ newConnectionAction.setText ("New Connection");
+ newConnectionAction.setImageDescriptor (PlatformUI.getWorkbench ().getSharedImages ().getImageDescriptor (ISharedImages.IMG_TOOL_NEW_WIZARD));
+ menu.add (newConnectionAction);
+
+ // TODO: Add other Context menus here.
+ }
+
+
+ /**
+ * Sets up Actions for this View which are wired via listeners registered on
+ * the View to perform actions.
+ *
+ * @param tableViewer2
+ */
+ private void initializeActions(ISelectionProvider selectionProvider) {
+ Action openAction = new OpenProjectAction (getSite ().getShell (), selectionProvider, "Open Project");
+ openAction.setToolTipText ("Open Project");
+ openAction.setText ("Open Project");
+ // FIXME: Some dummy image.
+ openAction.setImageDescriptor (PlatformUI.getWorkbench ().getSharedImages ().getImageDescriptor (ISharedImages.IMG_TOOL_NEW_WIZARD));
+
+ // add to list of actions
+ actions.add (openAction);
+ // add actions to View's toolbar
+ IContributionManager cm = getViewSite ().getActionBars ().getToolBarManager ();
+ for (Iterator it = actions.iterator (); it.hasNext ();) {
+ Action a = (Action) it.next ();
+ cm.add (a);
+ }
+ }
+
+
+ /**
+ * TODO:
+ */
+ @Override
+ public void setFocus() {
+ if (treeTable != null)
+ treeTable.setFocus ();
+ }
+
+
+ // ------------------------------------------------------------------------
+ // For Managing state of the Project List View
+ // ------------------------------------------------------------------------
+
+ /**
+ * Initialize the view and restore any previous UI state or setup with new
+ * one.
+ *
+ * @see {@link ViewPart#init(IViewSite, IMemento)}
+ */
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init (site, memento);
+ for (int i = 0; i < cols.length; i++) {
+ cols[i] = DEFAULT_COLUMN_WIDTH;
+ if (memento != null) {
+ Integer in = memento.getInteger (TAG_COLUMN_WIDTH + i);
+ if (in != null && in.intValue () > MIN_COLUMN_WIDTH)
+ cols[i] = in.intValue ();
+ }
+ }
+ }
+
+
+ /**
+ * Saves the state of this view when this view is closed.
+ *
+ * @see {@link ViewPart#saveState(IMemento)}
+ */
+ @Override
+ public void saveState(IMemento memento) {
+ // super.saveState (memento);
+ TreeColumn [] tc = treeTable.getColumns ();
+ for (int i = 0; i < cols.length; i++) {
+ int width = tc[i].getWidth ();
+ if (width != 0)
+ memento.putInteger (TAG_COLUMN_WIDTH + i, width);
+ }
+ }
+
+
+ /**
+ * Returns Worknbench part's Id.
+ */
+ public String getContributorId() {
+ return getSite ().getId ();
+ }
+
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySheetPage.class)
+ return new TabbedPropertySheetPage (this);
+ return super.getAdapter (adapter);
+ }
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectsView.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/views/ProjectsView.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/wizard/ConnectionProfilePage.java
URL: http://svn.apache.org/viewvc/maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/wizard/ConnectionProfilePage.java?view=auto&rev=492067
==============================================================================
--- maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/wizard/ConnectionProfilePage.java (added)
+++ maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/wizard/ConnectionProfilePage.java Tue Jan 2 23:45:01 2007
@@ -0,0 +1,289 @@
+/**
+ * Copyright 2006 <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.continuum.ui.wizard;
+
+import org.apache.continuum.model.ConnectionProfile;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * WizardPage implementation that captures the information from the user
+ * required to create a Continuum Connection Profile.
+ * <p>
+ * TODO: Review access on setters.
+ *
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ * @since 1.0
+ */
+public class ConnectionProfilePage extends WizardPage {
+
+ /**
+ * Data model that holds Connection Profile preferences.
+ */
+ private ConnectionProfile connectionProfile;
+
+ private Text profileName;
+
+ private Text serverLocation;
+
+ private Text username;
+
+ private Text password;
+
+
+ protected ConnectionProfilePage(String pageName, ConnectionProfile connectionProfile) {
+ super (pageName);
+ this.connectionProfile = connectionProfile;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ FormLayout layout = new FormLayout ();
+
+ Composite container = new Composite (parent, SWT.NULL);
+ container.setLayout (layout);
+
+ FormData data = new FormData ();
+ data.top = new FormAttachment (10, 10);
+ data.width = 100;
+ Label label = new Label (container, SWT.NULL);
+ label.setText ("Profile Name: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (10, 10);
+ data.left = new FormAttachment (label, 10);
+ data.width = 300;
+ profileName = new Text (container, SWT.BORDER);
+ profileName.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (profileName, 10);
+ data.width = 100;
+ label = new Label (container, SWT.NULL);
+ label.setText ("Server Location: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (profileName, 10);
+ data.left = new FormAttachment (label, 10);
+ data.width = 300;
+ serverLocation = new Text (container, SWT.BORDER);
+ serverLocation.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (serverLocation, 10);
+ data.width = 100;
+ label = new Label (container, SWT.NULL);
+ label.setText ("Username: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (serverLocation, 10);
+ data.left = new FormAttachment (label, 10);
+ data.width = 300;
+ username = new Text (container, SWT.BORDER);
+ username.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (username, 10);
+ data.width = 100;
+ label = new Label (container, SWT.NULL);
+ label.setText ("Password: ");
+ label.setLayoutData (data);
+
+ data = new FormData ();
+ data.top = new FormAttachment (username, 10);
+ data.left = new FormAttachment (label, 10);
+ data.width = 300;
+ password = new Text (container, SWT.BORDER | SWT.PASSWORD);
+ password.setLayoutData (data);
+
+ // populate the form with initial values from the model.
+ updateFormFieldValues ();
+
+ setControl (container);
+ }
+
+
+ /**
+ * Populates the form fields from the Model instance.
+ */
+ private void updateFormFieldValues() {
+ profileName.setText (null == connectionProfile.getLabel () ? "" : connectionProfile.getLabel ());
+ serverLocation.setText (null == connectionProfile.getConnectionUrl () ? "" : connectionProfile.getConnectionUrl ());
+ username.setText (null == connectionProfile.getUsername () ? "" : connectionProfile.getUsername ());
+ password.setText (null == connectionProfile.getPassword () ? "" : connectionProfile.getPassword ());
+ }
+
+
+ /**
+ * Obtains the values from the Form fields and updates the model instance.
+ */
+ private void updateModel() {
+ connectionProfile.setId (getProfileName ());
+ connectionProfile.setLabel (getProfileName ());
+ connectionProfile.setConnectionUrl (getServerLocation ());
+ connectionProfile.setUsername (getUsername ());
+ connectionProfile.setPassword (getPassword ());
+ }
+
+
+ /**
+ * Validates the form fields for valid values and other constraints (if
+ * any).
+ *
+ * @return <code>true</code> if validation succeeded, else
+ * <code>false</code> to indicate a validation failure.
+ */
+ public boolean validate() {
+ if (profileName.getText ().trim ().equals (""))
+ return false;
+ if (serverLocation.getText ().trim ().equals (""))
+ return false;
+
+ return true;
+ }
+
+
+ /**
+ * Cleanup!
+ */
+ @Override
+ public void dispose() {
+ super.dispose ();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#getControl()
+ */
+ @Override
+ public Control getControl() {
+ return super.getControl ();
+ }
+
+
+ /**
+ * This is called when the wizard finishes off walking-thru the user.
+ */
+ public void finish() {
+ // populate the connection profile model
+ updateModel ();
+ }
+
+
+ /**
+ * @return the connectionProfileData
+ */
+ public ConnectionProfile getConnectionProfileData() {
+ return connectionProfile;
+ }
+
+
+ /**
+ * @param connectionProfile
+ * the connectionProfileData to set
+ * @deprecated <em>Experimental</em>
+ */
+ @Deprecated
+ public void setConnectionProfileData(ConnectionProfile connectionProfile) {
+ this.connectionProfile = connectionProfile;
+ }
+
+
+ /**
+ * @return the password
+ */
+ public String getPassword() {
+ return password.getText ();
+ }
+
+
+ /**
+ * @param password
+ * the password to set
+ */
+ public void setPassword(String v) {
+ password.setText (v);
+ }
+
+
+ /**
+ * @return the profileName
+ */
+ public String getProfileName() {
+ return profileName.getText ();
+ }
+
+
+ /**
+ * @param v
+ * the profileName to set
+ */
+ public void setProfileName(String v) {
+ profileName.setText (v);
+ }
+
+
+ /**
+ * @return the serverLocation
+ */
+ public String getServerLocation() {
+ return serverLocation.getText ();
+ }
+
+
+ /**
+ * @param v
+ * the serverLocation to set
+ */
+ public void setServerLocation(String v) {
+ serverLocation.setText (v);
+ }
+
+
+ /**
+ * @return the username
+ */
+ public String getUsername() {
+ return username.getText ();
+ }
+
+
+ /**
+ * @param v
+ * the username to set
+ */
+ public void setUsername(String v) {
+ username.setText (v);
+ }
+
+}
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/wizard/ConnectionProfilePage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/sandbox/continuum-eclipse-plugin/src/org/apache/continuum/ui/wizard/ConnectionProfilePage.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"