krysalis-version/src/java/org/krysalis/version/eclipse/plugin/views ConstraintSectionsView.java,NONE,1.1 VersionListViewer.java,1.3,1.4

[email protected] Fri, 21 Mar 2003 15:33:00 -0800
Newsgroups gmane.comp.krysalis.sandbox
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/eclipse/plugin/views
In directory sc8-pr-cvs1:/tmp/cvs-serv22996/src/java/org/krysalis/version/eclipse/plugin/views

Modified Files:
	VersionListViewer.java 
Added Files:
	ConstraintSectionsView.java 
Log Message:
Constraint changes

--- NEW FILE: ConstraintSectionsView.java ---
/*****************************************************************************
 * Copyright (C) The Krysalis project. All rights reserved.                  *
 * ------------------------------------------------------------------------- *
 * This software is published under the terms of the Krysalis Patchy         *
 * Software License version 1.1_01, a copy of which has been included        *
 * at the bottom of this file.                                               *
 *****************************************************************************/
package org.krysalis.version.eclipse.plugin.views;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.part.ViewPart;
import org.krysalis.version.constraint.ConstraintSet;
import org.krysalis.version.eclipse.plugin.model.ConstraintContentProvider;
import org.krysalis.version.eclipse.plugin.model.ConstraintModelFactory;
import org.krysalis.version.eclipse.plugin.util.IConstraintConstants;

/**
 * This class demonstrates a simple view containing a single viewer.
 */
public class ConstraintSectionsView extends ViewPart implements ISelectionListener
{
	ListViewer viewer;
	ConstraintContentProvider m_contentProvider = null;
	
	/**
	 * Creates a new ConstraintSectionsView .
	 */
	public ConstraintSectionsView()
	{
		super();
	}
	/* (non-Javadoc)
	 * Method declared on IWorkbenchPart
	 */
	public void createPartControl(Composite parent)
	{
		System.out.println("ConstraintSectionsView::createPartControl");
		viewer = new ListViewer(parent);

		WorkbenchHelp.setHelp(viewer.getControl(), IConstraintConstants.SECTIONS_VIEW_CONTEXT);

		// if the objects in the viewer implement the IDesktopElement adapter,
		// these generic content and label providers can be used.
		m_contentProvider = new ConstraintContentProvider();
		viewer.setContentProvider(m_contentProvider);
		viewer.setLabelProvider(new LabelProvider());

		// add myself as a global selection listener
		getSite().getPage().addSelectionListener(this);

		// prime the selection
		selectionChanged(null, getSite().getPage().getSelection());
	}
	/**
	 * The <code>ConstraintSectionView</code> implementation of this 
	 * <code>IWorkbenchPart</code> method runs super
	 * and removes itself from the global selection listener. 
	 */
	public void dispose()
	{
		super.dispose();
		getSite().getPage().removeSelectionListener(this);
	}
	/* (non-Javadoc)
	 * Method declared on ISelectionListener
	 */
	public void selectionChanged(IWorkbenchPart part, ISelection sel)
	{
		System.out.println("ConstraintSectionsView::selectionChanged");
		//if the selection is a Constraint file, get its sections.
		ConstraintSet input = ConstraintModelFactory.getInstance().getConstraints(sel);
		viewer.setInput(input);
	}
	

	/* (non-Javadoc)
	 * Method declared on IWorkbenchPart
	 */
	public void setFocus()
	{
		viewer.getControl().setFocus();
	}
}
/*
The Krysalis Patchy Software License, Version 1.1_01
Copyright (c) 2002-2003  Nicola Ken Barozzi.  All rights reserved.

This Licence is compatible with the BSD licence as described and 
approved by http://www.opensource.org/, and is based on the
Apache Software Licence Version 1.1.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

3. The end-user documentation included with the redistribution,
if any, must include the following acknowledgment:
   "This product includes software developed for project 
	Krysalis (http://www.krysalis.org/)."
Alternately, this acknowledgment may appear in the software itself,
if and wherever such third-party acknowledgments normally appear.

4. The names "Krysalis" and "Nicola Ken Barozzi" and
"Krysalis Centipede" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact [email protected].

5. Products derived from this software may not be called "Krysalis",
"Krysalis Centipede", nor may "Krysalis" appear in their name,
without prior written permission of Nicola Ken Barozzi.

6. This software may contain voluntary contributions made by many 
individuals, who decided to donate the code to this project in
respect of this licence.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.  IN NO EVENT SHALL THE KRYSALIS PROJECT OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
====================================================================*/
Index: VersionListViewer.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/eclipse/plugin/views/VersionListViewer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** VersionListViewer.java	5 Mar 2003 19:58:02 -0000	1.3
--- VersionListViewer.java	21 Mar 2003 23:32:58 -0000	1.4
***************
*** 11,16 ****
  import org.eclipse.swt.widgets.Composite;
  import org.eclipse.swt.widgets.List;
- import org.krysalis.version.collecting.VersionCollection;
- import org.krysalis.version.collecting.VersionCollector;
  
  /**
--- 11,14 ----




-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en