Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 865a0214f67c82889d9a44715117fb67161fcd93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*******************************************************************************
 * Copyright (c) 2008-2010 Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *      Sonatype, Inc. - initial API and implementation
 *******************************************************************************/

package org.eclipse.m2e.scm.spi;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.m2e.scm.ScmUrl;
import org.eclipse.swt.widgets.Shell;

/**
 * An SCM handler UI base class
 *
 * @author Eugene Kuleshov
 */
public abstract class ScmHandlerUi implements IExecutableExtension {
  public static final String ATTR_TYPE = "type"; //$NON-NLS-1$
  public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
  
  private String type;
  
  public String getType() {
    return type;
  }

  /**
   * Show revision/tag browser dialog and allow user to select revision/tag
   * 
   * @param shell the shell for revison/tag browser dialog
   * @param scmUrl the current <code>ScmUrl</code>, or null if none
   * @param scmRevision the current revision, or null if none
   * @return String selected revision
   */
  public String selectRevision(Shell shell, ScmUrl scmUrl, String scmRevision) {
    return null;
  }

  /**
   * Show repository browser dialog and allow user to select location
   * 
   * @param shell the shell for repository browser dialog
   * @param scmUrl the current <code>ScmUrl</code>, or null if none
   * @return ScmUrl for selected location or null if dialog was canceled
   */
  public ScmUrl selectUrl(Shell shell, ScmUrl scmUrl) {
    return null;
  }
  
  public boolean isValidUrl(String scmUrl) {
    return false;
  }
  
  public boolean isValidRevision(ScmUrl scmUrl, String scmRevision) {
    return false;
  }

  public boolean canSelectUrl() {
    return false;
  }

  public boolean canSelectRevision() {
    return false;
  }

  
  // IExecutableExtension  
  
  public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
    this.type = config.getAttribute(ATTR_TYPE);
  }
  
}

Back to the top