Lines 96-110
Link Here
|
96 |
|
96 |
|
97 |
@Override |
97 |
@Override |
98 |
protected boolean enable(Node[] nodes) { |
98 |
protected boolean enable(Node[] nodes) { |
|
|
99 |
if (!super.enable(nodes)) { |
100 |
// only for managed files |
101 |
return false; |
102 |
} |
99 |
if(isDeepRefresh()) { |
103 |
if(isDeepRefresh()) { |
100 |
// allway true as we have will accept and check for external changes |
104 |
// allway true as we have will accept and check for external changes |
101 |
// and we don't about them yet |
105 |
// and we don't about them yet |
102 |
return true; |
106 |
return true; |
103 |
} |
107 |
} |
104 |
// XXX could be a performace issue, maybe a msg box in commit would be enough |
|
|
105 |
FileStatusCache cache = Subversion.getInstance().getStatusCache(); |
108 |
FileStatusCache cache = Subversion.getInstance().getStatusCache(); |
106 |
File[] files = cache.listFiles(getCachedContext(nodes), FileInformation.STATUS_LOCAL_CHANGE); |
109 |
boolean changed[] = new boolean[1]; |
107 |
return files.length > 0; |
110 |
File[] files = cache.listFiles(getCachedContext(nodes), FileInformation.STATUS_LOCAL_CHANGE, changed); |
|
|
111 |
return changed[0] || files.length > 0; |
108 |
} |
112 |
} |
109 |
|
113 |
|
110 |
/** Run commit action. Shows UI */ |
114 |
/** Run commit action. Shows UI */ |
Lines 134-155
Link Here
|
134 |
*/ |
138 |
*/ |
135 |
public static void commitKnownChanges(String contentTitle, final Context ctx) { |
139 |
public static void commitKnownChanges(String contentTitle, final Context ctx) { |
136 |
|
140 |
|
137 |
// get files list |
|
|
138 |
List<File> fileList = getFiles(ctx); |
139 |
if(fileList.size() == 0) { |
140 |
return; |
141 |
} |
142 |
|
143 |
// show commit dialog |
144 |
final CommitPanel panel = new CommitPanel(); |
141 |
final CommitPanel panel = new CommitPanel(); |
145 |
List<SvnHook> hooks = Subversion.getInstance().getHooks(); |
|
|
146 |
panel.setHooks(hooks, new SvnHookContext(new File[] { fileList.get(0) }, null, null)); |
147 |
final CommitTable data = new CommitTable(panel.filesLabel, CommitTable.COMMIT_COLUMNS, new String[] { CommitTableModel.COLUMN_NAME_PATH }); |
142 |
final CommitTable data = new CommitTable(panel.filesLabel, CommitTable.COMMIT_COLUMNS, new String[] { CommitTableModel.COLUMN_NAME_PATH }); |
148 |
panel.setCommitTable(data); |
143 |
panel.setCommitTable(data); |
|
|
144 |
final JButton commitButton = new JButton(); |
149 |
|
145 |
|
150 |
data.setNodes(getFileNodes(fileList)); |
146 |
// start backround prepare |
|
|
147 |
SVNUrl repository = null; |
148 |
try { |
149 |
repository = getSvnUrl(ctx); |
150 |
} catch (SVNClientException ex) { |
151 |
SvnClientExceptionHandler.notifyException(ex, true, true); |
152 |
} |
153 |
final List<SvnHook> hooks = Subversion.getInstance().getHooks(); |
154 |
panel.setHooks(hooks); |
155 |
SvnProgressSupport prepareSupport = new SvnProgressSupport() { |
156 |
public void perform() { |
157 |
try { |
158 |
List<File> fileList = getFiles(ctx); |
159 |
if (fileList.size() == 0) { |
160 |
return; |
161 |
} |
162 |
data.setNodes(getFileNodes(fileList)); |
163 |
} finally { |
164 |
commitButton.setEnabled(containsCommitable(data)); |
151 |
|
165 |
|
152 |
final JButton commitButton = new JButton(); |
166 |
panel.addVersioningListener(new VersioningListener() { |
|
|
167 |
public void versioningEvent(VersioningEvent event) { |
168 |
refreshCommitDialog(panel, data, commitButton); |
169 |
} |
170 |
}); |
171 |
data.getTableModel().addTableModelListener(new TableModelListener() { |
172 |
public void tableChanged(TableModelEvent e) { |
173 |
refreshCommitDialog(panel, data, commitButton); |
174 |
} |
175 |
}); |
176 |
} |
177 |
} |
178 |
}; |
179 |
RequestProcessor rp = Subversion.getInstance().getRequestProcessor(repository); |
180 |
prepareSupport.start(rp, repository, org.openide.util.NbBundle.getMessage(CommitAction.class, "BK1009")); // NOI18N |
153 |
if (showCommitDialog(panel, data, commitButton, contentTitle, ctx) == commitButton) { |
181 |
if (showCommitDialog(panel, data, commitButton, contentTitle, ctx) == commitButton) { |
154 |
// if OK setup sequence of add, remove and commit calls |
182 |
// if OK setup sequence of add, remove and commit calls |
155 |
startCommitTask(panel, data, ctx, hooks); |
183 |
startCommitTask(panel, data, ctx, hooks); |
Lines 169-176
Link Here
|
169 |
|
197 |
|
170 |
final CommitPanel panel = new CommitPanel(); |
198 |
final CommitPanel panel = new CommitPanel(); |
171 |
List<SvnHook> hooks = Subversion.getInstance().getHooks(); |
199 |
List<SvnHook> hooks = Subversion.getInstance().getHooks(); |
172 |
File file = ctx.getRootFiles()[0]; |
200 |
panel.setHooks(hooks); |
173 |
panel.setHooks(hooks, new SvnHookContext(new File[] { file }, null, null)); |
|
|
174 |
|
201 |
|
175 |
final CommitTable data = new CommitTable(panel.filesLabel, CommitTable.COMMIT_COLUMNS, new String[] { CommitTableModel.COLUMN_NAME_PATH }); |
202 |
final CommitTable data = new CommitTable(panel.filesLabel, CommitTable.COMMIT_COLUMNS, new String[] { CommitTableModel.COLUMN_NAME_PATH }); |
176 |
panel.setCommitTable(data); |
203 |
panel.setCommitTable(data); |
Lines 230-236
Link Here
|
230 |
contextFiles = split[c]; |
257 |
contextFiles = split[c]; |
231 |
boolean recursive = c == 1; |
258 |
boolean recursive = c == 1; |
232 |
if (recursive) { |
259 |
if (recursive) { |
233 |
File[] files = cache.listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE); |
260 |
File[] files = cache.listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE, null); |
234 |
for (int i= 0; i < files.length; i++) { |
261 |
for (int i= 0; i < files.length; i++) { |
235 |
for(int r = 0; r < contextFiles.length; r++) { |
262 |
for(int r = 0; r < contextFiles.length; r++) { |
236 |
if( SvnUtils.isParentOrEqual(contextFiles[r], files[i]) ) { |
263 |
if( SvnUtils.isParentOrEqual(contextFiles[r], files[i]) ) { |
Lines 410-416
Link Here
|
410 |
contextFiles = split[c]; |
437 |
contextFiles = split[c]; |
411 |
boolean recursive = c == 1; |
438 |
boolean recursive = c == 1; |
412 |
if (recursive) { |
439 |
if (recursive) { |
413 |
File[] files = cache.listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE); |
440 |
File[] files = cache.listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE, null); |
414 |
for (int i= 0; i < files.length; i++) { |
441 |
for (int i= 0; i < files.length; i++) { |
415 |
for(int r = 0; r < contextFiles.length; r++) { |
442 |
for(int r = 0; r < contextFiles.length; r++) { |
416 |
if( SvnUtils.isParentOrEqual(contextFiles[r], files[i]) ) { |
443 |
if( SvnUtils.isParentOrEqual(contextFiles[r], files[i]) ) { |