Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > subclipse commit: r1311 - in branches/subclipse-3/ui/src/org/tigris/subversion/subclipse/ui: . util

subclipse
Discussion topic

Back to topic list

subclipse commit: r1311 - in branches/subclipse-3/ui/src/org/tigris/subversion/subclipse/ui: . util

Author pkorros
Full name Panagiotis Korros
Date 2005-04-06 13:58:56 PDT
Message Author: pkorros
Date: Wed Apr 6 15:58:56 2005
New Revision: 1311

Added:
   branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/util/SimpleDialog​sHelper.java
Modified:
   branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/SVNUIPlugin.java
Log:
UI part for issue 261. Added support for auto adding imported projects if they
reside in a working copy (Eclipse 3.1).

By Magnus Naeslund
Issue #: 261


Modified: branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/SVNUIPlugin.java
Url: http://svn.collab.ne​t/viewcvs/subclipse/​branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/SVNUIPlugin.java?​view=diff&rev=13​11&p1=branches/s​ubclipse-3/ui/src/or​g/tigris/subversion/​subclipse/ui/SVNUIPl​ugin.java&r1=131​0&p2=branches/su​bclipse-3/ui/src/org​/tigris/subversion/s​ubclipse/ui/SVNUIPlu​gin.java&r2=1311​
====================​====================​====================​==================
--- branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/SVNUIPlugin.java (original)
+++ branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/SVNUIPlugin.java Wed Apr 6 15:58:56 2005
@@ -41,6 +41,7 @@
 import org.tigris.subversio​n.subclipse.ui.conso​le.SVNOutputConsole;​
 import org.tigris.subversio​n.subclipse.ui.repos​itory.RepositoryMana​ger;
 import org.tigris.subversio​n.subclipse.ui.repos​itory.model.SVNAdapt​erFactory;
+import org.tigris.subversio​n.subclipse.ui.util.​SimpleDialogsHelper;​
 /**
  * UI Plugin for Subversion provider-specific workbench functionality.
  */
@@ -390,6 +391,8 @@
         
         console = new SVNOutputConsole();
         SVNProviderPlugin.ge​tPlugin().setSvnProm​ptUserPassword(new SVNPromptUserPassword());
+ SVNProviderPlugin.ge​tPlugin().setSimpleD​ialogsHelper(new SimpleDialogsHelper());
+
     }
     
     /**

Added: branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/util/SimpleDialog​sHelper.java
Url: http://svn.collab.ne​t/viewcvs/subclipse/​branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/util/SimpleDialog​sHelper.java?view=au​to&rev=1311
====================​====================​====================​==================
--- (empty file)
+++ branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/util/SimpleDialog​sHelper.java Wed Apr 6 15:58:56 2005
@@ -0,0 +1,100 @@
+package org.tigris.subversio​n.subclipse.ui.util;​
+
+import org.eclipse.jface.di​alogs.IDialogConstan​ts;
+import org.eclipse.jface.di​alogs.MessageDialog;​
+import org.eclipse.swt.widg​ets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tigris.subversio​n.subclipse.core.uti​l.ISimpleDialogsHelp​er;
+import org.tigris.subversio​n.subclipse.ui.SVNUI​Plugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * This class is a dialog helper class for the core package.
+ * It's made availabe for core thru SVNProviderPlugin.ge​tSimpleDialogsHelper​().
+ * New simple dialogs should be added here so the minimum of glue is needed for
+ * every new dialog. Remember to update the ISimpleDialogsHelper interface.
+ *
+ * @author Magnus Naeslund (mag at kite dot se)
+ * @see org.tigris.subversio​n.subclipse.core.uti​l.ISimpleDialogsHelp​er
+ * @see org.tigris.subversio​n.subclipse.core.SVN​ProviderPlugin#getSi​mpleDialogsHelper()
+ */
+
+public class SimpleDialogsHelper implements ISimpleDialogsHelper {
+
+ public boolean promptYesNo(String title, String question, boolean yesIsDefault) {
+ MessageDialogRunnable mdr = new MessageDialogRunnable(
+ null,
+ title,
+ null,
+ question,
+ MessageDialog.QUESTION,
+ new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
+ yesIsDefault ? 0 : 1);
+ SVNUIPlugin.getStand​ardDisplay().syncExe​c(mdr);
+ return mdr.getResult() == 0;
+ }
+
+ public boolean promptYesCancel(String title, String question, boolean yesIsDefault) {
+ MessageDialogRunnable mdr = new MessageDialogRunnable(
+ null,
+ title,
+ null,
+ question,
+ MessageDialog.QUESTION,
+ new String[] {IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL},
+ yesIsDefault ? 0 : 1);
+ SVNUIPlugin.getStand​ardDisplay().syncExe​c(mdr);
+ return mdr.getResult() == 0;
+ }
+
+ /**
+ *
+ * This should be reused for all MessageDialog type of dialogs.
+ *
+ * @author mag
+ *
+ */
+
+ private static class MessageDialogRunnable implements Runnable {
+ final Shell shell;
+ final String title, message;
+ final Image image;
+ final int imageType, defaultButton;
+ final String buttonLabels[];
+ int result;
+
+ /**
+ *
+ * @param shell if null, it's Display.getCurrent()​.getActiveShell()
+ * @param title
+ * @param image can be null
+ * @param message
+ * @param imageType
+ * @param buttonLabels
+ * @param defaultButton
+ */
+
+ MessageDialogRunnable(Shell shell, String title, Image image, String message, int imageType, String buttonLabels[], int defaultButton){
+ this.shell = shell;
+ this.title = title;
+ this.image = image;
+ this.message = message;
+ this.imageType = imageType;
+ this.buttonLabels = buttonLabels;
+ this.defaultButton = defaultButton;
+ }
+
+ public void run() {
+ result = new MessageDialog(
+ shell != null ? shell : Display.getCurrent()​.getActiveShell(),
+ title, image, message, imageType,
+ buttonLabels, defaultButton).open();
+ }
+
+ public int getResult(){
+ return result;
+ }
+ }
+
+}

--------------------​--------------------​--------------------​---------
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: r1311 - in branches/subclipse-3/ui/src/org/tigris/subversion/subclipse/ui: . util pkorros Panagiotis Korros 2005-04-06 13:58:56 PDT
Messages per page: