Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 135672 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/netbeans/modules/mercurial/Bundle.properties (+4 lines)
 Lines 150-152    Link Here 
150
MSG_Fetch_50_Revisions = Fetch up to 50 Revisions...
150
MSG_Fetch_50_Revisions = Fetch up to 50 Revisions...
151
MSG_Fetch_All_Revisions = Fetch All Revisions...
151
MSG_Fetch_All_Revisions = Fetch All Revisions...
152
MSG_Fetching_Revisions = Fetching Revisions...
152
MSG_Fetching_Revisions = Fetching Revisions...
153
154
# Exception Handler
155
CTL_Action_OK = OK
156
CTL_ActionCanceled_Title = Action cancelled
(-)src/org/netbeans/modules/mercurial/HgProgressSupport.java (+29 lines)
 Lines 41-49    Link Here 
41
41
42
package org.netbeans.modules.mercurial;
42
package org.netbeans.modules.mercurial;
43
43
44
import java.awt.event.ActionEvent;
45
import java.awt.event.ActionListener;
44
import java.text.DateFormat;
46
import java.text.DateFormat;
45
import java.util.Date;
47
import java.util.Date;
46
import java.util.logging.Level;
48
import java.util.logging.Level;
49
import javax.swing.JComponent;
50
import javax.swing.JButton;
47
import org.netbeans.api.progress.ProgressHandle;
51
import org.netbeans.api.progress.ProgressHandle;
48
import org.netbeans.api.progress.ProgressHandleFactory;
52
import org.netbeans.api.progress.ProgressHandleFactory;
49
import org.openide.util.Cancellable;
53
import org.openide.util.Cancellable;
 Lines 67-72    Link Here 
67
    private String repositoryRoot;
71
    private String repositoryRoot;
68
    private RequestProcessor.Task task;
72
    private RequestProcessor.Task task;
69
    
73
    
74
    public HgProgressSupport() {
75
    }
76
77
    public HgProgressSupport(String displayName, JButton cancel) {
78
        this.displayName = displayName;
79
        if(cancel != null) {
80
            cancel.addActionListener(new ActionListener() {
81
                public void actionPerformed(ActionEvent e) {
82
                    cancel();
83
                }
84
            });
85
        }
86
    }
87
    
70
    public RequestProcessor.Task start(RequestProcessor rp, String repositoryRoot, String displayName) {
88
    public RequestProcessor.Task start(RequestProcessor rp, String repositoryRoot, String displayName) {
71
        setDisplayName(displayName);
89
        setDisplayName(displayName);
72
        this.repositoryRoot = repositoryRoot;
90
        this.repositoryRoot = repositoryRoot;
 Lines 81-86    Link Here 
81
        return task;
99
        return task;
82
    }
100
    }
83
101
102
    public RequestProcessor.Task start(RequestProcessor rp) {
103
        startProgress();
104
        task = rp.post(this);
105
        return task;
106
    }
107
108
    public JComponent getProgressComponent() {
109
        return ProgressHandleFactory.createProgressComponent(getProgressHandle()
110
);
111
    }
112
84
    public void setRepositoryRoot(String repositoryRoot) {
113
    public void setRepositoryRoot(String repositoryRoot) {
85
        this.repositoryRoot = repositoryRoot;
114
        this.repositoryRoot = repositoryRoot;
86
        logger = null;
115
        logger = null;
(-)src/org/netbeans/modules/mercurial/ui/commit/Bundle.properties (+2 lines)
 Lines 87-89    Link Here 
87
ACSD_CommitDialog=This dialog lets you review list files to commit, exclude or include individual files and write commit message describing your changes.
87
ACSD_CommitDialog=This dialog lets you review list files to commit, exclude or include individual files and write commit message describing your changes.
88
ACSN_CommitForm_Message=Commit Message
88
ACSN_CommitForm_Message=Commit Message
89
ACSD_CommitForm_Message=Message describing your commit
89
ACSD_CommitForm_Message=Message describing your commit
90
91
Progress_Preparing_Commit=Preparing Commit...
(-)src/org/netbeans/modules/mercurial/ui/commit/CommitAction.java (-49 / +69 lines)
 Lines 52-57    Link Here 
52
import org.netbeans.modules.mercurial.HgFileNode;
52
import org.netbeans.modules.mercurial.HgFileNode;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
import org.netbeans.modules.mercurial.ui.status.StatusAction;
55
import org.netbeans.modules.mercurial.util.HgUtils;
56
import org.netbeans.modules.mercurial.util.HgUtils;
56
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
57
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
57
import org.netbeans.modules.mercurial.util.HgProjectUtils;
58
import org.netbeans.modules.mercurial.util.HgProjectUtils;
 Lines 63-70    Link Here 
63
import javax.swing.*;
64
import javax.swing.*;
64
import java.awt.*;
65
import java.awt.*;
65
import java.io.File;
66
import java.io.File;
67
import java.util.logging.Level;
66
import java.util.ArrayList;
68
import java.util.ArrayList;
67
import java.util.List;
69
import java.util.List;
70
import java.util.Set;
68
import java.util.Iterator;
71
import java.util.Iterator;
69
import java.util.Map;
72
import java.util.Map;
70
import javax.swing.event.TableModelEvent;
73
import javax.swing.event.TableModelEvent;
 Lines 99-106    Link Here 
99
    }
102
    }
100
103
101
    public boolean isEnabled () {
104
    public boolean isEnabled () {
102
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
105
        Set<File> ctxFiles = context != null? context.getRootFiles(): null;
103
        return cache.containsFileOfStatus(context, FileInformation.STATUS_LOCAL_CHANGE);
106
        if(HgUtils.getRootFile(context) == null || ctxFiles == null || ctxFiles.size() == 0)
107
            return false;
108
        return true;
104
    }
109
    }
105
110
106
    public void performAction(ActionEvent e) {
111
    public void performAction(ActionEvent e) {
 Lines 125-136    Link Here 
125
    }
130
    }
126
131
127
    public static void commit(String contentTitle, final VCSContext ctx) {
132
    public static void commit(String contentTitle, final VCSContext ctx) {
128
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
129
        File[] roots = ctx.getRootFiles().toArray(new File[ctx.getRootFiles().size()]);
130
        if (roots == null || roots.length == 0) {
131
            return;
132
        }
133
134
        final File repository = HgUtils.getRootFile(ctx);
133
        final File repository = HgUtils.getRootFile(ctx);
135
        if (repository == null) return;
134
        if (repository == null) return;
136
        String projName = HgProjectUtils.getProjectName(repository);
135
        String projName = HgProjectUtils.getProjectName(repository);
 Lines 140-192    Link Here 
140
        } 
139
        } 
141
        final String prjName = projName;
140
        final String prjName = projName;
142
141
143
        File[][] split = Utils.splitFlatOthers(roots);
144
        List<File> fileList = new ArrayList<File>();
145
        for (int c = 0; c < split.length; c++) {
146
            roots = split[c];
147
            boolean recursive = c == 1;
148
            if (recursive) {
149
                File[] files = cache.listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE);
150
                for (int i= 0; i < files.length; i++) {
151
                    for(int r = 0; r < roots.length; r++) {
152
                        if( HgUtils.isParentOrEqual(roots[r], files[i]) ) {
153
                            if(!fileList.contains(files[i])) {
154
                                fileList.add(files[i]);
155
                            }
156
                        }
157
                    }
158
                }
159
            } else {
160
                File[] files = HgUtils.flatten(roots, FileInformation.STATUS_LOCAL_CHANGE);
161
                for (int i= 0; i<files.length; i++) {
162
                    if(!fileList.contains(files[i])) {
163
                        fileList.add(files[i]);
164
                    }
165
                }
166
            }
167
        }
168
        
169
        if(fileList.size()==0) {
170
            return;
171
        }
172
        
173
        // show commit dialog
142
        // show commit dialog
174
        final CommitPanel panel = new CommitPanel();
143
        final CommitPanel panel = new CommitPanel();
175
        final CommitTable data = new CommitTable(panel.filesLabel, CommitTable.COMMIT_COLUMNS, new String[] {CommitTableModel.COLUMN_NAME_PATH });
144
        final CommitTable data = new CommitTable(panel.filesLabel, CommitTable.COMMIT_COLUMNS, new String[] {CommitTableModel.COLUMN_NAME_PATH });
176
        
145
        
177
        panel.setCommitTable(data);
146
        panel.setCommitTable(data);
178
        
147
        
179
        HgFileNode[] nodes;
180
        ArrayList<HgFileNode> nodesList = new ArrayList<HgFileNode>(fileList.size());
181
        
182
        for (Iterator<File> it = fileList.iterator(); it.hasNext();) {
183
            File file = it.next();
184
            HgFileNode node = new HgFileNode(file);
185
            nodesList.add(node);
186
        }
187
        nodes = nodesList.toArray(new HgFileNode[fileList.size()]);
188
        data.setNodes(nodes);
189
        
190
        JComponent component = data.getComponent();
148
        JComponent component = data.getComponent();
191
        panel.filesPanel.setLayout(new BorderLayout());
149
        panel.filesPanel.setLayout(new BorderLayout());
192
        panel.filesPanel.add(component, BorderLayout.CENTER);
150
        panel.filesPanel.add(component, BorderLayout.CENTER);
 Lines 202-207    Link Here 
202
        cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CommitAction.class, "ACSN_Commit_Action_Cancel"));
160
        cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CommitAction.class, "ACSN_Commit_Action_Cancel"));
203
        cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CommitAction.class, "ACSD_Commit_Action_Cancel"));
161
        cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CommitAction.class, "ACSD_Commit_Action_Cancel"));
204
162
163
        computeNodes(data, panel, ctx, repository, cancelButton);
205
        commitButton.setEnabled(false);
164
        commitButton.setEnabled(false);
206
        dd.setOptions(new Object[] {commitButton, cancelButton});
165
        dd.setOptions(new Object[] {commitButton, cancelButton});
207
        dd.setHelpCtx(new HelpCtx(CommitAction.class));
166
        dd.setHelpCtx(new HelpCtx(CommitAction.class));
 Lines 241-246    Link Here 
241
        }
200
        }
242
    }
201
    }
243
202
203
    private static void computeNodes(final CommitTable table, final CommitPanel panel, final VCSContext ctx, final File repository, JButton cancel) {
204
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
205
        final HgProgressSupport support = new HgProgressSupport(NbBundle.getMessage(CommitAction.class, "Progress_Preparing_Commit"), cancel) {
206
            public void perform() {
207
                try {
208
                    panel.progressPanel.setVisible(true);
209
                    // Ensure that cache is uptodate
210
                    StatusAction.executeStatus(ctx, this);
211
212
                    FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
213
                    File[] roots = ctx.getRootFiles().toArray(new File[ctx.getRootFiles().size()]);
214
215
                    File[][] split = Utils.splitFlatOthers(roots);
216
                    List<File> fileList = new ArrayList<File>();
217
                    for (int c = 0; c < split.length; c++) {
218
                        roots = split[c];
219
                        boolean recursive = c == 1;
220
                        if (recursive) {
221
                            File[] files = cache.listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE);
222
                            for (int i= 0; i < files.length; i++) {
223
                                for(int r = 0; r < roots.length; r++) {
224
                                    if( HgUtils.isParentOrEqual(roots[r], files[i]) ) {
225
                                        if(!fileList.contains(files[i])) {
226
                                            fileList.add(files[i]);
227
                                        }
228
                                    }
229
                                }
230
                            }
231
                        } else {
232
                            File[] files = HgUtils.flatten(roots, FileInformation.STATUS_LOCAL_CHANGE);
233
                            for (int i= 0; i<files.length; i++) {
234
                                if(!fileList.contains(files[i])) {
235
                                    fileList.add(files[i]);
236
                                }
237
                            }
238
                        }
239
                    }
240
                    if(fileList.size()==0) {
241
                        return;
242
                    }
243
                
244
                    HgFileNode[] nodes;
245
                    ArrayList<HgFileNode> nodesList = new ArrayList<HgFileNode>(fileList.size());
246
        
247
                    for (Iterator<File> it = fileList.iterator(); it.hasNext();) {
248
                        File file = it.next();
249
                        HgFileNode node = new HgFileNode(file);
250
                        nodesList.add(node);
251
                    }
252
                    nodes = nodesList.toArray(new HgFileNode[fileList.size()]);
253
                    table.setNodes(nodes);
254
                } finally {
255
                    panel.progressPanel.setVisible(false);
256
                }
257
            }
258
        };
259
        panel.barPanel.add(support.getProgressComponent(), BorderLayout.CENTER);
260
        panel.barPanel.setVisible(true);
261
        support.start(rp);
262
    }
263
244
    private static boolean containsCommitable(CommitTable data) {
264
    private static boolean containsCommitable(CommitTable data) {
245
        Map<HgFileNode, CommitOptions> map = data.getCommitFiles();
265
        Map<HgFileNode, CommitOptions> map = data.getCommitFiles();
246
        for(CommitOptions co : map.values()) {
266
        for(CommitOptions co : map.values()) {
(-)src/org/netbeans/modules/mercurial/ui/commit/CommitPanel.form (-6 / +63 lines)
 Lines 31-48    Link Here 
31
    <DimensionLayout dim="0">
31
    <DimensionLayout dim="0">
32
      <Group type="103" groupAlignment="0" attributes="0">
32
      <Group type="103" groupAlignment="0" attributes="0">
33
          <Group type="102" alignment="1" attributes="0">
33
          <Group type="102" alignment="1" attributes="0">
34
              <Group type="103" groupAlignment="1" attributes="0">
35
                  <Group type="102" alignment="0" attributes="0">
36
                      <EmptySpace min="-2" pref="284" max="-2" attributes="0"/>
37
                      <Component id="progressPanel" max="32767" attributes="0"/>
38
                  </Group>
39
                  <Group type="102" alignment="1" attributes="0">
34
              <EmptySpace max="-2" attributes="0"/>
40
              <EmptySpace max="-2" attributes="0"/>
35
              <Group type="103" groupAlignment="1" attributes="0">
41
              <Group type="103" groupAlignment="1" attributes="0">
36
                  <Component id="filesPanel" alignment="0" pref="626" max="32767" attributes="0"/>
42
                          <Component id="filesPanel" alignment="1" pref="637" max="32767" attributes="0"/>
37
                  <Component id="jScrollPane1" alignment="0" pref="626" max="32767" attributes="0"/>
43
                          <Component id="jScrollPane1" alignment="0" pref="637" max="32767" attributes="0"/>
38
                  <Group type="102" alignment="0" attributes="0">
44
                  <Group type="102" alignment="0" attributes="0">
39
                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
45
                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
40
                      <EmptySpace pref="508" max="32767" attributes="0"/>
46
                              <EmptySpace pref="496" max="32767" attributes="0"/>
41
                      <Component id="recentLink" min="-2" max="-2" attributes="0"/>
47
                      <Component id="recentLink" min="-2" max="-2" attributes="0"/>
42
                  </Group>
48
                  </Group>
43
                  <Component id="filesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
49
                  <Component id="filesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
44
                  <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
50
                  <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
45
              </Group>
51
              </Group>
52
                  </Group>
53
              </Group>
46
              <EmptySpace max="-2" attributes="0"/>
54
              <EmptySpace max="-2" attributes="0"/>
47
          </Group>
55
          </Group>
48
      </Group>
56
      </Group>
 Lines 60-67    Link Here 
60
              <EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
68
              <EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
61
              <Component id="filesLabel" min="-2" max="-2" attributes="0"/>
69
              <Component id="filesLabel" min="-2" max="-2" attributes="0"/>
62
              <EmptySpace max="-2" attributes="0"/>
70
              <EmptySpace max="-2" attributes="0"/>
63
              <Component id="filesPanel" pref="196" max="32767" attributes="0"/>
71
              <Component id="filesPanel" min="-2" pref="181" max="-2" attributes="0"/>
64
              <EmptySpace max="-2" attributes="0"/>
72
              <EmptySpace max="-2" attributes="0"/>
73
              <Component id="progressPanel" min="-2" max="-2" attributes="0"/>
74
              <EmptySpace max="32767" attributes="0"/>
65
              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
75
              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
66
              <EmptySpace max="-2" attributes="0"/>
76
              <EmptySpace max="-2" attributes="0"/>
67
          </Group>
77
          </Group>
 Lines 125-136    Link Here 
125
      <Layout>
135
      <Layout>
126
        <DimensionLayout dim="0">
136
        <DimensionLayout dim="0">
127
          <Group type="103" groupAlignment="0" attributes="0">
137
          <Group type="103" groupAlignment="0" attributes="0">
128
              <EmptySpace min="0" pref="626" max="32767" attributes="0"/>
138
              <EmptySpace min="0" pref="637" max="32767" attributes="0"/>
129
          </Group>
139
          </Group>
130
        </DimensionLayout>
140
        </DimensionLayout>
131
        <DimensionLayout dim="1">
141
        <DimensionLayout dim="1">
132
          <Group type="103" groupAlignment="0" attributes="0">
142
          <Group type="103" groupAlignment="0" attributes="0">
133
              <EmptySpace min="0" pref="196" max="32767" attributes="0"/>
143
              <EmptySpace min="0" pref="181" max="32767" attributes="0"/>
134
          </Group>
144
          </Group>
135
        </DimensionLayout>
145
        </DimensionLayout>
136
      </Layout>
146
      </Layout>
 Lines 147-151    Link Here 
147
        </Property>
157
        </Property>
148
      </Properties>
158
      </Properties>
149
    </Component>
159
    </Component>
160
    <Container class="javax.swing.JPanel" name="progressPanel">
161
      <AuxValues>
162
        <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
163
      </AuxValues>
164
165
      <Layout>
166
        <DimensionLayout dim="0">
167
          <Group type="103" groupAlignment="0" attributes="0">
168
              <Group type="102" alignment="0" attributes="0">
169
                  <Component id="jLabel3" pref="163" max="32767" attributes="0"/>
170
                  <EmptySpace max="-2" attributes="0"/>
171
                  <Component id="barPanel" pref="190" max="32767" attributes="0"/>
172
              </Group>
173
          </Group>
174
        </DimensionLayout>
175
        <DimensionLayout dim="1">
176
          <Group type="103" groupAlignment="0" attributes="0">
177
              <Component id="jLabel3" alignment="1" pref="15" max="32767" attributes="0"/>
178
              <Component id="barPanel" alignment="1" pref="15" max="32767" attributes="0"/>
179
          </Group>
180
        </DimensionLayout>
181
      </Layout>
182
      <SubComponents>
183
        <Container class="javax.swing.JPanel" name="barPanel">
184
          <Properties>
185
            <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
186
              <Dimension value="[170, 10]"/>
187
            </Property>
188
            <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
189
              <Dimension value="[170, 10]"/>
190
            </Property>
191
          </Properties>
192
          <AuxValues>
193
            <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
194
          </AuxValues>
195
196
          <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
197
        </Container>
198
        <Component class="javax.swing.JLabel" name="jLabel3">
199
          <Properties>
200
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
201
              <ResourceString bundle="org/netbeans/modules/mercurial/ui/commit/Bundle.properties" key="Progress_Preparing_Commit" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
202
            </Property>
203
          </Properties>
204
        </Component>
150
  </SubComponents>
205
  </SubComponents>
206
    </Container>
207
  </SubComponents>
151
</Form>
208
</Form>
(-)src/org/netbeans/modules/mercurial/ui/commit/CommitPanel.java (-7 / +40 lines)
 Lines 158-188    Link Here 
158
        filesPanel.setLayout(filesPanelLayout);
158
        filesPanel.setLayout(filesPanelLayout);
159
        filesPanelLayout.setHorizontalGroup(
159
        filesPanelLayout.setHorizontalGroup(
160
            filesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
160
            filesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
161
            .add(0, 626, Short.MAX_VALUE)
161
            .add(0, 637, Short.MAX_VALUE)
162
        );
162
        );
163
        filesPanelLayout.setVerticalGroup(
163
        filesPanelLayout.setVerticalGroup(
164
            filesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
164
            filesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
165
            .add(0, 196, Short.MAX_VALUE)
165
            .add(0, 181, Short.MAX_VALUE)
166
        );
166
        );
167
167
168
        recentLink.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/mercurial/resources/icons/recent_messages.png"))); // NOI18N
168
        recentLink.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/mercurial/resources/icons/recent_messages.png"))); // NOI18N
169
        recentLink.setToolTipText(org.openide.util.NbBundle.getMessage(CommitPanel.class, "CTL_CommitForm_RecentMessages")); // NOI18N
169
        recentLink.setToolTipText(org.openide.util.NbBundle.getMessage(CommitPanel.class, "CTL_CommitForm_RecentMessages")); // NOI18N
170
170
171
        barPanel.setLayout(new java.awt.BorderLayout());
172
173
        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(CommitPanel.class, "Progress_Preparing_Commit")); // NOI18N
174
175
        org.jdesktop.layout.GroupLayout progressPanelLayout = new org.jdesktop.layout.GroupLayout(progressPanel);
176
        progressPanel.setLayout(progressPanelLayout);
177
        progressPanelLayout.setHorizontalGroup(
178
            progressPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
179
            .add(progressPanelLayout.createSequentialGroup()
180
                .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 142, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
181
                .addContainerGap(223, Short.MAX_VALUE))
182
            .add(progressPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
183
                .add(progressPanelLayout.createSequentialGroup()
184
                    .add(140, 140, 140)
185
                    .add(barPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)))
186
        );
187
        progressPanelLayout.setVerticalGroup(
188
            progressPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
189
            .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
190
            .add(progressPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
191
                .add(barPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))
192
        );
193
171
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
194
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
172
        this.setLayout(layout);
195
        this.setLayout(layout);
173
        layout.setHorizontalGroup(
196
        layout.setHorizontalGroup(
174
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
197
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
175
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
198
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
199
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
200
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
201
                        .add(284, 284, 284)
202
                        .add(progressPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
203
                    .add(layout.createSequentialGroup()
176
                .addContainerGap()
204
                .addContainerGap()
177
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
205
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
178
                    .add(org.jdesktop.layout.GroupLayout.LEADING, filesPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
206
                            .add(filesPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 637, Short.MAX_VALUE)
179
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
207
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 637, Short.MAX_VALUE)
180
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
208
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
181
                        .add(jLabel1)
209
                        .add(jLabel1)
182
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 508, Short.MAX_VALUE)
210
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 496, Short.MAX_VALUE)
183
                        .add(recentLink))
211
                        .add(recentLink))
184
                    .add(org.jdesktop.layout.GroupLayout.LEADING, filesLabel)
212
                    .add(org.jdesktop.layout.GroupLayout.LEADING, filesLabel)
185
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2))
213
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2))))
186
                .addContainerGap())
214
                .addContainerGap())
187
        );
215
        );
188
        layout.setVerticalGroup(
216
        layout.setVerticalGroup(
 Lines 197-204    Link Here 
197
                .add(15, 15, 15)
225
                .add(15, 15, 15)
198
                .add(filesLabel)
226
                .add(filesLabel)
199
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
227
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
200
                .add(filesPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)
228
                .add(filesPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
201
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
229
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
230
                .add(progressPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
231
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
202
                .add(jLabel2)
232
                .add(jLabel2)
203
                .addContainerGap())
233
                .addContainerGap())
204
        );
234
        );
 Lines 217-228    Link Here 
217
    }    
247
    }    
218
    
248
    
219
    // Variables declaration - do not modify//GEN-BEGIN:variables
249
    // Variables declaration - do not modify//GEN-BEGIN:variables
250
    final javax.swing.JPanel barPanel = new javax.swing.JPanel();
220
    final javax.swing.JLabel filesLabel = new javax.swing.JLabel();
251
    final javax.swing.JLabel filesLabel = new javax.swing.JLabel();
221
    final javax.swing.JPanel filesPanel = new javax.swing.JPanel();
252
    final javax.swing.JPanel filesPanel = new javax.swing.JPanel();
222
    final javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
253
    final javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
223
    final javax.swing.JLabel jLabel2 = new javax.swing.JLabel();
254
    final javax.swing.JLabel jLabel2 = new javax.swing.JLabel();
255
    final javax.swing.JLabel jLabel3 = new javax.swing.JLabel();
224
    final javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
256
    final javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
225
    final javax.swing.JTextArea messageTextArea = new javax.swing.JTextArea();
257
    final javax.swing.JTextArea messageTextArea = new javax.swing.JTextArea();
258
    final javax.swing.JPanel progressPanel = new javax.swing.JPanel();
226
    final javax.swing.JLabel recentLink = new javax.swing.JLabel();
259
    final javax.swing.JLabel recentLink = new javax.swing.JLabel();
227
    // End of variables declaration//GEN-END:variables
260
    // End of variables declaration//GEN-END:variables
228
    
261
    
(-)src/org/netbeans/modules/mercurial/ui/diff/DiffAction.java (-2 / +6 lines)
 Lines 46-51    Link Here 
46
import javax.swing.*;
46
import javax.swing.*;
47
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionEvent;
48
import java.io.File;
48
import java.io.File;
49
import java.util.Set;
49
50
50
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.FileStatusCache;
52
import org.netbeans.modules.mercurial.FileStatusCache;
 Lines 97-104    Link Here 
97
    }
98
    }
98
    
99
    
99
    public boolean isEnabled() {
100
    public boolean isEnabled() {
100
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
101
        Set<File> ctxFiles = context != null? context.getRootFiles(): null;
101
        return cache.containsFileOfStatus(context, FileInformation.STATUS_LOCAL_CHANGE);
102
        if(HgUtils.getRootFile(context) == null || ctxFiles == null || ctxFiles.
103
size() == 0)
104
            return false;
105
        return true;
102
    } 
106
    } 
103
107
104
    public static void diff(VCSContext ctx, int type, String contextName) {
108
    public static void diff(VCSContext ctx, int type, String contextName) {
(-)src/org/netbeans/modules/mercurial/ui/diff/MultiDiffPanel.java (+5 lines)
 Lines 143-148    Link Here 
143
        refreshSetups();
143
        refreshSetups();
144
        refreshComponents();
144
        refreshComponents();
145
        refreshTask = org.netbeans.modules.versioning.util.Utils.createTask(new RefreshViewTask());
145
        refreshTask = org.netbeans.modules.versioning.util.Utils.createTask(new RefreshViewTask());
146
        refreshStatuses();
146
    }
147
    }
147
148
148
    /**
149
    /**
 Lines 373-378    Link Here 
373
    }
374
    }
374
375
375
    private void onRefreshButton() {
376
    private void onRefreshButton() {
377
        refreshStatuses();
378
    }
379
380
    private void refreshStatuses() {
376
        if (context == null || context.getRootFiles().size() == 0) {
381
        if (context == null || context.getRootFiles().size() == 0) {
377
            return;
382
            return;
378
        }
383
        }

Return to bug 135672
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo