Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > subclipse commit: rev 20 - in trunk/subclipse/ui: . src/org/tigris/subversion/subclipse/ui src/org/tigris/subversion/subclipse/ui/comments src/org/tigris/subversion/subclipse/ui/compare src/org/tigris/subversion/subclipse/ui/wizards

subclipse
Discussion topic

Back to topic list

subclipse commit: rev 20 - in trunk/subclipse/ui: . src/org/tigris/subversion/subclipse/ui src/org/tigris/subversion/subclipse/ui/comments src/org/tigris/subversion/subclipse/ui/compare src/org/tigris/subversion/subclipse/ui/wizards

Author cchab
Full name chabanois cédric
Date 2003-06-30 12:14:58 PDT
Message Author: cchab
Date: Mon Jun 30 14:14:55 2003
New Revision: 20

Added:
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/CommentCommitW​izardPage.java
Modified:
   trunk/subclipse/ui/p​lugin.properties
   trunk/subclipse/ui/plugin.xml
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/IS​VNUIConstants.java
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/Im​ageDescriptors.java
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/CommitComment​Area.java
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/ReleaseCommen​tDialog.java
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mpare/SVNCompareEdit​orInput.java
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/me​ssages.properties
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizard.java
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizardMainPage.java​
Log:
added a wizard to create a new remote folder on repository

Modified: trunk/subclipse/ui/p​lugin.properties
====================​====================​====================​==================
--- trunk/subclipse/ui/p​lugin.properties (original)
+++ trunk/subclipse/ui/p​lugin.properties Mon Jun 30 14:14:55 2003
@@ -29,6 +29,9 @@
 DecoratorStandard.name=SVN
 DecoratorStandard.desc=Shows SVN specific information on resources in projects under SVN control. Information includes the revision number, branch or version name, etc.
 
+CreateRemoteFolderA​ction.label=New remote folder
+CreateRemoteFolderA​ction.tooltip=Create​s a new remote folder on repository
+
 AddAction.label=&Add to Version Control
 AddAction.tooltip=Add the Selected Resources to Version Control
 

Modified: trunk/subclipse/ui/plugin.xml
====================​====================​====================​==================
--- trunk/subclipse/ui/plugin.xml (original)
+++ trunk/subclipse/ui/plugin.xml Mon Jun 30 14:14:55 2003
@@ -63,6 +63,34 @@
 <!-- ************** Popup menus *************** -->
    <extension
          point="org.eclipse.u​i.popupMenus">
+<!-- contribution for ISVNRepositoryLocation -->
+ <objectContribution
+ objectClass="org.tig​ris.subversion.subcl​ipse.core.ISVNReposi​toryLocation"
+ id="org.tigris.subve​rsion.subclipse.ui.R​epositoryLocationCon​tributions">
+ <action
+ label="%CreateRemote​FolderAction.label"
+ helpContextId="org.t​igris.subversion.sub​clipse.ui.create_rem​ote_folder_action_co​ntext"
+ tooltip="%CreateRemo​teFolderAction.toolt​ip"
+ icon="icons/full/wiz​ards/newfolder_wiz.g​if"
+ class="org.tigris.su​bversion.subclipse.u​i.actions.CreateRemo​teFolderAction"
+ menubarPath="group.a​dd/additions"
+ id="org.tigris.subve​rsion.subclipse.ui.c​reateRemoteFolder"​>
+ </action>
+ </objectContribution>
+<!-- contribution for ISVNRemoteResource -->
+ <objectContribution
+ objectClass="org.tig​ris.subversion.subcl​ipse.core.ISVNRemote​Resource"
+ id="org.tigris.subve​rsion.subclipse.ui.R​emoteResourceContrib​utions">
+ <action
+ label="%CreateRemote​FolderAction.label"
+ helpContextId="org.t​igris.subversion.sub​clipse.ui.create_rem​ote_folder_action_co​ntext"
+ tooltip="%CreateRemo​teFolderAction.toolt​ip"
+ icon="icons/full/wiz​ards/newfolder_wiz.g​if"
+ class="org.tigris.su​bversion.subclipse.u​i.actions.CreateRemo​teFolderAction"
+ menubarPath="group.a​dd/additions"
+ id="org.tigris.subve​rsion.subclipse.ui.c​reateRemoteFolder"​>
+ </action>
+ </objectContribution>
 <!-- contribution for ISVNRemoteFile -->
       <objectContribution
             objectClass="org.tig​ris.subversion.subcl​ipse.core.ISVNRemote​File"

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/IS​VNUIConstants.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/IS​VNUIConstants.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/IS​VNUIConstants.java Mon Jun 30 14:14:55 2003
@@ -48,6 +48,8 @@
     
     // wizards
     public final String IMG_NEWLOCATION = "wizards/newlocation_wiz.gif"; //$NON-NLS-1$
+ public final String IMG_NEWFOLDER = "wizards/newfolder_wiz.gif"; //$NON-NLS-1$
+
     
     // preferences
     public final String PREF_SHOW_COMMENTS = "pref_show_comments"; //$NON-NLS-1$
@@ -104,6 +106,8 @@
     public final String IMG_WIZBAN_DIFF = "wizban/createpatch_​wizban.gif"; //$NON-NLS-1$
     public final String IMG_WIZBAN_KEYWORD = "wizban/keywordsub_wizban.gif"; //$NON-NLS-1$
     public final String IMG_WIZBAN_NEW_LOCATION = "wizban/newlocation_​wizban.gif"; //$NON-NLS-1$
+ public final String IMG_WIZBAN_NEW_FOLDER = "wizban/newfolder_wizban.gif"; //$NON-NLS-1$
+
     // XXX checkout is same as ne connect. If it changes, it must be initialized
     public final String IMG_WIZBAN_CHECKOUT = "wizban/newconnect_wizban.gif"; //$NON-NLS-1$
     

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/Im​ageDescriptors.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/Im​ageDescriptors.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/Im​ageDescriptors.java Mon Jun 30 14:14:55 2003
@@ -57,6 +57,7 @@
         createImageDescripto​r(ISVNUIConstants.IM​G_COLLAPSE_ALL, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_COLLAPSE_ALL_ENABL​ED, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_NEWLOCATION, baseURL);
+ createImageDescripto​r(ISVNUIConstants.IM​G_NEWFOLDER, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_TAG, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_MODULE, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_CLEAR, baseURL);
@@ -70,6 +71,7 @@
         createImageDescripto​r(ISVNUIConstants.IM​G_WIZBAN_DIFF, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_WIZBAN_KEYWORD, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_WIZBAN_NEW_LOCATIO​N, baseURL);
+ createImageDescripto​r(ISVNUIConstants.IM​G_WIZBAN_NEW_FOLDER,​ baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_MERGEABLE_CONFLICT​, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_QUESTIONABLE, baseURL);
         createImageDescripto​r(ISVNUIConstants.IM​G_MERGED, baseURL);

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/CommitComment​Area.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/CommitComment​Area.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/CommitComment​Area.java Mon Jun 30 14:14:55 2003
@@ -135,17 +135,7 @@
         // (see bug 32078: http://bugs.eclipse.​org/bugs/show_bug.cg​i?id=32078)
         previousCommentsComb​o.setText(""); //$NON-NLS-1$
         
- // determine the initial comment text
- String initialComment;
- try {
- initialComment = getCommitTemplate();
- } catch (SVNException e) {
- SVNUIPlugin.log(e);
- initialComment = null;
- }
- if (initialComment != null && initialComment.length() != 0) {
- text.setText(initialComment);
- }
+ text.setText("");
     }
 
     /*
@@ -181,18 +171,10 @@
      * Method clearCommitText.
      */
     private void clearCommitText() {
- try {
- text.setText(getComm​itTemplate());
- previousCommentsComb​o.deselectAll();
- } catch (SVNException e) {
- SVNUIPlugin.openErro​r(getShell(), null, null, e, SVNUIPlugin.PERFORM_SYNC_EXEC);
- }
+ text.setText("");
+ previousCommentsComb​o.deselectAll();
     }
 
- private String getCommitTemplate() throws SVNException {
- return "";
- }
-
     /**
      * Method getProvider.
      */
@@ -207,14 +189,7 @@
      */
     private String getSelectedComment() {
         if (comments.length == 0) {
- // There are no previous comments so use the template
- try {
- return getCommitTemplate();
- } catch (SVNException e) {
- // log the exception for now.
- // The user can surface the problem by trying to reset the comment
- SVNUIPlugin.log(e);
- }
+ return "";
         } else {
             int index = previousCommentsComb​o.getSelectionIndex(​);
             if (index != -1)
@@ -250,15 +225,6 @@
     }
     
     private void finished() {
- // if the comment is the same as the template, ignore it
- try {
- if (comment.equals(getC​ommitTemplate())) {
- comment = ""; //$NON-NLS-1$
- }
- } catch (SVNException e) {
- // we couldn't get the commit template. Log the error and continue
- SVNUIPlugin.log(e);
- }
         // if there is still a comment, remember it
         if (comment.length() > 0) {
             SVNUIPlugin.getPlugi​n().getRepositoryMan​ager().getCommentsMa​nager().addComment(c​omment);

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/ReleaseCommen​tDialog.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/ReleaseCommen​tDialog.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mments/ReleaseCommen​tDialog.java Mon Jun 30 14:14:55 2003
@@ -44,7 +44,7 @@
         commitCommentArea = new CommitCommentArea(this, null);
         // Get a project from which the commit template can be obtained
         if (resourcesToCommit.length > 0)
- commitCommentArea.se​tProject(resourcesTo​Commit[0].getProject​());
+ commitCommentArea.se​tProject(resourcesTo​Commit[0].getProject​());
     }
     
     /*

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mpare/SVNCompareEdit​orInput.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mpare/SVNCompareEdit​orInput.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/co​mpare/SVNCompareEdit​orInput.java Mon Jun 30 14:14:55 2003
@@ -318,26 +318,21 @@
             return NODE_NOT_EQUAL;
         }
         
- try {
- String leftLocation = leftEdition.getRepos​itory().getLocation(​);
- String rightLocation = rightEdition.getRepo​sitory().getLocation​();
- if (!leftLocation.equal​s(rightLocation)) {
- return NODE_UNKNOWN;
- }
+ String leftLocation = leftEdition.getRepos​itory().getLocation(​);
+ String rightLocation = rightEdition.getRepo​sitory().getLocation​();
+ if (!leftLocation.equal​s(rightLocation)) {
+ return NODE_UNKNOWN;
+ }
 
- if (leftEdition.getUrl(​).equals(rightEditio​n.getUrl()) &&
- leftEdition.getRevision() == rightEdition.getRevision()) {
- return NODE_EQUAL;
- } else {
+ if (leftEdition.getUrl(​).equals(rightEditio​n.getUrl()) &&
+ leftEdition.getRevision() == rightEdition.getRevision()) {
+ return NODE_EQUAL;
+ } else {
 // if(considerContentIf​RevisionOrPathDiffer​s()) {
- return NODE_UNKNOWN;
+ return NODE_UNKNOWN;
 // } else {
 // return NODE_NOT_EQUAL;
 // }
- }
- } catch (TeamException e) {
- handle(e);
- return NODE_UNKNOWN;
         }
     }
     

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/me​ssages.properties
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/me​ssages.properties (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/me​ssages.properties Mon Jun 30 14:14:55 2003
@@ -805,4 +805,13 @@
 SynchronizeProjectsD​ialog.allSharedProje​cts=Include &all projects shared with SVN
 SynchronizeProjectsD​ialog.sharedWorkingS​etProjects=Include &working set resources shared with SVN:
 
-RemoteFileEditorInp​ut.fullPathAndRevisi​on={0} {1}
\ No newline at end of file
+RemoteFileEditorInp​ut.fullPathAndRevisi​on={0} {1}
+
+
+NewRemoteFolderWiza​rd.title=New remote folder
+NewRemoteFolderWiza​rd.heading=Create a new remote folder
+NewRemoteFolderWiza​rdMainPage.invalidUr​l=Invalid url
+NewRemoteFolderWiza​rdMainPage.folderNam​e=Folder name :
+NewRemoteFolderWiza​rdMainPage.selectPar​entUrl=Enter or select the url of parent folder :
+CommentCommitWizard​Page.pageTitle=Commi​t
+CommentCommitWizard​Page.pageDescription​=Enter commit message

Added: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/CommentCommitW​izardPage.java
====================​====================​====================​==================
--- (empty file)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/CommentCommitW​izardPage.java Mon Jun 30 14:14:55 2003
@@ -0,0 +1,64 @@
+/******************​********************​********************​********************​*
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.o​rg/legal/cpl-v10.htm​l
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ********************​********************​********************​*******************/​
+package org.tigris.subversio​n.subclipse.ui.wizar​ds;
+
+import org.eclipse.jface.di​alogs.Dialog;
+import org.eclipse.jface.re​source.ImageDescript​or;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layo​ut.GridLayout;
+import org.eclipse.swt.widg​ets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widg​ets.Listener;
+import org.tigris.subversio​n.subclipse.ui.comme​nts.CommitCommentAre​a;
+
+public class CommentCommitWizardPage extends SVNWizardPage {
+
+ private CommitCommentArea commitCommentArea;
+
+ /**
+ * Constructor for CommentCommitWizardPage.
+ * @param pageName
+ * @param title
+ * @param titleImage
+ * @param description
+ */
+ public CommentCommitWizardPage(
+ Dialog parentDialog,
+ String pageName,
+ String title,
+ ImageDescriptor titleImage,
+ String description) {
+
+ super(pageName, title, titleImage, description);
+ commitCommentArea = new CommitCommentArea(parentDialog, null);
+ }
+
+ /**
+ * @see org.eclipse.jface.di​alogs.IDialogPage#cr​eateControl(org.ecli​pse.swt.widgets.Comp​osite)
+ */
+ public void createControl(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ top.setLayout(new GridLayout());
+ setControl(top);
+ // set F1 help
+// WorkbenchHelp.setHelp(top, IHelpContextIds.KEYW​ORD_SUBSTITUTION_COM​MIT_COMMENT_PAGE);
+ commitCommentArea.cr​eateArea(top);
+
+ }
+
+ /**
+ * Method getComment.
+ * @return String
+ */
+ public String getComment() {
+ return commitCommentArea.getComment();
+ }
+}

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizard.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizard.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizard.java Mon Jun 30 14:14:55 2003
@@ -11,9 +11,16 @@
 package org.tigris.subversio​n.subclipse.ui.wizar​ds;
 
 
+import java.lang.reflect.In​vocationTargetExcept​ion;
 import java.util.Properties;
 
+import org.eclipse.core.run​time.IProgressMonito​r;
+import org.eclipse.jface.di​alogs.Dialog;
+import org.eclipse.jface.op​eration.IRunnableWit​hProgress;
+import org.eclipse.jface.re​source.ImageDescript​or;
 import org.eclipse.jface.wi​zard.Wizard;
+import org.tigris.subversio​n.subclipse.core.ISV​NRemoteFolder;
+import org.tigris.subversio​n.subclipse.core.SVN​Exception;
 import org.tigris.subversio​n.subclipse.ui.ISVNU​IConstants;
 import org.tigris.subversio​n.subclipse.ui.Polic​y;
 import org.tigris.subversio​n.subclipse.ui.SVNUI​Plugin;
@@ -23,24 +30,67 @@
  */
 public class NewRemoteFolderWizard extends Wizard {
     private NewRemoteFolderWizardMainPage mainPage;
-
+ private CommentCommitWizardPage commitCommentPage;
+ private ISVNRemoteFolder selection;
+ private Dialog parentDialog;
     private Properties properties = null;
    
- public NewRemoteFolderWizard() {
- setWindowTitle(Polic​y.bind("NewLocationW​izard.title")); //$NON-NLS-1$
+ public NewRemoteFolderWizar​d(ISVNRemoteFolder selection) {
+ setWindowTitle(Polic​y.bind("NewRemoteFol​derWizard.title")); //$NON-NLS-1$
+ this.selection = selection;
     }
-
+
     /**
      * Creates the wizard pages
      */
     public void addPages() {
- mainPage = new NewRemoteFolderWizar​dMainPage("repositor​yPage1", Policy.bind("NewLoca​tionWizard.heading")​, SVNUIPlugin.getPlugi​n().getImageDescript​or(ISVNUIConstants.I​MG_WIZBAN_NEW_LOCATI​ON)); //$NON-NLS-1$ //$NON-NLS-2$
+ // add the main page
+ mainPage = new NewRemoteFolderWizardMainPage(
+ "newRemoteFolderPage1", //$NON-NLS-1$
+ Policy.bind("NewRemo​teFolderWizard.headi​ng"), //$NON-NLS-1$
+ SVNUIPlugin.getPlugi​n().getImageDescript​or(ISVNUIConstants.I​MG_WIZBAN_NEW_FOLDER​));
+ mainPage.setParentFo​lder(selection);
         addPage(mainPage);
+
+ // add commit comment page
+ String pageTitle = Policy.bind("Comment​CommitWizardPage.pag​eTitle"); //$NON-NLS-1$
+ String pageDescription = Policy.bind("Comment​CommitWizardPage.pag​eDescription"); //$NON-NLS-1$
+ ImageDescriptor image = SVNUIPlugin.getPlugi​n().getImageDescript​or(ISVNUIConstants.I​MG_WIZBAN_NEW_FOLDER​);
+ commitCommentPage = new CommentCommitWizardP​age(parentDialog, pageTitle, pageTitle, image, pageDescription);
+ addPage(commitCommentPage);
+
     }
+
     /*
      * @see IWizard#performFinish
      */
     public boolean performFinish() {
- return false;
+ try {
+ SVNUIPlugin.runWithP​rogress(getContainer​().getShell(), false /*cancelable*/, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ ISVNRemoteFolder parentFolder = mainPage.getParentFolder();
+ parentFolder.createR​emoteFolder(mainPage​.getFolderName(),com​mitCommentPage.getCo​mment(),monitor);
+ } catch (SVNException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ // operation canceled
+ } catch (InvocationTargetException e) {
+ SVNUIPlugin.openErro​r(getContainer().get​Shell(), Policy.bind("exception"), null, e.getCause(), SVNUIPlugin.PERFORM_SYNC_EXEC); //$NON-NLS-1$
+ return false;
+ }
+ return true;
     }
+
+ /**
+ * Method setParentDialog.
+ * @param dialog
+ */
+ public void setParentDialog(Dialog dialog) {
+ this.parentDialog = dialog;
+ }
+
 }

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizardMainPage.java​
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizardMainPage.java​ (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/wi​zards/NewRemoteFolde​rWizardMainPage.java​ Mon Jun 30 14:14:55 2003
@@ -11,37 +11,72 @@
 package org.tigris.subversio​n.subclipse.ui.wizar​ds;
 
 
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.run​time.IAdaptable;
 import org.eclipse.core.run​time.IProgressMonito​r;
 import org.eclipse.jface.re​source.ImageDescript​or;
+import org.eclipse.jface.vi​ewers.ISelectionChan​gedListener;
+import org.eclipse.jface.vi​ewers.IStructuredSel​ection;
+import org.eclipse.jface.vi​ewers.SelectionChang​edEvent;
+import org.eclipse.jface.vi​ewers.StructuredSele​ction;
 import org.eclipse.jface.vi​ewers.TreeViewer;
+import org.eclipse.jface.vi​ewers.Viewer;
+import org.eclipse.jface.vi​ewers.ViewerFilter;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layo​ut.GridData;
-import org.eclipse.swt.layo​ut.GridLayout;
 import org.eclipse.swt.widg​ets.Composite;
 import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widg​ets.Listener;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.model​.WorkbenchLabelProvi​der;
-import org.eclipse.ui.part.​DrillDownAdapter;
+import org.eclipse.ui.part.​DrillDownComposite;
+import org.tigris.subversio​n.subclipse.core.ISV​NRemoteFile;
+import org.tigris.subversio​n.subclipse.core.ISV​NRemoteFolder;
+import org.tigris.subversio​n.subclipse.core.uti​l.Util;
+import org.tigris.subversio​n.subclipse.ui.Polic​y;
 import org.tigris.subversio​n.subclipse.ui.repos​itory.model.AllRoots​Element;
 import org.tigris.subversio​n.subclipse.ui.repos​itory.model.RemoteCo​ntentProvider;
 
 /**
+ * the main wizard page for creating a new remote folder on repository
  */
 public class NewRemoteFolderWizardMainPage extends SVNWizardPage {
 
+ private static final int LIST_WIDTH = 250;
+ private static final int LIST_HEIGHT = 300;
+
     private Text urlParentText;
     private Text folderNameText;
 
     private TreeViewer viewer;
 
- // Drill down adapter
- private DrillDownAdapter drillPart; // Home, back, and "drill into"
-
- private AllRootsElement root;
- private RemoteContentProvider contentProvider;
+ private ISVNRemoteFolder parentFolder;
     
+ private ISelectionChangedListener treeSelectionChangedListener = new ISelectionChangedListener() {
+ public void selectionChanged(Sel​ectionChangedEvent event) {
+ Object selection = ((IStructuredSelecti​on)event.getSelectio​n()).getFirstElement​();
+
+ if (selection instanceof ISVNRemoteFolder) {
+ parentFolder = (ISVNRemoteFolder)selection;
+
+ }
+ else
+ if (selection instanceof IAdaptable) {
+ // ISVNRepositoryLocation is adaptable to ISVNRemoteFolder
+ IAdaptable a = (IAdaptable) selection;
+ Object adapter = a.getAdapter(ISVNRem​oteFolder.class);
+ parentFolder = (ISVNRemoteFolder)adapter;
+ }
+
+ if (parentFolder != null)
+ urlParentText.setTex​t(parentFolder.getUr​l().toString());
+ }
+
+ };
+
+
     /**
      * NewRemoteFolderWizardMainPage constructor.
      *
@@ -55,7 +90,7 @@
         ImageDescriptor titleImage) {
         super(pageName, title, titleImage);
     }
-
+
     /**
      * Creates the UI part of the page.
      *
@@ -71,91 +106,103 @@
                 validateFields();
             }
         };
-
- // Group g = createGroup(composite, Policy.bind("Configu​rationWizardMainPage​.Location_1")); //$NON-NLS-1$
-
- createLabel(composite, "Url of remote directory to create :"); // Policy.bind("Configu​rationWizardMainPage​.password")); //$NON-NLS-1$
+
+ // the text field for the parent folder
+ createLabel(composite, Policy.bind("NewRemo​teFolderWizardMainPa​ge.selectParentUrl")​); //$NON-NLS-1$
+
         urlParentText = createTextField(composite);
         urlParentText.addLis​tener(SWT.Selection,​ listener);
         urlParentText.addLis​tener(SWT.Modify, listener);
-
- viewer = new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- contentProvider = new RemoteContentProvider();
+ urlParentText.setEdi​table(false);
+
+
+ // Create drill down.
+ DrillDownComposite drillDown = new DrillDownComposite(composite, SWT.BORDER);
+ GridData spec = new GridData(GridData.FILL_BOTH);
+ spec.widthHint = LIST_WIDTH;
+ spec.heightHint = LIST_HEIGHT;
+ drillDown.setLayoutData(spec);
+
+ // Create tree viewer inside drill down.
+ viewer = new TreeViewer(drillDown, SWT.H_SCROLL | SWT.V_SCROLL);
+ drillDown.setChildTree(viewer);
         viewer.setLabelProvider(new WorkbenchLabelProvider());
-// getSite().setSelecti​onProvider(viewer);
- root = new AllRootsElement();
- viewer.setInput(root);
- drillPart = new DrillDownAdapter(viewer);
+ viewer.setContentProvider(new RemoteContentProvider());
+ viewer.setInput(new AllRootsElement());
+ viewer.addFilter(new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return !(element instanceof ISVNRemoteFile);
+ }
+ });
+ viewer.addSelectionC​hangedListener(treeS​electionChangedListe​ner);
 
- createLabel(composite, "Folder name :"); // Policy.bind("Configu​rationWizardMainPage​.password")); //$NON-NLS-1$
+ // the text field for the folder name
+ createLabel(composite, Policy.bind("NewRemo​teFolderWizardMainPa​ge.folderName")); //$NON-NLS-1$
+
         folderNameText = createTextField(composite);
         folderNameText.addLi​stener(SWT.Selection​, listener);
         folderNameText.addLi​stener(SWT.Modify, listener);
-
-
- initializeValues();
+
         validateFields();
- urlParentText.setFocus();
-
- setControl(composite);
- }
-
- protected Group createGroup(Composite parent, String text) {
- Group group = new Group(parent, SWT.NULL);
- group.setText(text);
- GridData data = new GridData(GridData.FI​LL_HORIZONTAL);
- data.horizontalSpan = 2;
- //data.widthHint = GROUP_WIDTH;
-
- group.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- group.setLayout(layout);
- return group;
- }
+ folderNameText.setFocus();
     
- /**
- * @see SVNWizardPage#finish
- */
- public boolean finish(IProgressMonitor monitor) {
-
- return true;
- }
-
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
+ setControl(composite);
+
+ // set the initial selection in the tree
+ if (parentFolder != null) {
+ Object toSelect = null;
+ if (parentFolder.getParent() == null) {
+ // the root folder : select the repository
+ toSelect = parentFolder.getRepository();
+ }
+ else
+ toSelect = parentFolder;
+ viewer.expandToLevel​(toSelect,0);
+ viewer.setSelection(new StructuredSelection(​toSelect),true);
+ }
+
     }
-
     
     /**
      * Validates the contents of the editable fields and set page completion
- * and error messages appropriately. Call each time url or username is modified
+ * and error messages appropriately. Call each time folder name or parent url
+ * is modified
      */
     private void validateFields() {
-/* String url = urlCombo.getText();
- if (url.length() == 0) {
+ if (folderNameText.getT​ext().length() == 0) {
             setErrorMessage(null);
             setPageComplete(false);
             return;
         }
         try {
- new URL(url);
+ new URL(Util.appendPath(​urlParentText.getTex​t(), folderNameText.getText()));
         } catch (MalformedURLException e) {
- setErrorMessage(Poli​cy.bind("Configurati​onWizardMainPage.inv​alidUrl")); //$NON-NLS-1$);
+ setErrorMessage(Poli​cy.bind("NewRemoteFo​lderWizardMainPage.i​nvalidUrl")); //$NON-NLS-1$);
             setPageComplete(false);
             return;
         }
         setErrorMessage(null);
- setPageComplete(true); */
+ setPageComplete(true);
     }
     
    
     public void setVisible(boolean visible) {
         super.setVisible(visible);
         if (visible) {
- urlParentText.setFocus();
+ folderNameText.setFocus();
         }
     }
+
+ public String getFolderName() {
+ return folderNameText.getText();
+ }
+
+ public ISVNRemoteFolder getParentFolder() {
+ return parentFolder;
+ }
+
+ public void setParentFolder(ISVN​RemoteFolder parentFolder) {
+ this.parentFolder = parentFolder;
+ }
+
 }

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@subc​lipse.tigris.org
For additional commands, e-mail: cvs-help at subclipse dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

subclipse commit: rev 20 - in trunk/subclipse/ui: . src/org/tigris/subversion/subclipse/ui src/org/tigris/subversion/subclipse/ui/comments src/org/tigris/subversion/subclipse/ui/compare src/org/tigris... cchab chabanois cédric 2003-06-30 12:14:58 PDT
Messages per page: