use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class RepositoryBrowserDialog method createBrowserComponent.
public JComponent createBrowserComponent(final boolean toolWindow) {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
gc.gridx = 0;
gc.gridwidth = 1;
gc.gridy = 0;
gc.gridheight = 1;
gc.gridx = 0;
gc.gridwidth = 2;
gc.gridy += 1;
gc.gridheight = 1;
gc.weightx = 1;
gc.weighty = 1;
gc.fill = GridBagConstraints.BOTH;
gc.anchor = GridBagConstraints.WEST;
panel.add(getRepositoryBrowser(), gc);
gc.gridy += 1;
gc.weighty = 0;
gc.fill = GridBagConstraints.HORIZONTAL;
panel.add(new JLabel(), gc);
Collection<String> urls = SvnApplicationSettings.getInstance().getCheckoutURLs();
ArrayList<SVNURL> svnURLs = new ArrayList<>();
for (final String url : urls) {
try {
svnURLs.add(SVNURL.parseURIEncoded(url));
} catch (SVNException e) {
//
}
}
getRepositoryBrowser().setRepositoryURLs(svnURLs.toArray(new SVNURL[svnURLs.size()]), myShowFiles);
getRepositoryBrowser().getRepositoryTree().addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
JTree tree = getRepositoryBrowser().getRepositoryTree();
int row = tree.getRowForLocation(x, y);
if (row >= 0) {
tree.setSelectionRow(row);
}
JPopupMenu popupMenu = createPopup(toolWindow);
if (popupMenu != null) {
popupMenu.show(comp, x, y);
}
}
});
return panel;
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class ElementWithBranchComparer method resolveElementUrl.
@Nullable
protected SVNURL resolveElementUrl() throws SVNException {
final SvnFileUrlMapping urlMapping = myVcs.getSvnFileUrlMapping();
final File file = virtualToIoFile(myVirtualFile);
final SVNURL fileUrl = urlMapping.getUrlForFile(file);
if (fileUrl == null) {
return null;
}
final String fileUrlString = fileUrl.toString();
final RootUrlInfo rootMixed = urlMapping.getWcRootForUrl(fileUrlString);
if (rootMixed == null) {
return null;
}
final SVNURL thisBranchForUrl = SvnUtil.getBranchForUrl(myVcs, rootMixed.getVirtualFile(), fileUrlString);
if (thisBranchForUrl == null) {
return null;
}
final String relativePath = SVNPathUtil.getRelativePath(thisBranchForUrl.toString(), fileUrlString);
return SVNURL.parseURIEncoded(SVNPathUtil.append(myBranchUrl, relativePath));
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SetPropertyDialog method fillPropertyNames.
private void fillPropertyNames(File[] files) {
final Collection<String> names = new TreeSet<>();
if (files.length == 1) {
File file = files[0];
try {
PropertyConsumer handler = new PropertyConsumer() {
public void handleProperty(File path, PropertyData property) {
String name = property.getName();
if (name != null) {
names.add(name);
}
}
public void handleProperty(SVNURL url, PropertyData property) {
}
public void handleProperty(long revision, PropertyData property) {
}
};
PropertyClient client = myVCS.getFactory(file).createPropertyClient();
client.list(SvnTarget.fromFile(file, SVNRevision.WORKING), SVNRevision.WORKING, Depth.EMPTY, handler);
} catch (VcsException e) {
LOG.info(e);
}
}
fillProperties(names);
for (final String name : names) {
myPropertyNameBox.addItem(name);
}
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SvnAuthenticationTest method testSavedAndRead.
public void testSavedAndRead() throws Exception {
final TestListener listener = new TestListener(mySynchObject);
myAuthenticationManager.addListener(listener);
final SavedOnceListener savedOnceListener = new SavedOnceListener();
myAuthenticationManager.addListener(savedOnceListener);
final SVNURL url = SVNURL.parseURIEncoded("http://some.host.com/repo");
final SVNException[] exception = new SVNException[1];
final boolean[] result = { false };
synchronousBackground(() -> {
try {
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.request));
listener.addStep(new Trinity<>(ProviderType.interactive, url, Type.request));
if (SystemInfo.isWindows) {
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.save));
} else {
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.without_pasword_save));
}
commonScheme(url, false, null);
Assert.assertEquals(3, listener.getCnt());
//long start = System.currentTimeMillis();
//waitListenerStep(start, listener, 3);
listener.reset();
if (!SystemInfo.isWindows)
savedOnceListener.reset();
SvnConfiguration.RUNTIME_AUTH_CACHE.clear();
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.request));
if (!SystemInfo.isWindows) {
listener.addStep(new Trinity<>(ProviderType.interactive, url, Type.request));
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.without_pasword_save));
}
commonScheme(url, false, null);
//start = System.currentTimeMillis();
//waitListenerStep(start, listener, 4);
Assert.assertEquals(SystemInfo.isWindows ? 1 : 3, listener.getCnt());
} catch (SVNException e) {
exception[0] = e;
}
result[0] = true;
});
Assert.assertTrue(result[0]);
Assert.assertEquals(SystemInfo.isWindows ? 0 : 2, myTestInteraction.getNumPlaintextPrompt());
Assert.assertEquals(0, myTestInteraction.getNumAuthWarn());
Assert.assertEquals(0, myTestInteraction.getNumPasswordsWarn());
Assert.assertEquals(0, myTestInteraction.getNumSSLPlaintextPrompt());
Assert.assertEquals(0, myTestInteraction.getNumSSLWarn());
Assert.assertEquals(SystemInfo.isWindows ? 1 : 3, listener.getCnt());
listener.assertForAwt();
savedOnceListener.assertForAwt();
savedOnceListener.assertSaved(url, ISVNAuthenticationManager.PASSWORD);
if (exception[0] != null) {
throw exception[0];
}
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SvnAuthenticationTest method testWhenNotSaved.
public void testWhenNotSaved() throws Exception {
final TestListener listener = new TestListener(mySynchObject);
myAuthenticationManager.addListener(listener);
final SavedOnceListener savedOnceListener = new SavedOnceListener();
myAuthenticationManager.addListener(savedOnceListener);
myInteractiveProvider.setSaveData(false);
final SVNURL url = SVNURL.parseURIEncoded("http://some.host.com/repo");
final SVNException[] exception = new SVNException[1];
final Boolean[] result = new Boolean[1];
synchronousBackground(() -> {
try {
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.request));
listener.addStep(new Trinity<>(ProviderType.interactive, url, Type.request));
commonScheme(url, false, null);
//long start = System.currentTimeMillis();
//waitListenerStep(start, listener, 2);
Assert.assertEquals(2, listener.getCnt());
savedOnceListener.assertNotSaved(url, ISVNAuthenticationManager.PASSWORD);
// cause is not cleared though
savedOnceListener.reset();
SvnConfiguration.RUNTIME_AUTH_CACHE.clear();
listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.request));
listener.addStep(new Trinity<>(ProviderType.interactive, url, Type.request));
commonScheme(url, false, null);
Assert.assertEquals(4, listener.getCnt());
//start = System.currentTimeMillis();
//waitListenerStep(start, listener, 4);
} catch (SVNException e) {
exception[0] = e;
}
result[0] = true;
});
Assert.assertTrue(result[0]);
myTestInteraction.assertNothing();
Assert.assertEquals(4, listener.getCnt());
listener.assertForAwt();
savedOnceListener.assertForAwt();
savedOnceListener.assertNotSaved(url, ISVNAuthenticationManager.PASSWORD);
if (exception[0] != null) {
throw exception[0];
}
}
Aggregations