This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 221525
Collapse All | Expand All

(-)a/git/src/org/netbeans/modules/git/Annotator.java (-3 / +19 lines)
Lines 63-68 Link Here
63
import org.netbeans.libs.git.GitTag;
63
import org.netbeans.libs.git.GitTag;
64
import org.netbeans.modules.git.FileInformation.Status;
64
import org.netbeans.modules.git.FileInformation.Status;
65
import org.netbeans.modules.git.ui.actions.AddAction;
65
import org.netbeans.modules.git.ui.actions.AddAction;
66
import org.netbeans.modules.git.ui.actions.ConnectAction;
67
import org.netbeans.modules.git.ui.actions.DisconnectAction;
66
import org.netbeans.modules.git.ui.blame.AnnotateAction;
68
import org.netbeans.modules.git.ui.blame.AnnotateAction;
67
import org.netbeans.modules.git.ui.commit.CommitAction;
69
import org.netbeans.modules.git.ui.commit.CommitAction;
68
import org.netbeans.modules.git.ui.commit.ExcludeFromCommitAction;
70
import org.netbeans.modules.git.ui.commit.ExcludeFromCommitAction;
Lines 135-143 Link Here
135
        if (destination.equals(ActionDestination.MainMenu)) {
137
        if (destination.equals(ActionDestination.MainMenu)) {
136
            if (noneVersioned) {
138
            if (noneVersioned) {
137
                addAction("org-netbeans-modules-git-ui-clone-CloneAction", context, actions, true);
139
                addAction("org-netbeans-modules-git-ui-clone-CloneAction", context, actions, true);
138
                addAction("org-netbeans-modules-git-ui-init-InitAction", context, actions, true);
140
                ConnectAction connectAction = SystemAction.get(ConnectAction.class);
141
                if (!connectAction.isEnabled()) {
142
                    addAction("org-netbeans-modules-git-ui-init-InitAction", context, actions, true);
143
                }
139
                actions.add(null);
144
                actions.add(null);
140
                actions.add(SystemAction.get(RepositoryBrowserAction.class));
145
                actions.add(SystemAction.get(RepositoryBrowserAction.class));
146
                if (connectAction.isEnabled()) {
147
                    actions.add(connectAction);
148
                }
141
            } else {            
149
            } else {            
142
                actions.add(SystemAction.get(StatusAction.class));
150
                actions.add(SystemAction.get(StatusAction.class));
143
                actions.add(SystemAction.get(AddAction.class));
151
                actions.add(SystemAction.get(AddAction.class));
Lines 164-171 Link Here
164
                    }
172
                    }
165
                }
173
                }
166
                actions.add(null);
174
                actions.add(null);
167
                actions.add(SystemAction.get(RepositoryBrowserAction.class));
168
                actions.add(null);
169
                actions.add(new BranchMenu(ActionDestination.MainMenu, null));
175
                actions.add(new BranchMenu(ActionDestination.MainMenu, null));
170
                actions.add(new TagMenu(ActionDestination.MainMenu, null));
176
                actions.add(new TagMenu(ActionDestination.MainMenu, null));
171
                actions.add(new CheckoutMenu(ActionDestination.MainMenu, null));
177
                actions.add(new CheckoutMenu(ActionDestination.MainMenu, null));
Lines 182-187 Link Here
182
                actions.add(new RemoteMenu(ActionDestination.MainMenu, null));
188
                actions.add(new RemoteMenu(ActionDestination.MainMenu, null));
183
                actions.add(SystemAction.get(SearchHistoryAction.class));
189
                actions.add(SystemAction.get(SearchHistoryAction.class));
184
                actions.add(SystemAction.get(AnnotateAction.class));
190
                actions.add(SystemAction.get(AnnotateAction.class));
191
                actions.add(null);
192
                actions.add(SystemAction.get(RepositoryBrowserAction.class));
193
                ConnectAction connectAction = SystemAction.get(ConnectAction.class);
194
                if (connectAction.isEnabled()) {
195
                    actions.add(connectAction);
196
                }
197
            }
198
            DisconnectAction disconnectAction = SystemAction.get(DisconnectAction.class);
199
            if (disconnectAction.isEnabled()) {
200
                actions.add(disconnectAction);
185
            }
201
            }
186
            Utils.setAcceleratorBindings(ACTIONS_PATH_PREFIX, actions.toArray(new Action[actions.size()]));
202
            Utils.setAcceleratorBindings(ACTIONS_PATH_PREFIX, actions.toArray(new Action[actions.size()]));
187
        } else {
203
        } else {
(-)a/git/src/org/netbeans/modules/git/Bundle.properties (-1 / +1 lines)
Lines 87-90 Link Here
87
the IDE had to disable all third-party Git version control plugins.</html>
87
the IDE had to disable all third-party Git version control plugins.</html>
88
88
89
LBL_LookingUp=Looking up moved file...
89
LBL_LookingUp=Looking up moved file...
90
LBL_LookingUpAtRevision=Looking up moved file {0} at revision {1}
90
LBL_LookingUpAtRevision=Looking up moved file {0} at revision {1}
(-)a/git/src/org/netbeans/modules/git/Git.java (-1 / +24 lines)
Lines 61-77 Link Here
61
import org.netbeans.libs.git.GitException;
61
import org.netbeans.libs.git.GitException;
62
import org.netbeans.modules.git.client.CredentialsCallback;
62
import org.netbeans.modules.git.client.CredentialsCallback;
63
import org.netbeans.modules.git.client.GitClient;
63
import org.netbeans.modules.git.client.GitClient;
64
import org.netbeans.modules.git.ui.actions.ConnectAction;
65
import org.netbeans.modules.git.ui.actions.DisconnectAction;
64
import org.netbeans.modules.git.ui.shelve.ShelveChangesAction;
66
import org.netbeans.modules.git.ui.shelve.ShelveChangesAction;
65
import org.netbeans.modules.git.utils.GitUtils;
67
import org.netbeans.modules.git.utils.GitUtils;
66
import org.netbeans.modules.versioning.shelve.ShelveChangesActionsRegistry;
68
import org.netbeans.modules.versioning.shelve.ShelveChangesActionsRegistry;
67
import org.netbeans.modules.versioning.spi.VCSAnnotator;
69
import org.netbeans.modules.versioning.spi.VCSAnnotator;
68
import org.netbeans.modules.versioning.spi.VersioningSupport;
70
import org.netbeans.modules.versioning.spi.VersioningSupport;
71
import org.netbeans.modules.versioning.util.DisconnectedRepositoriesManager;
69
import org.netbeans.modules.versioning.util.RootsToFile;
72
import org.netbeans.modules.versioning.util.RootsToFile;
70
import org.netbeans.modules.versioning.util.Utils;
73
import org.netbeans.modules.versioning.util.Utils;
71
import org.netbeans.modules.versioning.util.VCSHyperlinkProvider;
74
import org.netbeans.modules.versioning.util.VCSHyperlinkProvider;
72
import org.openide.util.Lookup;
75
import org.openide.util.Lookup;
73
import org.openide.util.Lookup.Result;
76
import org.openide.util.Lookup.Result;
74
import org.openide.util.RequestProcessor;
77
import org.openide.util.RequestProcessor;
78
import org.openide.util.actions.SystemAction;
75
79
76
/**
80
/**
77
 *
81
 *
Lines 139-144 Link Here
139
            @Override
143
            @Override
140
            public void run () {
144
            public void run () {
141
                ShelveChangesActionsRegistry.getInstance().registerAction(gitVCS, ShelveChangesAction.getProvider());
145
                ShelveChangesActionsRegistry.getInstance().registerAction(gitVCS, ShelveChangesAction.getProvider());
146
                DisconnectedRepositoriesManager.getInstance().addPropertyChangeListener(SystemAction.get(ConnectAction.class));
147
                DisconnectedRepositoriesManager.getInstance().addPropertyChangeListener(SystemAction.get(DisconnectAction.class));
142
            }
148
            }
143
        });
149
        });
144
    }
150
    }
Lines 306-312 Link Here
306
        File parent = getKnownParent(file);
312
        File parent = getKnownParent(file);
307
        if(parent != null) {
313
        if(parent != null) {
308
            LOG.log(Level.FINE, "  getTopmostManagedParent returning known parent {0}", parent);
314
            LOG.log(Level.FINE, "  getTopmostManagedParent returning known parent {0}", parent);
309
            return parent;
315
            if (DisconnectedRepositoriesManager.getInstance().isDisconnected(Git.class.getName(), parent.getAbsolutePath())) {
316
                return null;
317
            } else {
318
                return parent;
319
            }
310
        }
320
        }
311
321
312
        if (GitUtils.isPartOfGitMetadata(file)) {
322
        if (GitUtils.isPartOfGitMetadata(file)) {
Lines 329-334 Link Here
329
                LOG.log(Level.FINE, " found managed parent {0}", new Object[] { file });
339
                LOG.log(Level.FINE, " found managed parent {0}", new Object[] { file });
330
                done.clear();   // all folders added before must be removed, they ARE in fact managed by git
340
                done.clear();   // all folders added before must be removed, they ARE in fact managed by git
331
                topmost =  file;
341
                topmost =  file;
342
                addRepository(topmost);
332
                if (topmost.getParentFile() == null) {
343
                if (topmost.getParentFile() == null) {
333
                    LOG.log(Level.WARNING, "found managed root folder {0}", file); //NOI18N
344
                    LOG.log(Level.WARNING, "found managed root folder {0}", file); //NOI18N
334
                }
345
                }
Lines 348-353 Link Here
348
        }
359
        }
349
        if(topmost != null) {
360
        if(topmost != null) {
350
            knownRoots.add(topmost);
361
            knownRoots.add(topmost);
362
            if (DisconnectedRepositoriesManager.getInstance().isDisconnected(Git.class.getName(), topmost.getAbsolutePath())) {
363
                topmost = null;
364
            }
351
        }
365
        }
352
366
353
        return topmost;
367
        return topmost;
Lines 396-399 Link Here
396
        }
410
        }
397
        return historyProvider;
411
        return historyProvider;
398
    }
412
    }
413
414
    private void addRepository (final File repository) {
415
        getRequestProcessor().post(new Runnable() {
416
            @Override
417
            public void run () {
418
                GitRepositories.getInstance().add(repository);
419
            }
420
        });
421
    }
399
}
422
}
(-)a/git/src/org/netbeans/modules/git/GitRepositories.java (+3 lines)
Lines 66-71 Link Here
66
        return instance;
66
        return instance;
67
    }
67
    }
68
68
69
    private GitRepositories () {
70
    }
71
69
    void add (File repository) {
72
    void add (File repository) {
70
        boolean added;
73
        boolean added;
71
        if (Utils.isAncestorOrEqual(new File(System.getProperty("java.io.tmpdir")), repository)) { //NOI18N
74
        if (Utils.isAncestorOrEqual(new File(System.getProperty("java.io.tmpdir")), repository)) { //NOI18N
(-)a/git/src/org/netbeans/modules/git/options/Bundle.properties (+1 lines)
Lines 54-56 Link Here
54
#Files ignored by NetBeans (as dist or build folder) will be automatically ignored in .gitignore file
54
#Files ignored by NetBeans (as dist or build folder) will be automatically ignored in .gitignore file
55
GitOptionsPanel.cbIgnoreNotSharableFiles.text=Permanently i&gnore non-sharable folders
55
GitOptionsPanel.cbIgnoreNotSharableFiles.text=Permanently i&gnore non-sharable folders
56
KW_Colors=colors
56
KW_Colors=colors
57
GitOptionsPanel.jLabel1.text=Disconnected Repositories
(-)a/git/src/org/netbeans/modules/git/options/GitOptionsPanel.form (-6 / +85 lines)
Lines 17-32 Link Here
17
    <DimensionLayout dim="0">
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
20
              <EmptySpace min="-2" max="-2" attributes="0"/>
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="0" attributes="0">
21
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Component id="signOffCheckBox" max="32767" attributes="0"/>
22
                  <Group type="102" attributes="0">
23
                      <Component id="jPanel1" max="32767" attributes="0"/>
24
                      <EmptySpace max="-2" attributes="0"/>
25
                  </Group>
26
                  <Component id="signOffCheckBox" pref="410" max="32767" attributes="0"/>
23
                  <Group type="102" attributes="0">
27
                  <Group type="102" attributes="0">
24
                      <Group type="103" groupAlignment="0" attributes="0">
28
                      <Group type="103" groupAlignment="0" attributes="0">
25
                          <Component id="excludeNewFiles" alignment="0" min="-2" max="-2" attributes="0"/>
29
                          <Group type="102" alignment="0" attributes="0">
26
                          <Component id="cbOpenOutputWindow" alignment="0" min="-2" max="-2" attributes="0"/>
30
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
27
                          <Component id="cbIgnoreNotSharableFiles" alignment="0" min="-2" max="-2" attributes="0"/>
31
                              <EmptySpace max="-2" attributes="0"/>
32
                              <Component id="jSeparator1" max="32767" attributes="0"/>
33
                          </Group>
34
                          <Group type="102" attributes="0">
35
                              <Group type="103" groupAlignment="0" attributes="0">
36
                                  <Component id="excludeNewFiles" alignment="0" min="-2" max="-2" attributes="0"/>
37
                                  <Component id="cbOpenOutputWindow" alignment="0" min="-2" max="-2" attributes="0"/>
38
                                  <Component id="cbIgnoreNotSharableFiles" alignment="0" min="-2" max="-2" attributes="0"/>
39
                              </Group>
40
                              <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
41
                          </Group>
28
                      </Group>
42
                      </Group>
29
                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
43
                      <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
30
                  </Group>
44
                  </Group>
31
              </Group>
45
              </Group>
32
          </Group>
46
          </Group>
Lines 43-48 Link Here
43
              <Component id="signOffCheckBox" min="-2" max="-2" attributes="0"/>
57
              <Component id="signOffCheckBox" min="-2" max="-2" attributes="0"/>
44
              <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
58
              <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
45
              <Component id="cbIgnoreNotSharableFiles" min="-2" max="-2" attributes="0"/>
59
              <Component id="cbIgnoreNotSharableFiles" min="-2" max="-2" attributes="0"/>
60
              <Group type="103" groupAlignment="0" attributes="0">
61
                  <Group type="102" attributes="0">
62
                      <EmptySpace type="separate" max="-2" attributes="0"/>
63
                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
64
                  </Group>
65
                  <Group type="102" alignment="1" attributes="0">
66
                      <EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
67
                      <Component id="jSeparator1" min="-2" pref="2" max="-2" attributes="0"/>
68
                  </Group>
69
              </Group>
70
              <EmptySpace max="-2" attributes="0"/>
71
              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
46
              <EmptySpace max="32767" attributes="0"/>
72
              <EmptySpace max="32767" attributes="0"/>
47
          </Group>
73
          </Group>
48
      </Group>
74
      </Group>
Lines 88-93 Link Here
88
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
114
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
89
          <ResourceString bundle="org/netbeans/modules/git/options/Bundle.properties" key="GitOptionsPanel.signOffCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
115
          <ResourceString bundle="org/netbeans/modules/git/options/Bundle.properties" key="GitOptionsPanel.signOffCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
90
        </Property>
116
        </Property>
117
        <Property name="verticalTextPosition" type="int" value="1"/>
91
      </Properties>
118
      </Properties>
92
      <AuxValues>
119
      <AuxValues>
93
        <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
120
        <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
Lines 103-107 Link Here
103
        </Property>
130
        </Property>
104
      </Properties>
131
      </Properties>
105
    </Component>
132
    </Component>
133
    <Component class="javax.swing.JLabel" name="jLabel1">
134
      <Properties>
135
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
136
          <ResourceString bundle="org/netbeans/modules/git/options/Bundle.properties" key="GitOptionsPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
137
        </Property>
138
      </Properties>
139
    </Component>
140
    <Component class="javax.swing.JSeparator" name="jSeparator1">
141
    </Component>
142
    <Container class="javax.swing.JPanel" name="jPanel1">
143
      <AuxValues>
144
        <AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="GitOptionsPanel_jPanel1"/>
145
      </AuxValues>
146
147
      <Layout>
148
        <DimensionLayout dim="0">
149
          <Group type="103" groupAlignment="0" attributes="0">
150
              <Group type="102" alignment="0" attributes="0">
151
                  <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
152
                  <Component id="jPanel2" max="32767" attributes="0"/>
153
                  <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
154
              </Group>
155
          </Group>
156
        </DimensionLayout>
157
        <DimensionLayout dim="1">
158
          <Group type="103" groupAlignment="0" attributes="0">
159
              <Group type="102" alignment="0" attributes="0">
160
                  <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
161
                  <Component id="jPanel2" max="32767" attributes="0"/>
162
                  <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
163
              </Group>
164
          </Group>
165
        </DimensionLayout>
166
      </Layout>
167
      <SubComponents>
168
        <Container class="javax.swing.JPanel" name="jPanel2">
169
170
          <Layout>
171
            <DimensionLayout dim="0">
172
              <Group type="103" groupAlignment="0" attributes="0">
173
                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
174
              </Group>
175
            </DimensionLayout>
176
            <DimensionLayout dim="1">
177
              <Group type="103" groupAlignment="0" attributes="0">
178
                  <EmptySpace min="0" pref="100" max="32767" attributes="0"/>
179
              </Group>
180
            </DimensionLayout>
181
          </Layout>
182
        </Container>
183
      </SubComponents>
184
    </Container>
106
  </SubComponents>
185
  </SubComponents>
107
</Form>
186
</Form>
(-)a/git/src/org/netbeans/modules/git/options/GitOptionsPanel.java (-8 / +74 lines)
Lines 48-66 Link Here
48
import java.util.Arrays;
48
import java.util.Arrays;
49
import java.util.Collection;
49
import java.util.Collection;
50
import java.util.Collections;
50
import java.util.Collections;
51
import javax.swing.GroupLayout;
51
import org.netbeans.api.options.OptionsDisplayer;
52
import org.netbeans.api.options.OptionsDisplayer;
52
import org.netbeans.modules.git.GitModuleConfig;
53
import org.netbeans.modules.git.GitModuleConfig;
54
import org.netbeans.modules.git.GitVCS;
55
import org.netbeans.modules.versioning.util.DisconnectedRepositoriesManager;
53
import org.netbeans.spi.options.OptionsPanelController;
56
import org.netbeans.spi.options.OptionsPanelController;
54
import org.openide.util.NbBundle;
57
import org.openide.util.NbBundle;
55
58
56
@OptionsPanelController.Keywords(keywords={"git", "#GitOptionsPanel.kw1", "#GitOptionsPanel.kw2", "#GitOptionsPanel.kw3", "#GitOptionsPanel.kw4"},
59
@OptionsPanelController.Keywords(keywords={"git", "#GitOptionsPanel.kw1",
60
    "#GitOptionsPanel.kw2", "#GitOptionsPanel.kw3", "#GitOptionsPanel.kw4",
61
    "#GitOptionsPanel.kw5"},
57
        location=OptionsDisplayer.ADVANCED, tabTitle="#CTL_OptionsPanel.title")
62
        location=OptionsDisplayer.ADVANCED, tabTitle="#CTL_OptionsPanel.title")
58
@NbBundle.Messages({
63
@NbBundle.Messages({
59
    "CTL_OptionsPanel.title=Versioning",
64
    "CTL_OptionsPanel.title=Versioning",
60
    "GitOptionsPanel.kw1=versioning",
65
    "GitOptionsPanel.kw1=versioning",
61
    "GitOptionsPanel.kw2=exclude new files from commit",
66
    "GitOptionsPanel.kw2=exclude new files from commit",
62
    "GitOptionsPanel.kw3=signed-off-by line",
67
    "GitOptionsPanel.kw3=signed-off-by line",
63
    "GitOptionsPanel.kw4=non-sharable folders"
68
    "GitOptionsPanel.kw4=non-sharable folders",
69
    "GitOptionsPanel.kw5=disconnected repositories"
64
})
70
})
65
final class GitOptionsPanel extends javax.swing.JPanel {
71
final class GitOptionsPanel extends javax.swing.JPanel {
66
    
72
    
Lines 68-74 Link Here
68
    private String[] keywords;
74
    private String[] keywords;
69
    
75
    
70
    GitOptionsPanel(GitOptionsPanelController controller) {
76
    GitOptionsPanel(GitOptionsPanelController controller) {
71
        this.controller = controller;        
77
        this.controller = controller;
72
        initComponents();
78
        initComponents();
73
    }
79
    }
74
    
80
    
Lines 106-111 Link Here
106
        cbOpenOutputWindow = new javax.swing.JCheckBox();
112
        cbOpenOutputWindow = new javax.swing.JCheckBox();
107
        excludeNewFiles = new javax.swing.JCheckBox();
113
        excludeNewFiles = new javax.swing.JCheckBox();
108
        cbIgnoreNotSharableFiles = new javax.swing.JCheckBox();
114
        cbIgnoreNotSharableFiles = new javax.swing.JCheckBox();
115
        jLabel1 = new javax.swing.JLabel();
116
        jSeparator1 = new javax.swing.JSeparator();
117
        jPanel1 = new javax.swing.JPanel();
118
        jPanel2 = new javax.swing.JPanel();
109
119
110
        cbOpenOutputWindow.setSelected(true);
120
        cbOpenOutputWindow.setSelected(true);
111
        org.openide.awt.Mnemonics.setLocalizedText(cbOpenOutputWindow, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.cbOpenOutputWindow.text")); // NOI18N
121
        org.openide.awt.Mnemonics.setLocalizedText(cbOpenOutputWindow, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.cbOpenOutputWindow.text")); // NOI18N
Lines 115-124 Link Here
115
        excludeNewFiles.setToolTipText(org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.excludeNewFiles.toolTipText")); // NOI18N
125
        excludeNewFiles.setToolTipText(org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.excludeNewFiles.toolTipText")); // NOI18N
116
126
117
        org.openide.awt.Mnemonics.setLocalizedText(signOffCheckBox, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.signOffCheckBox.text")); // NOI18N
127
        org.openide.awt.Mnemonics.setLocalizedText(signOffCheckBox, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.signOffCheckBox.text")); // NOI18N
128
        signOffCheckBox.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
118
129
119
        org.openide.awt.Mnemonics.setLocalizedText(cbIgnoreNotSharableFiles, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.cbIgnoreNotSharableFiles.text")); // NOI18N
130
        org.openide.awt.Mnemonics.setLocalizedText(cbIgnoreNotSharableFiles, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.cbIgnoreNotSharableFiles.text")); // NOI18N
120
        cbIgnoreNotSharableFiles.setToolTipText(org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.cbIgnoreNotSharableFiles.toolTipText")); // NOI18N
131
        cbIgnoreNotSharableFiles.setToolTipText(org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.cbIgnoreNotSharableFiles.toolTipText")); // NOI18N
121
132
133
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(GitOptionsPanel.class, "GitOptionsPanel.jLabel1.text")); // NOI18N
134
135
        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
136
        jPanel2.setLayout(jPanel2Layout);
137
        jPanel2Layout.setHorizontalGroup(
138
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
139
            .addGap(0, 0, Short.MAX_VALUE)
140
        );
141
        jPanel2Layout.setVerticalGroup(
142
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
143
            .addGap(0, 100, Short.MAX_VALUE)
144
        );
145
146
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
147
        jPanel1.setLayout(jPanel1Layout);
148
        jPanel1Layout.setHorizontalGroup(
149
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
150
            .addGroup(jPanel1Layout.createSequentialGroup()
151
                .addGap(0, 0, 0)
152
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
153
                .addGap(0, 0, 0))
154
        );
155
        jPanel1Layout.setVerticalGroup(
156
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
157
            .addGroup(jPanel1Layout.createSequentialGroup()
158
                .addGap(0, 0, 0)
159
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
160
                .addGap(0, 0, 0))
161
        );
162
122
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
163
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
123
        this.setLayout(layout);
164
        this.setLayout(layout);
124
        layout.setHorizontalGroup(
165
        layout.setHorizontalGroup(
Lines 126-138 Link Here
126
            .addGroup(layout.createSequentialGroup()
167
            .addGroup(layout.createSequentialGroup()
127
                .addContainerGap()
168
                .addContainerGap()
128
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
169
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
129
                    .addComponent(signOffCheckBox)
170
                    .addGroup(layout.createSequentialGroup()
171
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
172
                        .addContainerGap())
173
                    .addComponent(signOffCheckBox, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
130
                    .addGroup(layout.createSequentialGroup()
174
                    .addGroup(layout.createSequentialGroup()
131
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
175
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
132
                            .addComponent(excludeNewFiles)
176
                            .addGroup(layout.createSequentialGroup()
133
                            .addComponent(cbOpenOutputWindow)
177
                                .addComponent(jLabel1)
134
                            .addComponent(cbIgnoreNotSharableFiles))
178
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
135
                        .addGap(0, 0, Short.MAX_VALUE))))
179
                                .addComponent(jSeparator1))
180
                            .addGroup(layout.createSequentialGroup()
181
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
182
                                    .addComponent(excludeNewFiles)
183
                                    .addComponent(cbOpenOutputWindow)
184
                                    .addComponent(cbIgnoreNotSharableFiles))
185
                                .addGap(0, 0, Short.MAX_VALUE)))
186
                        .addGap(12, 12, 12))))
136
        );
187
        );
137
        layout.setVerticalGroup(
188
        layout.setVerticalGroup(
138
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
189
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Lines 145-150 Link Here
145
                .addComponent(signOffCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
196
                .addComponent(signOffCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
146
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
197
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
147
                .addComponent(cbIgnoreNotSharableFiles)
198
                .addComponent(cbIgnoreNotSharableFiles)
199
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
200
                    .addGroup(layout.createSequentialGroup()
201
                        .addGap(18, 18, 18)
202
                        .addComponent(jLabel1))
203
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
204
                        .addGap(31, 31, 31)
205
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)))
206
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
207
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
148
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
208
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
149
        );
209
        );
150
210
Lines 158-163 Link Here
158
        excludeNewFiles.setSelected(GitModuleConfig.getDefault().getExludeNewFiles());
218
        excludeNewFiles.setSelected(GitModuleConfig.getDefault().getExludeNewFiles());
159
        signOffCheckBox.setSelected(GitModuleConfig.getDefault().getSignOff());
219
        signOffCheckBox.setSelected(GitModuleConfig.getDefault().getSignOff());
160
        cbIgnoreNotSharableFiles.setSelected(GitModuleConfig.getDefault().getAutoIgnoreFiles());
220
        cbIgnoreNotSharableFiles.setSelected(GitModuleConfig.getDefault().getAutoIgnoreFiles());
221
        ((GroupLayout) jPanel1.getLayout()).replace(jPanel1.getComponent(0), 
222
                DisconnectedRepositoriesManager.getInstance().getOptionsPanel(GitVCS.class.getName()));
161
    }
223
    }
162
    
224
    
163
    void store() {
225
    void store() {
Lines 175-180 Link Here
175
    private javax.swing.JCheckBox cbIgnoreNotSharableFiles;
237
    private javax.swing.JCheckBox cbIgnoreNotSharableFiles;
176
    private javax.swing.JCheckBox cbOpenOutputWindow;
238
    private javax.swing.JCheckBox cbOpenOutputWindow;
177
    private javax.swing.JCheckBox excludeNewFiles;
239
    private javax.swing.JCheckBox excludeNewFiles;
240
    private javax.swing.JLabel jLabel1;
241
    private javax.swing.JPanel jPanel1;
242
    private javax.swing.JPanel jPanel2;
243
    private javax.swing.JSeparator jSeparator1;
178
    final javax.swing.JCheckBox signOffCheckBox = new javax.swing.JCheckBox();
244
    final javax.swing.JCheckBox signOffCheckBox = new javax.swing.JCheckBox();
179
    // End of variables declaration//GEN-END:variables
245
    // End of variables declaration//GEN-END:variables
180
    
246
    
(-)a/git/src/org/netbeans/modules/git/ui/actions/Bundle.properties (-2 / +7 lines)
Lines 39-45 Link Here
39
# Portions Copyrighted 2010 Sun Microsystems, Inc.
39
# Portions Copyrighted 2010 Sun Microsystems, Inc.
40
40
41
LBL_Progress.RefreshingStatuses=Refreshing file statuses
41
LBL_Progress.RefreshingStatuses=Refreshing file statuses
42
#StatusAction
42
#AddAction
43
LBL_AddAction_Name = &Add
43
LBL_AddAction_Name = &Add
44
LBL_AddAction.popupName = Add
44
LBL_AddAction.popupName = Add
45
LBL_AddProgress = Git Add
45
LBL_AddProgress = Git Add
46
#DisconnectAction
47
LBL_DisconnectAction_Name = Disconnect
48
#ConnectAction
49
LBL_ConnectAction_Name = Connect
50
LBL_ConnectAction_Name.popupName = Connect to Git
(-)a/git/src/org/netbeans/modules/git/ui/actions/ConnectAction.java (+96 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.git.ui.actions;
45
46
import java.beans.PropertyChangeEvent;
47
import java.beans.PropertyChangeListener;
48
import java.io.File;
49
import org.netbeans.modules.git.Git;
50
import org.netbeans.modules.git.GitVCS;
51
import org.netbeans.modules.versioning.spi.VCSContext;
52
import org.netbeans.modules.git.utils.GitUtils;
53
import org.netbeans.modules.versioning.util.DisconnectedRepositoriesManager;
54
import org.openide.awt.ActionID;
55
import org.openide.awt.ActionRegistration;
56
import org.openide.nodes.Node;
57
58
@ActionID(id = "org.netbeans.modules.git.ui.actions.ConnectAction", category = "Git")
59
@ActionRegistration(displayName = "#LBL_ConnectAction_Name")
60
public class ConnectAction extends GitAction implements PropertyChangeListener {
61
    
62
    @Override
63
    protected boolean enable (Node[] nodes) {
64
        VCSContext context = getCurrentContext(nodes);
65
        return isDisconnected(context);
66
    } 
67
68
    @Override
69
    protected void performContextAction (Node[] nodes) {
70
        VCSContext context = getCurrentContext(nodes);
71
        if (isDisconnected(context)) {
72
            File root = context.getRootFiles().iterator().next();
73
            File repository = Git.getInstance().getRepositoryRoot(root);
74
            DisconnectedRepositoriesManager.getInstance().connectRepository(
75
                    GitVCS.class.getName(), repository.getAbsolutePath());
76
        }
77
    }
78
79
    void refreshEnabled () {
80
        setEnabled(false);
81
    }
82
83
    private boolean isDisconnected (VCSContext context) {
84
        return context.getRootFiles().size() == 1 && GitUtils.isFromGitRepository(context)
85
                && DisconnectedRepositoriesManager.getInstance().isDisconnected(
86
                GitVCS.class.getName(), context.getRootFiles().iterator().next().getAbsolutePath());
87
    }
88
    
89
    @Override
90
    public void propertyChange (PropertyChangeEvent evt) {
91
        if (DisconnectedRepositoriesManager.PROP_CONNECTED_ROOTS_CHANGED.equals(evt.getPropertyName())) {
92
            refreshEnabled();
93
        }
94
    }
95
96
}
(-)a/git/src/org/netbeans/modules/git/ui/actions/DisconnectAction.java (+113 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.git.ui.actions;
45
46
import java.beans.PropertyChangeEvent;
47
import java.beans.PropertyChangeListener;
48
import java.io.File;
49
import org.netbeans.modules.git.Git;
50
import org.netbeans.modules.git.GitVCS;
51
import org.netbeans.modules.versioning.spi.VCSContext;
52
import org.netbeans.modules.git.utils.GitUtils;
53
import org.netbeans.modules.versioning.util.DisconnectedRepositoriesManager;
54
import org.openide.DialogDisplayer;
55
import org.openide.NotifyDescriptor;
56
import org.openide.awt.ActionID;
57
import org.openide.awt.ActionRegistration;
58
import org.openide.nodes.Node;
59
import org.openide.util.NbBundle;
60
61
@ActionID(id = "org.netbeans.modules.git.ui.actions.DisconnectAction", category = "Git")
62
@ActionRegistration(displayName = "#LBL_DisconnectAction_Name")
63
public class DisconnectAction extends GitAction implements PropertyChangeListener {
64
    
65
    @Override
66
    protected boolean enable (Node[] nodes) {
67
        VCSContext context = getCurrentContext(nodes);
68
        return isConnected(context);
69
    } 
70
71
    @Override
72
    @NbBundle.Messages({
73
        "# {0} - repository root name",
74
        "MSG_DisconnectAction.confirmation.text=Do you want to disconnect {0} from Git?\n"
75
            + "The folder will no longer be controlled by Git in the IDE.\n\n"
76
            + "You will be able to reconnect the folder to the system\n"
77
            + "with the Connect action available from the Main menu.",
78
        "LBL_DisconnectAction.confirmation.title=Disconnect From Git"
79
    })
80
    protected void performContextAction (Node[] nodes) {
81
        VCSContext context = getCurrentContext(nodes);
82
        if (isConnected(context)) {
83
            File root = context.getRootFiles().iterator().next();
84
            File repository = Git.getInstance().getRepositoryRoot(root);
85
            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
86
                    Bundle.MSG_DisconnectAction_confirmation_text(repository.getName()),
87
                    Bundle.LBL_DisconnectAction_confirmation_title(),
88
                    NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
89
            if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
90
                DisconnectedRepositoriesManager.getInstance().disconnectRepository(
91
                        GitVCS.class.getName(), repository.getAbsolutePath());
92
            }
93
        }
94
    }
95
96
    void refreshEnabled () {
97
        setEnabled(false);
98
    }
99
100
    private boolean isConnected (VCSContext context) {
101
        return context.getRootFiles().size() == 1 && GitUtils.isFromGitRepository(context)
102
                && !DisconnectedRepositoriesManager.getInstance().isDisconnected(
103
                GitVCS.class.getName(), context.getRootFiles().iterator().next().getAbsolutePath());
104
    }
105
    
106
    @Override
107
    public void propertyChange (PropertyChangeEvent evt) {
108
        if (DisconnectedRepositoriesManager.PROP_CONNECTED_ROOTS_CHANGED.equals(evt.getPropertyName())) {
109
            refreshEnabled();
110
        }
111
    }
112
113
}
(-)a/git/src/org/netbeans/modules/git/ui/repository/RepositoryBrowserPanel.java (-37 / +60 lines)
Lines 85-90 Link Here
85
import org.netbeans.libs.git.SearchCriteria;
85
import org.netbeans.libs.git.SearchCriteria;
86
import org.netbeans.modules.git.Git;
86
import org.netbeans.modules.git.Git;
87
import org.netbeans.modules.git.GitRepositories;
87
import org.netbeans.modules.git.GitRepositories;
88
import org.netbeans.modules.git.GitVCS;
88
import org.netbeans.modules.git.client.GitProgressSupport;
89
import org.netbeans.modules.git.client.GitProgressSupport;
89
import org.netbeans.modules.git.ui.branch.CreateBranchAction;
90
import org.netbeans.modules.git.ui.branch.CreateBranchAction;
90
import org.netbeans.modules.git.ui.branch.DeleteBranchAction;
91
import org.netbeans.modules.git.ui.branch.DeleteBranchAction;
Lines 95-100 Link Here
95
import org.netbeans.modules.git.ui.tag.CreateTagAction;
96
import org.netbeans.modules.git.ui.tag.CreateTagAction;
96
import org.netbeans.modules.git.ui.tag.ManageTagsAction;
97
import org.netbeans.modules.git.ui.tag.ManageTagsAction;
97
import org.netbeans.modules.git.utils.GitUtils;
98
import org.netbeans.modules.git.utils.GitUtils;
99
import org.netbeans.modules.versioning.util.DisconnectedRepositoriesManager;
98
import org.netbeans.modules.versioning.util.Utils;
100
import org.netbeans.modules.versioning.util.Utils;
99
import org.openide.explorer.ExplorerManager;
101
import org.openide.explorer.ExplorerManager;
100
import org.openide.explorer.ExplorerManager.Provider;
102
import org.openide.explorer.ExplorerManager.Provider;
Lines 396-423 Link Here
396
                @Override
398
                @Override
397
                @SuppressWarnings("unchecked")
399
                @SuppressWarnings("unchecked")
398
                public void propertyChange (PropertyChangeEvent evt) {
400
                public void propertyChange (PropertyChangeEvent evt) {
399
                    final Set<File> oldValues = (Set<File>) evt.getOldValue();
401
                    if (GitRepositories.PROP_REPOSITORIES.equals(evt.getPropertyName())) {
400
                    final Set<File> newValues = (Set<File>) evt.getNewValue();
402
                        final Set<File> oldValues = (Set<File>) evt.getOldValue();
401
                    if (oldValues.size() > newValues.size()) {
403
                        final Set<File> newValues = (Set<File>) evt.getNewValue();
402
                        oldValues.removeAll(newValues);
404
                        if (oldValues.size() > newValues.size()) {
403
                        removeAll(oldValues);
405
                            oldValues.removeAll(newValues);
404
                    } else if (oldValues.size() < newValues.size()) {
406
                            removeAll(oldValues);
405
                        newValues.removeAll(oldValues);
407
                        } else if (oldValues.size() < newValues.size()) {
406
                        RP.post(new Runnable () {
408
                            newValues.removeAll(oldValues);
407
                            @Override
409
                            RP.post(new Runnable () {
408
                            public void run () {
410
                                @Override
409
                                java.util.Map<File, RepositoryNode> nodes = new HashMap<File, RepositoryNode>();
411
                                public void run () {
410
                                for (File r : newValues) {
412
                                    java.util.Map<File, RepositoryNode> nodes = new HashMap<File, RepositoryNode>();
411
                                    RepositoryInfo info = RepositoryInfo.getInstance(r);
413
                                    for (File r : newValues) {
412
                                    if (info == null) {
414
                                        RepositoryInfo info = RepositoryInfo.getInstance(r);
413
                                        LOG.log(Level.INFO, "RepositoriesChildren.propertyChange() : Null info for {0}", r); //NOI18N
415
                                        if (info == null) {
414
                                    } else {
416
                                            LOG.log(Level.INFO, "RepositoriesChildren.propertyChange() : Null info for {0}", r); //NOI18N
415
                                        nodes.put(r, new RepositoryNode(r, info));
417
                                        } else {
418
                                            nodes.put(r, new RepositoryNode(r, info));
419
                                        }
416
                                    }
420
                                    }
421
                                    putAll(nodes);
417
                                }
422
                                }
418
                                putAll(nodes);
423
                            });
419
                            }
424
                        }
420
                        });
421
                    }
425
                    }
422
                }
426
                }
423
            }, GitRepositories.getInstance()));
427
            }, GitRepositories.getInstance()));
Lines 435-442 Link Here
435
    }
439
    }
436
440
437
    private class RepositoryNode extends RepositoryBrowserNode implements PropertyChangeListener {
441
    private class RepositoryNode extends RepositoryBrowserNode implements PropertyChangeListener {
438
        private PropertyChangeListener list;
439
        private final File repository;
442
        private final File repository;
443
        private boolean disconnected;
440
444
441
        public RepositoryNode (final File repository, RepositoryInfo info) {
445
        public RepositoryNode (final File repository, RepositoryInfo info) {
442
            super(new RepositoryChildren(), repository);
446
            super(new RepositoryChildren(), repository);
Lines 452-465 Link Here
452
                            LOG.log(Level.INFO, "RepositoryNode() : Null info for {0}", repository); //NOI18N
456
                            LOG.log(Level.INFO, "RepositoryNode() : Null info for {0}", repository); //NOI18N
453
                        } else {
457
                        } else {
454
                            setName(info);
458
                            setName(info);
455
                            info.addPropertyChangeListener(list = WeakListeners.propertyChange(RepositoryNode.this, info));
459
                            info.addPropertyChangeListener(WeakListeners.propertyChange(RepositoryNode.this, info));
456
                        }
460
                        }
457
                    }
461
                    }
458
                });
462
                });
459
            } else {
463
            } else {
460
                setName(info);
464
                setName(info);
461
                info.addPropertyChangeListener(list = WeakListeners.propertyChange(this, info));
465
                info.addPropertyChangeListener(WeakListeners.propertyChange(this, info));
462
            }
466
            }
467
            DisconnectedRepositoriesManager.getInstance().addPropertyChangeListener(
468
                    WeakListeners.propertyChange(this, DisconnectedRepositoriesManager.getInstance()));
463
        }
469
        }
464
470
465
        private void setName (RepositoryInfo info) {
471
        private void setName (RepositoryInfo info) {
Lines 501-506 Link Here
501
        public void propertyChange (PropertyChangeEvent evt) {
507
        public void propertyChange (PropertyChangeEvent evt) {
502
            if (evt.getSource() instanceof RepositoryInfo) {
508
            if (evt.getSource() instanceof RepositoryInfo) {
503
                setName((RepositoryInfo) evt.getSource());
509
                setName((RepositoryInfo) evt.getSource());
510
            } else if (DisconnectedRepositoriesManager.PROP_CONNECTED_ROOTS_CHANGED.equals(evt.getPropertyName())
511
                    && repository.getAbsolutePath().equals(evt.getNewValue())) {
512
                if (disconnected != DisconnectedRepositoriesManager.getInstance().isDisconnected(
513
                        GitVCS.class.getName(), repository.getAbsolutePath())) {
514
                    setDisconnected(!disconnected);
515
                }
504
            }
516
            }
505
        }
517
        }
506
518
Lines 524-529 Link Here
524
        public String getShortDescription () {
536
        public String getShortDescription () {
525
            return repository.getAbsolutePath();
537
            return repository.getAbsolutePath();
526
        }
538
        }
539
540
        private void setDisconnected (boolean b) {
541
            this.disconnected = b;
542
            ((RepositoryChildren) getChildren()).refreshKeys(true);
543
        }
527
    }
544
    }
528
545
529
    private class RepositoryChildren extends Children.Keys<AbstractNode> {
546
    private class RepositoryChildren extends Children.Keys<AbstractNode> {
Lines 533-552 Link Here
533
        @Override
550
        @Override
534
        protected void addNotify () {
551
        protected void addNotify () {
535
            super.addNotify();
552
            super.addNotify();
536
            if (!initialized) {
553
            refreshKeys(false);
537
                initialized = true;
538
                List<AbstractNode> keys = new LinkedList<AbstractNode>();
539
                if (options.contains(Option.DISPLAY_BRANCHES_LOCAL) || options.contains(Option.DISPLAY_BRANCHES_REMOTE)) {
540
                    keys.add(new BranchesTopNode(((RepositoryNode) getNode()).getRepository()));
541
                }
542
                if (options.contains(Option.DISPLAY_TAGS)) {
543
                    keys.add(new TagsNode(((RepositoryNode) getNode()).getRepository()));
544
                }
545
                if (options.contains(Option.DISPLAY_REMOTES)) {
546
                    keys.add(new RemotesNode(((RepositoryNode) getNode()).getRepository()));
547
                }
548
                setKeys(keys);
549
            }
550
        }
554
        }
551
555
552
        @Override
556
        @Override
Lines 560-565 Link Here
560
            return new Node[] { key };
564
            return new Node[] { key };
561
        }
565
        }
562
566
567
        private void refreshKeys (boolean force) {
568
            if (force || !initialized) {
569
                initialized = true;
570
                List<AbstractNode> keys = new LinkedList<AbstractNode>();
571
                if (!((RepositoryNode) getNode()).disconnected) {
572
                    if (options.contains(Option.DISPLAY_BRANCHES_LOCAL) || options.contains(Option.DISPLAY_BRANCHES_REMOTE)) {
573
                        keys.add(new BranchesTopNode(((RepositoryNode) getNode()).getRepository()));
574
                    }
575
                    if (options.contains(Option.DISPLAY_TAGS)) {
576
                        keys.add(new TagsNode(((RepositoryNode) getNode()).getRepository()));
577
                    }
578
                    if (options.contains(Option.DISPLAY_REMOTES)) {
579
                        keys.add(new RemotesNode(((RepositoryNode) getNode()).getRepository()));
580
                    }
581
                }
582
                setKeys(keys);
583
            }
584
        }
585
563
    }
586
    }
564
587
565
    //<editor-fold defaultstate="collapsed" desc="branches">
588
    //<editor-fold defaultstate="collapsed" desc="branches">
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/Bundle.properties (-8 lines)
Lines 54-67 Link Here
54
CTL_MenuItem_LocalHistory=Local History
54
CTL_MenuItem_LocalHistory=Local History
55
CTL_MenuItem_Initializing=Initializing...
55
CTL_MenuItem_Initializing=Initializing...
56
56
57
CTL_DisconnectAction.name=Dis&connect...
58
CTL_ConnectAction.name=&Connect
59
CTL_ConnectAction.name.vcs=Connect To {0}
60
LBL_ConnectAction.confirmation.title=Disconnect From Version Control System
61
MSG_ConnectAction.confirmation.text=Do you want to disconnect {0} from {1}?\n\
62
The folder will no longer be controlled by {1} in the IDE.\n\n\
63
You will be able to reconnect the folder to the system\n\
64
with the Connect action available from the Main menu.
65
LBL_NoneAvailable=None available
57
LBL_NoneAvailable=None available
66
CTL_LocalHistoryMenuName=History
58
CTL_LocalHistoryMenuName=History
67
CTL_LocalHistoryMenuNameLoc=&History
59
CTL_LocalHistoryMenuNameLoc=&History
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/ProjectMenuItem.java (-20 / +6 lines)
Lines 151-176 Link Here
151
    private Action [] createVersioningSystemActions (VersioningSystem vs, Node[] nodes, boolean displayConnectAction) {
151
    private Action [] createVersioningSystemActions (VersioningSystem vs, Node[] nodes, boolean displayConnectAction) {
152
        VCSContext ctx = VCSContext.forNodes(nodes);
152
        VCSContext ctx = VCSContext.forNodes(nodes);
153
        Action [] actions = null;
153
        Action [] actions = null;
154
        if (displayConnectAction && ctx.getRootFiles().size() == 1) {
154
        if (vs instanceof DelegatingVCS) {
155
            // we have only one root. If it's disconnected, display only the Connect action instead of other actions (import, init etc. do not make sense)
155
            actions = ((DelegatingVCS) vs).getInitActions(ctx);
156
            VCSFileProxy root = vs.getTopmostManagedAncestor(ctx.getRootFiles().iterator().next());
156
        } else {
157
            if (root != null) {
157
            VCSAnnotator an = vs.getVCSAnnotator();
158
                if (VersioningConfig.getDefault().isDisconnected(vs, root)) {
158
            if (an == null) return null; 
159
                    // repository is indeed disconnected, display only Connect action
159
            actions = an.getActions(ctx, VCSAnnotator.ActionDestination.PopupMenu);
160
                    String displayName = vs.getMenuLabel();
161
                    actions = new Action[] { new VersioningMainMenu.ConnectAction(vs, root, NbBundle.getMessage(ProjectMenuItem.class, "CTL_ConnectAction.name.vcs", displayName)) }; //NOI18N
162
                }
163
            }
164
        }
165
        if (actions == null) {
166
            // repository is connected or the context not yet versioned
167
            if (vs instanceof DelegatingVCS) {
168
                actions = ((DelegatingVCS) vs).getInitActions(ctx);
169
            } else {
170
                VCSAnnotator an = vs.getVCSAnnotator();
171
                if (an == null) return null; 
172
                actions = an.getActions(ctx, VCSAnnotator.ActionDestination.PopupMenu);
173
            }
174
        }
160
        }
175
        return actions;
161
        return actions;
176
    }
162
    }
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/VersioningConfig.java (-145 lines)
Lines 43-62 Link Here
43
 */
43
 */
44
package org.netbeans.modules.versioning.core;
44
package org.netbeans.modules.versioning.core;
45
45
46
import java.util.HashMap;
47
import java.util.HashSet;
48
import java.util.Iterator;
49
import java.util.LinkedList;
50
import java.util.List;
51
import java.util.Map;
52
import java.util.Set;
53
import java.util.logging.Level;
54
import java.util.logging.Logger;
55
import org.openide.util.NbPreferences;
46
import org.openide.util.NbPreferences;
56
57
import java.util.prefs.Preferences;
47
import java.util.prefs.Preferences;
58
import org.netbeans.modules.versioning.core.util.VCSSystemProvider.VersioningSystem;
59
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
60
48
61
/**
49
/**
62
 * Stores Versioning manager configuration.
50
 * Stores Versioning manager configuration.
Lines 66-78 Link Here
66
public class VersioningConfig {
54
public class VersioningConfig {
67
    
55
    
68
    private static final VersioningConfig INSTANCE = new VersioningConfig();    
56
    private static final VersioningConfig INSTANCE = new VersioningConfig();    
69
    private static final Logger LOG = Logger.getLogger(VersioningConfig.class.getName());
70
    private final Map<String, Set<String>> allDisconnectedRepositories;
71
    private static final String SEP = "###"; //NOI18N
72
    private static final String PREF_KEY = "disconnectedFolders"; //NOI18N
73
57
74
    private VersioningConfig () {
58
    private VersioningConfig () {
75
        allDisconnectedRepositories = initializeDisconnectedRepositories();
76
    }
59
    }
77
    
60
    
78
    public static VersioningConfig getDefault() {
61
    public static VersioningConfig getDefault() {
Lines 80-214 Link Here
80
    }
63
    }
81
    
64
    
82
    public Preferences getPreferences() {
65
    public Preferences getPreferences() {
83
        return getPrefs();
84
    }
85
    
86
    private static Preferences getPrefs () {
87
        return NbPreferences.root().node("org/netbeans/modules/versioning"); // NOI18N
66
        return NbPreferences.root().node("org/netbeans/modules/versioning"); // NOI18N
88
    }
67
    }
89
68
90
    /**
91
     * Tests whether the given repository is disconnected from the given versioning system. 
92
     * @param vs
93
     * @param repository
94
     * @return 
95
     */
96
    boolean isDisconnected (VersioningSystem vs, VCSFileProxy repository) {
97
        boolean disconnected = false;
98
        String className = vs.getDelegate().getClass().getName();
99
        synchronized (allDisconnectedRepositories) {
100
            Set<String> disconnectedRepositories = allDisconnectedRepositories.get(className);
101
            if (disconnectedRepositories != null) {
102
                for (String disconnectedRepository : disconnectedRepositories) {
103
                    if (disconnectedRepository.equals(repository.getPath())) {
104
                        disconnected = true;
105
                        LOG.log(Level.FINE, "isDisconnected: Folder is disconnected from {0}: {1}, disconnected root: {2}", new Object[] { className, repository, disconnectedRepository }); //NOI18N
106
                        break;
107
                    }
108
                }
109
            }
110
        }
111
        return disconnected;
112
    }
113
114
    /**
115
     * Reconnects the given repository to the given versioning system
116
     * @param vs
117
     * @param repository 
118
     */
119
    public void connectRepository (VersioningSystem vs, VCSFileProxy repository) {
120
        connectRepository(vs, repository.getPath());
121
    }
122
    
123
    public void connectRepository (VersioningSystem vs, String path) {
124
        String className = vs.getDelegate().getClass().getName();
125
        synchronized (allDisconnectedRepositories) {
126
            Set<String> disconnectedRepos = allDisconnectedRepositories.get(className);
127
            if (disconnectedRepos != null) {
128
                boolean changed = false;
129
                for (Iterator<String> it = disconnectedRepos.iterator(); it.hasNext(); ) {
130
                    String disconnectedRepository = it.next();
131
                    if (disconnectedRepository.equals(path)) {
132
                        LOG.log(Level.FINE, "connectRepository: Connecting repository to {0}: {1}", new Object[] { className, path }); //NOI18N
133
                        it.remove();
134
                        changed = true;
135
                        break;
136
                    }
137
                }
138
                if (changed) {
139
                    saveDisconnectedRepositories();
140
                }
141
            }
142
        }
143
    }
144
145
    /**
146
     * Disconnects the given repository from the given version control system
147
     * @param vs
148
     * @param repository 
149
     */
150
    public void disconnectRepository (VersioningSystem vs, VCSFileProxy repository) {
151
        disconnectRepository(vs, repository.getPath());
152
    }
153
    
154
    public void disconnectRepository (VersioningSystem vs, String path) {
155
        String className = vs.getDelegate().getClass().getName();
156
        synchronized (allDisconnectedRepositories) {
157
            Set<String> disconnectedRepos = allDisconnectedRepositories.get(className);
158
            if (disconnectedRepos == null) {
159
                disconnectedRepos = new HashSet<String>();
160
                allDisconnectedRepositories.put(className, disconnectedRepos);
161
            }
162
            boolean added = disconnectedRepos.add(path);
163
            if (!added) {
164
                LOG.log(Level.FINE, "disconnectRepository: Repository already disconnected for {0}: {1}", new Object[] { className, path }); //NOI18N
165
            } else {
166
                saveDisconnectedRepositories();
167
            }
168
        }
169
    }
170
171
    public String[] getDisconnectedRoots (VersioningSystem vs) {
172
        String className = vs.getDelegate().getClass().getName();
173
        String[] paths;
174
        synchronized (allDisconnectedRepositories) {
175
            Set<String> disconnectedRepos = allDisconnectedRepositories.get(className);
176
            if (disconnectedRepos == null) {
177
                paths = new String[0];
178
            } else {
179
                paths = disconnectedRepos.toArray(new String[disconnectedRepos.size()]);
180
            }
181
        }
182
        return paths;
183
    }
184
185
    private static Map<String, Set<String>> initializeDisconnectedRepositories () {
186
        Map<String, Set<String>> disconnectedFolders = new HashMap<String, Set<String>>(5);
187
        List<String> list = Utils.getStringList(getPrefs(), PREF_KEY);
188
        for (String s : list) {
189
            String[] disconnectedFolder = s.split(SEP);
190
            if (disconnectedFolder.length == 2) {
191
                Set<String> files = disconnectedFolders.get(disconnectedFolder[0]);
192
                if (files == null) {
193
                    files = new HashSet<String>();
194
                    disconnectedFolders.put(disconnectedFolder[0], files);
195
                }
196
                files.add(disconnectedFolder[1]);
197
            }
198
        }
199
        return disconnectedFolders;
200
    }
201
202
    private void saveDisconnectedRepositories () {
203
        List<String> list = new LinkedList<String>();
204
        synchronized (allDisconnectedRepositories) {
205
            for (Map.Entry<String, Set<String>> e : allDisconnectedRepositories.entrySet()) {
206
                String vsKey = e.getKey();
207
                for (String f : e.getValue()) {
208
                    list.add(vsKey + SEP + f);
209
                }
210
            }
211
        }
212
        Utils.put(getPreferences(), PREF_KEY, list);
213
    }
214
}
69
}
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/VersioningMainMenu.java (-80 / +6 lines)
Lines 54-63 Link Here
54
import javax.swing.event.MenuEvent;
54
import javax.swing.event.MenuEvent;
55
import java.awt.event.ActionEvent;
55
import java.awt.event.ActionEvent;
56
import java.util.*;
56
import java.util.*;
57
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
58
import org.netbeans.modules.versioning.core.spi.VCSAnnotator;
57
import org.netbeans.modules.versioning.core.spi.VCSAnnotator;
59
import org.openide.DialogDisplayer;
60
import org.openide.NotifyDescriptor;
61
import org.openide.util.NbBundle;
58
import org.openide.util.NbBundle;
62
59
63
/**
60
/**
Lines 100-106 Link Here
100
                    List<JComponent> systemItems = actionsToItems(vs[0].getVCSAnnotator().getActions(ctx, VCSAnnotator.ActionDestination.MainMenu));
97
                    List<JComponent> systemItems = actionsToItems(vs[0].getVCSAnnotator().getActions(ctx, VCSAnnotator.ActionDestination.MainMenu));
101
                    items.addAll(systemItems);
98
                    items.addAll(systemItems);
102
                }
99
                }
103
                items.addAll(actionsToItems(appendAdditionalActions(ctx, vs[0], new Action[0])));
104
                items.add(Utils.createJSeparator());
100
                items.add(Utils.createJSeparator());
105
            } else if (vs.length > 1) {
101
            } else if (vs.length > 1) {
106
                JMenuItem dummy = new JMenuItem("<multiple systems>");
102
                JMenuItem dummy = new JMenuItem("<multiple systems>");
Lines 121-127 Link Here
121
                if (system.isLocalHistory()) {
117
                if (system.isLocalHistory()) {
122
                    localHistory = system;
118
                    localHistory = system;
123
                } else if (!"".equals(system.getMenuLabel())) { //NOI18N
119
                } else if (!"".equals(system.getMenuLabel())) { //NOI18N
124
                    JMenu menu = createVersioningSystemMenu(system, true);
120
                    JMenu menu = createVersioningSystemMenu(system);
125
                    items.add(menu);
121
                    items.add(menu);
126
                }
122
                }
127
            }
123
            }
Lines 132-144 Link Here
132
128
133
            if (localHistory != null) {
129
            if (localHistory != null) {
134
                items.add(Utils.createJSeparator());
130
                items.add(Utils.createJSeparator());
135
                items.add(createVersioningSystemMenu(localHistory, false));
131
                items.add(createVersioningSystemMenu(localHistory));
136
            }
132
            }
137
        }
133
        }
138
        return items.toArray(new JComponent[items.size()]);
134
        return items.toArray(new JComponent[items.size()]);
139
    }
135
    }
140
136
141
    private JMenu createVersioningSystemMenu(final VersioningSystem system, final boolean isRegularVCS) {
137
    private JMenu createVersioningSystemMenu(final VersioningSystem system) {
142
        final JMenu menu = new JMenu();
138
        final JMenu menu = new JMenu();
143
        String menuText = 
139
        String menuText = 
144
                VersioningManager.getInstance().isLocalHistory(system) ? 
140
                VersioningManager.getInstance().isLocalHistory(system) ? 
Lines 151-157 Link Here
151
                if (menu.getItemCount() != 0) return;
147
                if (menu.getItemCount() != 0) return;
152
                // context should be cached while the menu is displayed
148
                // context should be cached while the menu is displayed
153
                VCSContext ctx = VCSContext.forNodes(TopComponent.getRegistry().getActivatedNodes());
149
                VCSContext ctx = VCSContext.forNodes(TopComponent.getRegistry().getActivatedNodes());
154
                constructMenu(menu, system, ctx, isRegularVCS);
150
                constructMenu(menu, system, ctx);
155
            }
151
            }
156
    
152
    
157
            @Override
153
            @Override
Lines 165-179 Link Here
165
        return menu;
161
        return menu;
166
    }
162
    }
167
163
168
    private void constructMenu (JMenu menu, VersioningSystem system, VCSContext ctx, boolean isRegularVCS) {
164
    private void constructMenu (JMenu menu, VersioningSystem system, VCSContext ctx) {
169
        Action[] actions = null;
165
        Action[] actions = null;
170
        if (system.getVCSAnnotator() != null) {
166
        if (system.getVCSAnnotator() != null) {
171
            actions = system.getVCSAnnotator().getActions(ctx, VCSAnnotator.ActionDestination.MainMenu);
167
            actions = system.getVCSAnnotator().getActions(ctx, VCSAnnotator.ActionDestination.MainMenu);
172
        }
168
        }
173
        if (isRegularVCS) {
169
        if (actions != null && actions.length > 0) {
174
            actions = appendAdditionalActions(ctx, system, actions);
175
        }
176
        if(actions != null && actions.length > 0) {
177
            List<JComponent> systemItems = actionsToItems(actions);
170
            List<JComponent> systemItems = actionsToItems(actions);
178
            for (JComponent systemItem : systemItems) {
171
            for (JComponent systemItem : systemItems) {
179
                menu.add(systemItem);
172
                menu.add(systemItem);
Lines 206-276 Link Here
206
            return a.getDisplayName().compareTo(b.getDisplayName());
199
            return a.getDisplayName().compareTo(b.getDisplayName());
207
        }
200
        }
208
    }
201
    }
209
    
210
    static class ConnectAction extends AbstractAction {
211
        private final VCSFileProxy root;
212
        private final VersioningSystem vs;
213
214
        public ConnectAction (VersioningSystem vs, VCSFileProxy root, String name) {
215
            super(name == null ? NbBundle.getMessage(VersioningMainMenu.class, "CTL_ConnectAction.name") : name); //NOI18N
216
            this.vs = vs;
217
            this.root = root;
218
        }
219
220
        @Override
221
        public void actionPerformed (ActionEvent e) {
222
            VersioningConfig.getDefault().connectRepository(vs, root);
223
            VersioningManager.getInstance().versionedRootsChanged();
224
        }
225
    }
226
227
    // should be available only from the main menu
228
    private static class DisconnectAction extends AbstractAction {
229
        private final VCSFileProxy root;
230
        private final VersioningSystem vs;
231
232
        public DisconnectAction (VersioningSystem vs, VCSFileProxy root) {
233
            super(NbBundle.getMessage(VersioningMainMenu.class, "CTL_DisconnectAction.name")); //NOI18N
234
            this.vs = vs;
235
            this.root = root;
236
        }
237
238
        @Override
239
        public void actionPerformed (ActionEvent e) {
240
            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
241
                    NbBundle.getMessage(VersioningMainMenu.class, "MSG_ConnectAction.confirmation.text", new Object[] { root.getName(), vs.getDisplayName() }), //NOI18N
242
                    NbBundle.getMessage(VersioningMainMenu.class, "LBL_ConnectAction.confirmation.title"), //NOI18N
243
                    NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
244
            if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
245
                VersioningConfig.getDefault().disconnectRepository(vs, root);
246
                VersioningManager.getInstance().versionedRootsChanged();
247
            }
248
        }
249
    }
250
251
    /**
252
     * appends connect/disconnect actions to given actions
253
     * @param ctx
254
     * @param system
255
     * @param actions initial actions
256
     * @return enhanced actions
257
     */
258
    private Action[] appendAdditionalActions (VCSContext ctx, VersioningSystem system, Action[] actions) {
259
        if (ctx.getRootFiles().size() == 1) {
260
            // can connect or disconnect just one root
261
            VCSFileProxy root = system.getTopmostManagedAncestor(ctx.getRootFiles().iterator().next());
262
            if (root != null) {
263
                Action a;
264
                // adding connect/disconnect actions to the main menu
265
                if (VersioningConfig.getDefault().isDisconnected(system, root)) {
266
                    actions = new Action[] { new ConnectAction(system, root, null) };
267
                } else {
268
                    actions = actions == null ? new Action[2] : Arrays.copyOf(actions, actions.length + 2);
269
                    actions[actions.length - 2] = null;
270
                    actions[actions.length - 1] = new DisconnectAction(system, root);
271
                }
272
            }
273
        }
274
        return actions;
275
    }
276
}
202
}
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/VersioningManager.java (-9 / +3 lines)
Lines 433-447 Link Here
433
                VCSFileProxy topmost = system.getTopmostManagedAncestor(folder);
433
                VCSFileProxy topmost = system.getTopmostManagedAncestor(folder);
434
                LOG.log(Level.FINE, " {0} returns {1} ", new Object[] { system.getClass().getName(), topmost }) ;
434
                LOG.log(Level.FINE, " {0} returns {1} ", new Object[] { system.getClass().getName(), topmost }) ;
435
                if (topmost != null && (closestParent == null || Utils.isAncestorOrEqual(closestParent, topmost))) {
435
                if (topmost != null && (closestParent == null || Utils.isAncestorOrEqual(closestParent, topmost))) {
436
                    if (VersioningConfig.getDefault().isDisconnected(system, topmost)) {
436
                    LOG.log(Level.FINE, " owner = {0}", new Object[] { system.getClass().getName() }) ;
437
                        // repository root is disconnected from this vcs
437
                    owner = system;
438
                        LOG.log(Level.FINE, " skipping disconnected owner = {0} for {1}", new Object[] { 
438
                    closestParent = topmost;
439
                            system.getClass().getName(), topmost }) ;
440
                    } else {
441
                        LOG.log(Level.FINE, " owner = {0}", new Object[] { system.getClass().getName() }) ;
442
                        owner = system;
443
                        closestParent = topmost;
444
                    }
445
                }
439
                }
446
            }
440
            }
447
        }
441
        }
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/util/Utils.java (-33 lines)
Lines 47-53 Link Here
47
import javax.swing.Action;
47
import javax.swing.Action;
48
import org.netbeans.modules.versioning.core.*;
48
import org.netbeans.modules.versioning.core.*;
49
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
49
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
50
import org.netbeans.modules.versioning.core.filesystems.VCSFileProxyOperations;
51
import org.netbeans.modules.versioning.core.spi.VCSHistoryProvider;
50
import org.netbeans.modules.versioning.core.spi.VCSHistoryProvider;
52
import org.netbeans.modules.versioning.core.spi.VCSHistoryProvider.HistoryEntry;
51
import org.netbeans.modules.versioning.core.spi.VCSHistoryProvider.HistoryEntry;
53
import org.netbeans.modules.versioning.core.spi.VCSHistoryProvider.MessageEditProvider;
52
import org.netbeans.modules.versioning.core.spi.VCSHistoryProvider.MessageEditProvider;
Lines 94-131 Link Here
94
    }
93
    }
95
    
94
    
96
    /**
95
    /**
97
     * Stop managing the given path by the given versioning system
98
     * 
99
     * @param versioningSystem the versioning system to stop manage for the given path
100
     * @param absolutePath the path to stop managed by the given versioning system
101
     * @see #connectRepository(org.netbeans.modules.versioning.core.util.VCSSystemProvider.VersioningSystem, java.lang.String) 
102
     */
103
    public static void disconnectRepository(VersioningSystem versioningSystem, String absolutePath) {
104
        VersioningConfig.getDefault().disconnectRepository(versioningSystem, absolutePath);
105
    }
106
107
    /**
108
     * Start again to manage the given path by the given versioning system
109
     * 
110
     * @param versioningSystem the versioning system to stop manage for the given path
111
     * @param absolutePath the path to stop managed by the given versioning system
112
     * @see #disconnectRepository(org.netbeans.modules.versioning.core.util.VCSSystemProvider.VersioningSystem, java.lang.String) 
113
     */
114
    public static void connectRepository(VersioningSystem versioningSystem, String absolutePath) {
115
        VersioningConfig.getDefault().connectRepository(versioningSystem, absolutePath);
116
    }
117
118
    /**
119
     * Returns all paths marked as not to managed by the given system
120
     * 
121
     * @param versioningSystem the versioning system 
122
     * @return path not managed by the given versioning system
123
     */
124
    public static String[] getDisconnectedRoots(VersioningSystem versioningSystem) {
125
        return VersioningConfig.getDefault().getDisconnectedRoots(versioningSystem);
126
    }
127
    
128
    /**
129
     * Empties the file owner cache
96
     * Empties the file owner cache
130
     */
97
     */
131
    public static void flushNullOwners() {
98
    public static void flushNullOwners() {
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/Bundle.properties (-11 lines)
Lines 38-54 Link Here
38
#
38
#
39
# Portions Copyrighted 2011 Sun Microsystems, Inc.
39
# Portions Copyrighted 2011 Sun Microsystems, Inc.
40
40
41
AdvancedOption_DisplayName=General
42
AdvancedOption_Tooltip=General Versioning Options
43
GeneralOptionsPanel.jLabel1.text=&Versioning System
44
LBL_OptionsPanel.disconnectedFolders.title=Disconnected Repositories
45
GeneralOptionsPanel.jLabel2.text=Disconnected &Folders
46
GeneralOptionsPanel.btnRemove.text=&Remove
47
GeneralOptionsPanel.btnRemove.TTtext=Removes selected folder from the list of disconnected folders and reconnects the folder to the selected version control system
48
GeneralOptionsPanel.btnAdd.toolTipText=Allows you to select a folder to disconnect
49
GeneralOptionsPanel.btnAdd.text=&Add...
50
LBL_DisconnectingFolder.title=Disconnecting Folder
51
52
HistoryOptions.displayName=History
41
HistoryOptions.displayName=History
53
HistoryOptions.toolTip=History Options
42
HistoryOptions.toolTip=History Options
54
ACSN_LocalHistoryOptionsPanel.daysTextField.text=Keep Local History Files
43
ACSN_LocalHistoryOptionsPanel.daysTextField.text=Keep Local History Files
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralAdvancedOption.java (-68 lines)
Lines 1-68 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.versioning.ui.options;
46
47
import org.netbeans.spi.options.AdvancedOption;
48
import org.netbeans.spi.options.OptionsPanelController;
49
import org.openide.util.NbBundle;
50
51
public final class GeneralAdvancedOption extends AdvancedOption {
52
    
53
    @Override
54
    public String getDisplayName() {
55
        return NbBundle.getMessage(GeneralAdvancedOption.class, "AdvancedOption_DisplayName"); // NOI18N
56
    }
57
    
58
    @Override
59
    public String getTooltip() {
60
        return NbBundle.getMessage(GeneralAdvancedOption.class, "AdvancedOption_Tooltip"); // NOI18N
61
    }
62
    
63
    @Override
64
    public OptionsPanelController create() {
65
        return new GeneralOptionsPanelController();
66
    }
67
    
68
}
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanelController.java (-141 lines)
Lines 1-141 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.versioning.ui.options;
46
47
import java.beans.PropertyChangeListener;
48
import java.beans.PropertyChangeSupport;
49
import java.util.HashSet;
50
import java.util.List;
51
import java.util.Set;
52
import javax.swing.JComponent;
53
import org.netbeans.modules.versioning.util.VCSOptionsKeywordsProvider;
54
import org.netbeans.spi.options.OptionsPanelController;
55
import org.openide.util.HelpCtx;
56
import org.openide.util.Lookup;
57
58
final class GeneralOptionsPanelController extends OptionsPanelController implements VCSOptionsKeywordsProvider {
59
    
60
    private GeneralOptionsPanel panel;
61
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
62
    private boolean changed;
63
    
64
    public GeneralOptionsPanelController() { }
65
66
    @Override
67
    public void update() {
68
        getPanel().load();
69
        changed = false;
70
    }
71
    
72
    @Override
73
    public void applyChanges() {
74
        if (!validateFields()) return;
75
        getPanel().store();        
76
        changed = false;
77
    }
78
    
79
    @Override
80
    public void cancel() {
81
        // need not do anything special, if no changes have been persisted yet
82
    }
83
    
84
    @Override
85
    public boolean isValid() {
86
        return getPanel().valid();
87
    }
88
    
89
    @Override
90
    public boolean isChanged() {
91
        return changed;
92
    }
93
    
94
    @Override
95
    public HelpCtx getHelpCtx() {
96
        return new HelpCtx(OptionsPanelController.class);
97
    }
98
    
99
    @Override
100
    public JComponent getComponent(Lookup masterLookup) {
101
        return getPanel();
102
    }
103
    
104
    @Override
105
    public void addPropertyChangeListener(PropertyChangeListener l) {
106
        pcs.addPropertyChangeListener(l);
107
    }
108
    
109
    @Override
110
    public void removePropertyChangeListener(PropertyChangeListener l) {
111
        pcs.removePropertyChangeListener(l);
112
    }            
113
114
    @Override
115
    public boolean acceptKeywords (List<String> keywords) {
116
        Set<String> allKeywords = new HashSet<String>(panel.getKeywords());
117
        allKeywords.retainAll(keywords);
118
        return !allKeywords.isEmpty();
119
    }
120
121
    private Boolean validateFields() {
122
        
123
        return true;
124
    }
125
126
    private GeneralOptionsPanel getPanel() {
127
        if (panel == null) {
128
            panel = new GeneralOptionsPanel(this);
129
        }
130
        return panel;
131
    }
132
    
133
    void changed() {
134
        if (!changed) {
135
            changed = true;
136
            pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
137
        }
138
        pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
139
    }
140
 
141
}
(-)a/versioning.util/src/org/netbeans/modules/versioning/util/DisconnectedRepositoriesManager.java (+229 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2013 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.versioning.util;
43
44
import java.beans.PropertyChangeListener;
45
import java.beans.PropertyChangeSupport;
46
import java.util.HashMap;
47
import java.util.HashSet;
48
import java.util.Iterator;
49
import java.util.LinkedList;
50
import java.util.List;
51
import java.util.Map;
52
import java.util.Set;
53
import java.util.logging.Level;
54
import java.util.logging.Logger;
55
import java.util.prefs.Preferences;
56
import javax.swing.JPanel;
57
import org.netbeans.modules.versioning.spi.VersioningSupport;
58
import org.netbeans.modules.versioning.util.options.DisconnectedRepositoriesPanel;
59
import org.openide.util.NbPreferences;
60
61
/**
62
 *
63
 * @author Ondrej Vrabec
64
 */
65
public final class DisconnectedRepositoriesManager {
66
    
67
    private static DisconnectedRepositoriesManager instance;
68
    private static final Logger LOG = Logger.getLogger(DisconnectedRepositoriesManager.class.getName());
69
    private final Map<String, Set<String>> allDisconnectedRepositories;
70
    private static final String SEP = "###"; //NOI18N
71
    private static final String PREF_KEY = "disconnectedFolders"; //NOI18N
72
    public static final String PROP_CONNECTED_ROOTS_CHANGED = "versioning.util.connectedRoots"; //NOI18N
73
    private final PropertyChangeSupport support;
74
75
    private DisconnectedRepositoriesManager () {
76
        allDisconnectedRepositories = initializeDisconnectedRepositories();
77
        support = new PropertyChangeSupport(this);
78
    }
79
    
80
    public static synchronized DisconnectedRepositoriesManager getInstance () {
81
        if (instance == null) {
82
            instance = new DisconnectedRepositoriesManager();
83
        }
84
        return instance;
85
    }
86
    
87
    /**
88
     * Stop managing the given path by the given versioning system
89
     * 
90
     * @param versioningSystem the versioning system to stop manage for the given path
91
     * @param absolutePath the path to stop managed by the given versioning system
92
     * @see #connectRepository(org.netbeans.modules.versioning.core.util.VCSSystemProvider.VersioningSystem, java.lang.String) 
93
     */
94
    public void disconnectRepository(String versioningSystemKey, String absolutePath) {
95
        synchronized (allDisconnectedRepositories) {
96
            Set<String> disconnectedRepos = allDisconnectedRepositories.get(versioningSystemKey);
97
            if (disconnectedRepos == null) {
98
                disconnectedRepos = new HashSet<String>();
99
                allDisconnectedRepositories.put(versioningSystemKey, disconnectedRepos);
100
            }
101
            boolean added = disconnectedRepos.add(absolutePath);
102
            if (!added) {
103
                LOG.log(Level.FINE, "disconnectRepository: Repository already disconnected for {0}: {1}", new Object[] { versioningSystemKey, absolutePath }); //NOI18N
104
            } else {
105
                saveDisconnectedRepositories();
106
                VersioningSupport.versionedRootsChanged();
107
                support.firePropertyChange(PROP_CONNECTED_ROOTS_CHANGED, null, absolutePath);
108
            }
109
        }
110
    }
111
112
    /**
113
     * Start again to manage the given path by the given versioning system
114
     * 
115
     * @param versioningSystem the versioning system to stop manage for the given path
116
     * @param absolutePath the path to stop managed by the given versioning system
117
     * @see #disconnectRepository(org.netbeans.modules.versioning.core.util.VCSSystemProvider.VersioningSystem, java.lang.String) 
118
     */
119
    public void connectRepository(String versioningSystemKey, String absolutePath) {
120
        synchronized (allDisconnectedRepositories) {
121
            Set<String> disconnectedRepos = allDisconnectedRepositories.get(versioningSystemKey);
122
            if (disconnectedRepos != null) {
123
                boolean changed = false;
124
                for (Iterator<String> it = disconnectedRepos.iterator(); it.hasNext(); ) {
125
                    String disconnectedRepository = it.next();
126
                    if (disconnectedRepository.equals(absolutePath)) {
127
                        LOG.log(Level.FINE, "connectRepository: Connecting repository to {0}: {1}", new Object[] { versioningSystemKey, absolutePath }); //NOI18N
128
                        it.remove();
129
                        changed = true;
130
                        break;
131
                    }
132
                }
133
                if (changed) {
134
                    saveDisconnectedRepositories();
135
                    VersioningSupport.versionedRootsChanged();
136
                    support.firePropertyChange(PROP_CONNECTED_ROOTS_CHANGED, null, absolutePath);
137
                }
138
            }
139
        }
140
    }
141
142
    /**
143
     * Returns all paths marked as not to managed by the given system
144
     * 
145
     * @param versioningSystem the versioning system 
146
     * @return path not managed by the given versioning system
147
     */
148
    public String[] getDisconnectedRoots (String versioningSystemKey) {
149
        String[] paths;
150
        synchronized (allDisconnectedRepositories) {
151
            Set<String> disconnectedRepos = allDisconnectedRepositories.get(versioningSystemKey);
152
            if (disconnectedRepos == null) {
153
                paths = new String[0];
154
            } else {
155
                paths = disconnectedRepos.toArray(new String[disconnectedRepos.size()]);
156
            }
157
        }
158
        return paths;
159
    }
160
    
161
    /**
162
     * Tests whether the given repository is disconnected from the given versioning system. 
163
     * @param vs
164
     * @param repository
165
     * @return 
166
     */
167
    public boolean isDisconnected (String key, String path) {
168
        boolean disconnected = false;
169
        synchronized (allDisconnectedRepositories) {
170
            Set<String> disconnectedRepositories = allDisconnectedRepositories.get(key);
171
            if (disconnectedRepositories != null) {
172
                for (String disconnectedRepository : disconnectedRepositories) {
173
                    if (disconnectedRepository.equals(path)) {
174
                        disconnected = true;
175
                        LOG.log(Level.FINE, "isDisconnected: Folder is disconnected from {0}: {1}, disconnected root: {2}", new Object[] { key, path, disconnectedRepository }); //NOI18N
176
                        break;
177
                    }
178
                }
179
            }
180
        }
181
        return disconnected;
182
    }
183
    
184
    public JPanel getOptionsPanel (String versioningSystemKey) {
185
        return new DisconnectedRepositoriesPanel(versioningSystemKey);
186
    }
187
    
188
    public void addPropertyChangeListener (PropertyChangeListener list) {
189
        support.addPropertyChangeListener(list);
190
    }
191
    
192
    public void removePropertyChangeListener (PropertyChangeListener list) {
193
        support.removePropertyChangeListener(list);
194
    }
195
196
    private static Map<String, Set<String>> initializeDisconnectedRepositories () {
197
        Map<String, Set<String>> disconnectedFolders = new HashMap<String, Set<String>>(5);
198
        List<String> list = Utils.getStringList(getPrefs(), PREF_KEY);
199
        for (String s : list) {
200
            String[] disconnectedFolder = s.split(SEP);
201
            if (disconnectedFolder.length == 2) {
202
                Set<String> files = disconnectedFolders.get(disconnectedFolder[0]);
203
                if (files == null) {
204
                    files = new HashSet<String>();
205
                    disconnectedFolders.put(disconnectedFolder[0], files);
206
                }
207
                files.add(disconnectedFolder[1]);
208
            }
209
        }
210
        return disconnectedFolders;
211
    }
212
213
    private void saveDisconnectedRepositories () {
214
        List<String> list = new LinkedList<String>();
215
        synchronized (allDisconnectedRepositories) {
216
            for (Map.Entry<String, Set<String>> e : allDisconnectedRepositories.entrySet()) {
217
                String vsKey = e.getKey();
218
                for (String f : e.getValue()) {
219
                    list.add(vsKey + SEP + f);
220
                }
221
            }
222
        }
223
        Utils.put(getPrefs(), PREF_KEY, list);
224
    }
225
    
226
    private static Preferences getPrefs () {
227
        return NbPreferences.forModule(DisconnectedRepositoriesManager.class);
228
    }
229
}
(-)a/versioning.util/src/org/netbeans/modules/versioning/util/options/Bundle.properties (+5 lines)
Lines 45-47 Link Here
45
AnnotationColorsPanel.btnResetToDefaults.TTtext=Resets colors to their default values
45
AnnotationColorsPanel.btnResetToDefaults.TTtext=Resets colors to their default values
46
46
47
KW_AnnotationColorsPanel=versioning, colors
47
KW_AnnotationColorsPanel=versioning, colors
48
DisconnectedRepositoriesPanel.jLabel2.text=Disconnected &Folders
49
DisconnectedRepositoriesPanel.btnRemove.text=&Remove
50
DisconnectedRepositoriesPanel.btnRemove.TTtext=Removes selected folder from the list of disconnected folders and reconnects the folder to the selected version control system
51
DisconnectedRepositoriesPanel.btnAdd.text=&Add...
52
DisconnectedRepositoriesPanel.btnAdd.toolTipText=Allows you to select a folder to disconnect
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.form (-63 / +12 lines)
Lines 17-46 Link Here
17
    <DimensionLayout dim="0">
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
20
              <EmptySpace min="-2" max="-2" attributes="0"/>
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="0" attributes="0">
21
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Group type="102" attributes="0">
22
                  <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
23
                      <EmptySpace min="12" pref="12" max="-2" attributes="0"/>
23
                  <Group type="102" alignment="0" attributes="0">
24
                      <Group type="103" groupAlignment="0" attributes="0">
24
                      <Component id="btnRemove" min="-2" max="-2" attributes="0"/>
25
                          <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
25
                      <EmptySpace max="-2" attributes="0"/>
26
                          <Group type="102" alignment="0" attributes="0">
26
                      <Component id="btnAdd" min="-2" max="-2" attributes="0"/>
27
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
28
                              <EmptySpace max="-2" attributes="0"/>
29
                              <Component id="cmbVersioningSystems" min="-2" max="-2" attributes="0"/>
30
                          </Group>
31
                          <Group type="102" alignment="0" attributes="0">
32
                              <Component id="btnRemove" min="-2" max="-2" attributes="0"/>
33
                              <EmptySpace max="-2" attributes="0"/>
34
                              <Component id="btnAdd" min="-2" max="-2" attributes="0"/>
35
                          </Group>
36
                          <Component id="jScrollPane1" alignment="0" max="32767" attributes="2"/>
37
                      </Group>
38
                  </Group>
27
                  </Group>
39
                  <Group type="102" attributes="0">
28
                  <Component id="jScrollPane1" alignment="0" pref="533" max="32767" attributes="2"/>
40
                      <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
41
                      <EmptySpace min="-2" max="-2" attributes="0"/>
42
                      <Component id="jSeparator1" max="32767" attributes="0"/>
43
                  </Group>
44
              </Group>
29
              </Group>
45
              <EmptySpace max="-2" attributes="0"/>
30
              <EmptySpace max="-2" attributes="0"/>
46
          </Group>
31
          </Group>
Lines 49-65 Link Here
49
    <DimensionLayout dim="1">
34
    <DimensionLayout dim="1">
50
      <Group type="103" groupAlignment="0" attributes="0">
35
      <Group type="103" groupAlignment="0" attributes="0">
51
          <Group type="102" alignment="0" attributes="0">
36
          <Group type="102" alignment="0" attributes="0">
52
              <EmptySpace min="-2" max="-2" attributes="0"/>
53
              <Group type="103" groupAlignment="1" attributes="0">
54
                  <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
55
                  <Component id="jSeparator1" min="-2" pref="4" max="-2" attributes="0"/>
56
              </Group>
57
              <EmptySpace max="-2" attributes="0"/>
37
              <EmptySpace max="-2" attributes="0"/>
58
              <Group type="103" groupAlignment="3" attributes="0">
59
                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
60
                  <Component id="cmbVersioningSystems" alignment="3" min="-2" max="-2" attributes="0"/>
61
              </Group>
62
              <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
63
              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
38
              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
64
              <EmptySpace max="-2" attributes="0"/>
39
              <EmptySpace max="-2" attributes="0"/>
65
              <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
40
              <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
Lines 74-103 Link Here
74
    </DimensionLayout>
49
    </DimensionLayout>
75
  </Layout>
50
  </Layout>
76
  <SubComponents>
51
  <SubComponents>
77
    <Component class="javax.swing.JLabel" name="jLabel1">
78
      <Properties>
79
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
80
          <ComponentRef name="cmbVersioningSystems"/>
81
        </Property>
82
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
83
          <ResourceString bundle="org/netbeans/modules/versioning/ui/options/Bundle.properties" key="GeneralOptionsPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
84
        </Property>
85
      </Properties>
86
    </Component>
87
    <Component class="javax.swing.JComboBox" name="cmbVersioningSystems">
88
      <Properties>
89
        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
90
          <StringArray count="0"/>
91
        </Property>
92
      </Properties>
93
    </Component>
94
    <Component class="javax.swing.JLabel" name="jLabel2">
52
    <Component class="javax.swing.JLabel" name="jLabel2">
95
      <Properties>
53
      <Properties>
96
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
54
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
97
          <ComponentRef name="lstDisconnectedFolders"/>
55
          <ComponentRef name="lstDisconnectedFolders"/>
98
        </Property>
56
        </Property>
99
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
57
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
100
          <ResourceString bundle="org/netbeans/modules/versioning/ui/options/Bundle.properties" key="GeneralOptionsPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
58
          <ResourceString bundle="org/netbeans/modules/versioning/util/options/Bundle.properties" key="DisconnectedRepositoriesPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
101
        </Property>
59
        </Property>
102
      </Properties>
60
      </Properties>
103
    </Component>
61
    </Component>
Lines 120-150 Link Here
120
    <Component class="javax.swing.JButton" name="btnRemove">
78
    <Component class="javax.swing.JButton" name="btnRemove">
121
      <Properties>
79
      <Properties>
122
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
80
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
123
          <ResourceString bundle="org/netbeans/modules/versioning/ui/options/Bundle.properties" key="GeneralOptionsPanel.btnRemove.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
81
          <ResourceString bundle="org/netbeans/modules/versioning/util/options/Bundle.properties" key="DisconnectedRepositoriesPanel.btnRemove.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
124
        </Property>
82
        </Property>
125
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
83
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
126
          <ResourceString bundle="org/netbeans/modules/versioning/options/Bundle.properties" key="GeneralOptionsPanel.btnRemove.TTtext" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
84
          <ResourceString bundle="org/netbeans/modules/versioning/util/options/Bundle.properties" key="DisconnectedRepositoriesPanel.btnRemove.TTtext" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
127
        </Property>
85
        </Property>
128
      </Properties>
86
      </Properties>
129
    </Component>
87
    </Component>
130
    <Component class="javax.swing.JButton" name="btnAdd">
88
    <Component class="javax.swing.JButton" name="btnAdd">
131
      <Properties>
89
      <Properties>
132
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
90
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
133
          <ResourceString bundle="org/netbeans/modules/versioning/ui/options/Bundle.properties" key="GeneralOptionsPanel.btnAdd.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
91
          <ResourceString bundle="org/netbeans/modules/versioning/util/options/Bundle.properties" key="DisconnectedRepositoriesPanel.btnAdd.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
134
        </Property>
92
        </Property>
135
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
93
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
136
          <ResourceString bundle="org/netbeans/modules/versioning/ui/options/Bundle.properties" key="GeneralOptionsPanel.btnAdd.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
94
          <ResourceString bundle="org/netbeans/modules/versioning/util/options/Bundle.properties" key="DisconnectedRepositoriesPanel.btnAdd.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
137
        </Property>
95
        </Property>
138
      </Properties>
96
      </Properties>
139
    </Component>
97
    </Component>
140
    <Component class="javax.swing.JLabel" name="jLabel3">
141
      <Properties>
142
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
143
          <ResourceString bundle="org/netbeans/modules/versioning/ui/options/Bundle.properties" key="LBL_OptionsPanel.disconnectedFolders.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
144
        </Property>
145
      </Properties>
146
    </Component>
147
    <Component class="javax.swing.JSeparator" name="jSeparator1">
148
    </Component>
149
  </SubComponents>
98
  </SubComponents>
150
</Form>
99
</Form>
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.java (-158 / +30 lines)
Lines 42-123 Link Here
42
 * made subject to such option by the copyright holder.
42
 * made subject to such option by the copyright holder.
43
 */
43
 */
44
44
45
package org.netbeans.modules.versioning.ui.options;
45
package org.netbeans.modules.versioning.util.options;
46
46
47
import java.awt.Component;
48
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionListener;
48
import java.awt.event.ActionListener;
50
import java.io.File;
49
import java.io.File;
51
import java.util.Arrays;
52
import java.util.Collection;
53
import java.util.Collections;
54
import java.util.LinkedList;
55
import java.util.List;
56
import javax.swing.DefaultComboBoxModel;
57
import javax.swing.DefaultListCellRenderer;
58
import javax.swing.DefaultListModel;
50
import javax.swing.DefaultListModel;
59
import javax.swing.JList;
51
import org.netbeans.modules.versioning.util.DisconnectedRepositoriesManager;
60
import org.netbeans.api.options.OptionsDisplayer;
61
import org.netbeans.modules.versioning.core.util.VCSSystemProvider.VersioningSystem;
62
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
63
import org.netbeans.modules.versioning.core.util.Utils;
64
import org.netbeans.spi.options.OptionsPanelController;
65
import org.openide.filesystems.FileChooserBuilder;
52
import org.openide.filesystems.FileChooserBuilder;
66
import org.openide.util.Lookup;
67
import org.openide.util.NbBundle;
53
import org.openide.util.NbBundle;
68
import org.openide.util.RequestProcessor;
69
54
70
@OptionsPanelController.Keywords(keywords={"#GeneralOptionsPanel.kw1", "#GeneralOptionsPanel.kw3", "#GeneralOptionsPanel.kw3"}, location=OptionsDisplayer.ADVANCED, tabTitle="#CTL_OptionsPanel.tabName")
55
public final class DisconnectedRepositoriesPanel extends javax.swing.JPanel implements ActionListener {
71
@NbBundle.Messages({
56
    private final String key;
72
    "CTL_OptionsPanel.tabName=Versioning",
73
    "GeneralOptionsPanel.kw1=general",
74
    "GeneralOptionsPanel.kw2=versioning",
75
    "GeneralOptionsPanel.kw3=disconnected repositories"
76
})
77
final class GeneralOptionsPanel extends javax.swing.JPanel implements ActionListener {
78
    
57
    
79
    private final GeneralOptionsPanelController controller;
58
    public DisconnectedRepositoriesPanel (String versioningSystemKey) {
80
    private String[] keywords;
59
        this.key = versioningSystemKey;
81
    
82
    GeneralOptionsPanel (GeneralOptionsPanelController controller) {
83
        this.controller = controller;        
84
        initComponents();
60
        initComponents();
85
        cmbVersioningSystems.setRenderer(new Renderer());
86
        cmbVersioningSystems.addActionListener(this);
87
        btnRemove.addActionListener(this);
61
        btnRemove.addActionListener(this);
88
        btnAdd.addActionListener(this);
62
        btnAdd.addActionListener(this);
89
    }
63
        fillDisconnectedFolders ();
90
    
91
    @Override
92
    public void addNotify() {
93
        super.addNotify();        
94
    }
95
96
    @Override
97
    public void removeNotify() {        
98
        super.removeNotify();
99
    }
100
101
    Collection<String> getKeywords () {
102
        if (keywords == null) {
103
            keywords = new String[] {
104
                Bundle.GeneralOptionsPanel_kw1().toUpperCase(),
105
                Bundle.GeneralOptionsPanel_kw2().toUpperCase(),
106
                Bundle.GeneralOptionsPanel_kw3().toUpperCase()
107
            };
108
        }
109
        return Collections.unmodifiableList(Arrays.asList(keywords));
110
    }
64
    }
111
65
112
    private void fillDisconnectedFolders () {
66
    private void fillDisconnectedFolders () {
113
        if (cmbVersioningSystems.getSelectedItem() instanceof VersioningSystem) {
67
        String[] disconnected = DisconnectedRepositoriesManager.getInstance().getDisconnectedRoots(key);
114
            String[] disconnected = Utils.getDisconnectedRoots(((VersioningSystem) cmbVersioningSystems.getSelectedItem()));
68
        DefaultListModel model = new DefaultListModel();
115
            DefaultListModel model = new DefaultListModel();
69
        for (String f : disconnected) {
116
            for (String f : disconnected) {
70
            model.addElement(f);
117
                model.addElement(f);
118
            }
119
            lstDisconnectedFolders.setModel(model);
120
        }
71
        }
72
        lstDisconnectedFolders.setModel(model);
121
    }
73
    }
122
74
123
    /** This method is called from within the constructor to
75
    /** This method is called from within the constructor to
Lines 128-158 Link Here
128
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
80
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
129
    private void initComponents() {
81
    private void initComponents() {
130
82
131
        jLabel1 = new javax.swing.JLabel();
132
        cmbVersioningSystems = new javax.swing.JComboBox();
133
        jLabel2 = new javax.swing.JLabel();
83
        jLabel2 = new javax.swing.JLabel();
134
        jScrollPane1 = new javax.swing.JScrollPane();
84
        jScrollPane1 = new javax.swing.JScrollPane();
135
        lstDisconnectedFolders = new javax.swing.JList();
85
        lstDisconnectedFolders = new javax.swing.JList();
136
        btnRemove = new javax.swing.JButton();
86
        btnRemove = new javax.swing.JButton();
137
        btnAdd = new javax.swing.JButton();
87
        btnAdd = new javax.swing.JButton();
138
        jLabel3 = new javax.swing.JLabel();
139
        jSeparator1 = new javax.swing.JSeparator();
140
141
        jLabel1.setLabelFor(cmbVersioningSystems);
142
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.jLabel1.text")); // NOI18N
143
88
144
        jLabel2.setLabelFor(lstDisconnectedFolders);
89
        jLabel2.setLabelFor(lstDisconnectedFolders);
145
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.jLabel2.text")); // NOI18N
90
        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(DisconnectedRepositoriesPanel.class, "DisconnectedRepositoriesPanel.jLabel2.text")); // NOI18N
146
91
147
        jScrollPane1.setViewportView(lstDisconnectedFolders);
92
        jScrollPane1.setViewportView(lstDisconnectedFolders);
148
93
149
        org.openide.awt.Mnemonics.setLocalizedText(btnRemove, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.btnRemove.text")); // NOI18N
94
        org.openide.awt.Mnemonics.setLocalizedText(btnRemove, org.openide.util.NbBundle.getMessage(DisconnectedRepositoriesPanel.class, "DisconnectedRepositoriesPanel.btnRemove.text")); // NOI18N
150
        btnRemove.setToolTipText(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.btnRemove.TTtext")); // NOI18N
95
        btnRemove.setToolTipText(org.openide.util.NbBundle.getMessage(DisconnectedRepositoriesPanel.class, "DisconnectedRepositoriesPanel.btnRemove.TTtext")); // NOI18N
151
96
152
        org.openide.awt.Mnemonics.setLocalizedText(btnAdd, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.btnAdd.text")); // NOI18N
97
        org.openide.awt.Mnemonics.setLocalizedText(btnAdd, org.openide.util.NbBundle.getMessage(DisconnectedRepositoriesPanel.class, "DisconnectedRepositoriesPanel.btnAdd.text")); // NOI18N
153
        btnAdd.setToolTipText(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.btnAdd.toolTipText")); // NOI18N
98
        btnAdd.setToolTipText(org.openide.util.NbBundle.getMessage(DisconnectedRepositoriesPanel.class, "DisconnectedRepositoriesPanel.btnAdd.toolTipText")); // NOI18N
154
155
        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "LBL_OptionsPanel.disconnectedFolders.title")); // NOI18N
156
99
157
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
100
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
158
        this.setLayout(layout);
101
        this.setLayout(layout);
Lines 161-197 Link Here
161
            .addGroup(layout.createSequentialGroup()
104
            .addGroup(layout.createSequentialGroup()
162
                .addContainerGap()
105
                .addContainerGap()
163
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
106
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
107
                    .addComponent(jLabel2)
164
                    .addGroup(layout.createSequentialGroup()
108
                    .addGroup(layout.createSequentialGroup()
165
                        .addGap(12, 12, 12)
109
                        .addComponent(btnRemove)
166
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
167
                            .addComponent(jLabel2)
168
                            .addGroup(layout.createSequentialGroup()
169
                                .addComponent(jLabel1)
170
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
171
                                .addComponent(cmbVersioningSystems, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
172
                            .addGroup(layout.createSequentialGroup()
173
                                .addComponent(btnRemove)
174
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
175
                                .addComponent(btnAdd))
176
                            .addComponent(jScrollPane1)))
177
                    .addGroup(layout.createSequentialGroup()
178
                        .addComponent(jLabel3)
179
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
110
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
180
                        .addComponent(jSeparator1)))
111
                        .addComponent(btnAdd))
112
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 533, Short.MAX_VALUE))
181
                .addContainerGap())
113
                .addContainerGap())
182
        );
114
        );
183
        layout.setVerticalGroup(
115
        layout.setVerticalGroup(
184
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
185
            .addGroup(layout.createSequentialGroup()
117
            .addGroup(layout.createSequentialGroup()
186
                .addContainerGap()
118
                .addContainerGap()
187
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
188
                    .addComponent(jLabel3)
189
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE))
190
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
191
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
192
                    .addComponent(jLabel1)
193
                    .addComponent(cmbVersioningSystems, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
194
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
195
                .addComponent(jLabel2)
119
                .addComponent(jLabel2)
196
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
120
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
197
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
121
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
Lines 202-282 Link Here
202
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
126
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
203
        );
127
        );
204
    }// </editor-fold>//GEN-END:initComponents
128
    }// </editor-fold>//GEN-END:initComponents
205
206
    void load () {
207
        fillVersioningSystems();
208
    }
209
    
210
    void store() {
211
        
212
    }
213
    
214
    boolean valid() {
215
        return true;
216
    }
217
 
129
 
218
    // Variables declaration - do not modify//GEN-BEGIN:variables
130
    // Variables declaration - do not modify//GEN-BEGIN:variables
219
    private javax.swing.JButton btnAdd;
131
    private javax.swing.JButton btnAdd;
220
    private javax.swing.JButton btnRemove;
132
    private javax.swing.JButton btnRemove;
221
    private javax.swing.JComboBox cmbVersioningSystems;
222
    private javax.swing.JLabel jLabel1;
223
    private javax.swing.JLabel jLabel2;
133
    private javax.swing.JLabel jLabel2;
224
    private javax.swing.JLabel jLabel3;
225
    private javax.swing.JScrollPane jScrollPane1;
134
    private javax.swing.JScrollPane jScrollPane1;
226
    private javax.swing.JSeparator jSeparator1;
227
    private javax.swing.JList lstDisconnectedFolders;
135
    private javax.swing.JList lstDisconnectedFolders;
228
    // End of variables declaration//GEN-END:variables
136
    // End of variables declaration//GEN-END:variables
229
137
230
    private void fillVersioningSystems () {
231
        List<VersioningSystem> systems = new LinkedList<VersioningSystem>();
232
        for (VersioningSystem system : Lookup.getDefault().lookupAll(VersioningSystem.class)) {
233
            systems.add(system);
234
        }
235
        cmbVersioningSystems.setModel(new DefaultComboBoxModel(systems.toArray(new VersioningSystem[systems.size()])));
236
    }
237
238
    @Override
138
    @Override
139
    @NbBundle.Messages("LBL_DisconnectingFolder.title=Disconnecting Folder")
239
    public void actionPerformed (ActionEvent e) {
140
    public void actionPerformed (ActionEvent e) {
240
        if (e.getSource() == cmbVersioningSystems) {
141
        if (e.getSource() == btnRemove) {
142
            String f = (String) lstDisconnectedFolders.getSelectedValue();
143
            DisconnectedRepositoriesManager.getInstance().connectRepository(key, f);
241
            fillDisconnectedFolders();
144
            fillDisconnectedFolders();
242
        } else if (e.getSource() == btnRemove) {
145
        } else if (e.getSource() == btnAdd) {
243
            if (cmbVersioningSystems.getSelectedItem() instanceof VersioningSystem && lstDisconnectedFolders.getSelectedValue() != null) {
146
            File f = new FileChooserBuilder("VersioningOptions.disconnected").setTitle(Bundle.LBL_DisconnectingFolder_title()) //NOI18N
244
                String f = (String) lstDisconnectedFolders.getSelectedValue();
147
                    .setDirectoriesOnly(true).setFileHiding(true).showOpenDialog();
245
                Utils.connectRepository((VersioningSystem) cmbVersioningSystems.getSelectedItem(), f);
148
            if (f != null) {
149
                DisconnectedRepositoriesManager.getInstance().disconnectRepository(key, f.getAbsolutePath());
246
                fillDisconnectedFolders();
150
                fillDisconnectedFolders();
247
                refreshSystems();
248
            }
249
        } else if (e.getSource() == btnAdd) {
250
            if (cmbVersioningSystems.getSelectedItem() instanceof VersioningSystem) {
251
                VersioningSystem vcs = (VersioningSystem) cmbVersioningSystems.getSelectedItem();
252
                File f = new FileChooserBuilder("VersioningOptions.disconnected").setTitle(NbBundle.getMessage(GeneralOptionsPanel.class, "LBL_DisconnectingFolder.title")) //NOI18N
253
                        .setDirectoriesOnly(true).setFileHiding(true).showOpenDialog();
254
                if (f != null && (vcs.getTopmostManagedAncestor(VCSFileProxy.createFileProxy(f)) != null)) {
255
                    Utils.disconnectRepository(vcs, f.getAbsolutePath());
256
                    fillDisconnectedFolders();
257
                    refreshSystems();
258
                }
259
            }
151
            }
260
        }
152
        }
261
    }
153
    }
262
263
    private void refreshSystems () {
264
        RequestProcessor.getDefault().post(new Runnable() {
265
            @Override
266
            public void run () {
267
                Utils.versionedRootsChanged();
268
            }
269
        }).schedule(100);
270
    }
271
    
272
    private static class Renderer extends DefaultListCellRenderer {
273
274
        @Override
275
        public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
276
            if (value instanceof VersioningSystem) {
277
                value = ((VersioningSystem) value).getDisplayName();
278
            }
279
            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
280
        }
281
    }
282
}
154
}
(-)a/versioning/src/org/netbeans/modules/versioning/Bundle.properties (-18 lines)
Lines 44-64 Link Here
44
OpenIDE-Module-Display-Category=Versioning
44
OpenIDE-Module-Display-Category=Versioning
45
OpenIDE-Module-Short-Description=Support module for Versioning systems.
45
OpenIDE-Module-Short-Description=Support module for Versioning systems.
46
OpenIDE-Module-Long-Description=Support module for Versioning systems.
46
OpenIDE-Module-Long-Description=Support module for Versioning systems.
47
48
Actions/Versioning=Versioning
49
Menu/Versioning=Tea&m
50
Menu/Window/Versioning=&Versioning
51
52
CTL_MenuItem_ShowTextAnnotations = Show &Versioning Labels
53
CTL_MenuItem_VersioningMenu = Versioning
54
CTL_MenuItem_LocalHistory=Local History
55
CTL_MenuItem_Initializing=Initializing...
56
57
CTL_DisconnectAction.name=Dis&connect...
58
CTL_ConnectAction.name=&Connect
59
CTL_ConnectAction.name.vcs=Connect To {0}
60
LBL_ConnectAction.confirmation.title=Disconnect From Version Control System
61
MSG_ConnectAction.confirmation.text=Do you want to disconnect {0} from {1}?\n\
62
The folder will no longer be controlled by {1} in the IDE.\n\n\
63
You will be able to reconnect the folder to the system\n\
64
with the Connect action available from the Main menu.

Return to bug 221525