diff --git a/ide/bugtracking.bridge/src/org/netbeans/modules/bugtracking/vcs/VCSBugtrackingSupportImpl.java b/ide/bugtracking.bridge/src/org/netbeans/modules/bugtracking/vcs/VCSBugtrackingSupportImpl.java index bfc2a749704d..96d2038e76a9 100644 --- a/ide/bugtracking.bridge/src/org/netbeans/modules/bugtracking/vcs/VCSBugtrackingSupportImpl.java +++ b/ide/bugtracking.bridge/src/org/netbeans/modules/bugtracking/vcs/VCSBugtrackingSupportImpl.java @@ -33,8 +33,6 @@ /** * Only for team needs * - * XXX lets do that directly from kenai (after a clone) via the bugtracking bridge - * * @author Tomas Stupka */ @org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.versioning.util.VCSBugtrackingAccessor.class) diff --git a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyNode.java b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyNode.java index 0f98dd2ef663..f1de23f95f16 100644 --- a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyNode.java +++ b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyNode.java @@ -22,15 +22,9 @@ import java.io.IOException; import org.netbeans.modules.bugtracking.api.Repository; import org.openide.filesystems.FileObject; -import org.openide.loaders.DataFolder; -import org.openide.loaders.DataLoader; -import org.openide.loaders.DataObject; -import org.openide.loaders.DataObjectExistsException; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.util.Exceptions; -import org.openide.util.HelpCtx; -import org.openide.util.lookup.Lookups; /** * diff --git a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/kenai/DummyKenaiRepositories.java b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyRepositories.java similarity index 91% rename from ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/kenai/DummyKenaiRepositories.java rename to ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyRepositories.java index ad3ac3db2817..e2bfd36af5e7 100644 --- a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/kenai/DummyKenaiRepositories.java +++ b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/dummies/DummyRepositories.java @@ -17,19 +17,19 @@ * under the License. */ -package org.netbeans.modules.bugtracking.kenai; +package org.netbeans.modules.bugtracking.dummies; -import org.netbeans.modules.bugtracking.team.TeamRepositories; import java.util.Collection; import java.util.Collections; import org.netbeans.modules.bugtracking.RepositoryImpl; +import org.netbeans.modules.bugtracking.team.TeamRepositories; /** * Dummy implementation that returns an empty array of repositories. * * @author Marian Petras */ -public class DummyKenaiRepositories extends TeamRepositories { +public class DummyRepositories extends TeamRepositories { @Override public Collection getRepositories(boolean includeIDEProjects, boolean onlyDashboardOpenProjects) { diff --git a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/query/KenaiTestHidden.java b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/query/KenaiTestHidden.java deleted file mode 100644 index 386905c6190f..000000000000 --- a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/query/KenaiTestHidden.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.bugtracking.ui.query; - -import java.util.logging.Level; -import org.netbeans.junit.NbTestCase; - -/** - * - * @author tomas - */ -public class KenaiTestHidden extends NbTestCase { - - private String username; - private String password; -// private Kenai kenai; - - public KenaiTestHidden(String arg0) { - super(arg0); - } - - @Override - protected Level logLevel() { - return Level.ALL; - } - -// @Override -// protected void setUp() throws Exception { -// super.setUp(); -// -// BufferedReader br = new BufferedReader(new FileReader(new File(System.getProperty("user.home"), ".test-kenai"))); -// username = br.readLine(); -// password = br.readLine(); -// br.close(); -// -// kenai = KenaiManager.getDefault().createKenai("testkenai", "https://testkenai.com"); -// } -// -//// public void testQueryTopComponent() throws Throwable { -//// KenaiRepository repo = KenaiConnector.repo; -//// -//// LogHandler openedHandler = new LogHandler("QueryAction.openQuery finnish", LogHandler.Compare.STARTS_WITH); -//// -//// QueryAction.openQuery(null, repo, true); -//// openedHandler.waitUntilDone(); -//// -//// QueryTopComponent qtc = getQueryTC(); -//// JComboBox combo = (JComboBox) getField(qtc, "repositoryComboBox"); -//// assertFalse(combo.isEnabled()); -//// JButton button = (JButton) getField(qtc, "newButton"); -//// assertFalse(button.isEnabled()); -//// -//// kenai.login(username, password.toCharArray()); -//// kenai.logout(); -//// kenai.login(username, password.toCharArray()); -//// -//// combo = (JComboBox) getField(qtc, "repositoryComboBox"); -//// assertFalse(combo.isEnabled()); -//// button = (JButton) getField(qtc, "newButton"); -//// assertFalse(button.isEnabled()); -//// } -// -// public void testRefreshQueriesInQueryTopComponent() throws Throwable { -// QueryAccessorImpl qa = new QueryAccessorImpl(); // need the instace to listen on kenai -// -// kenai.login(username, password.toCharArray()); -// -// KenaiRepository repo = KenaiConnector.repo; -// repo.queries.add(new KenaiQuery(repo)); -// -// LogHandler openedHandler = new LogHandler("QueryAction.openQuery finnish", LogHandler.Compare.STARTS_WITH); -// LogHandler savedHandler = new LogHandler("saved queries.", LogHandler.Compare.ENDS_WITH); -// -// QueryAction.openQuery(null, repo, true); -// openedHandler.waitUntilDone(); -// -// QueryTopComponent qtc = getQueryTC(); -// -// savedHandler.waitUntilDone(); -// QueryProvider[] savedQueries = getSavedQueries(qtc); -// assertNotNull(savedQueries); -// -// assertEquals(repo.queries.size(), savedQueries.length); -// -// repo.queries.add(new KenaiQuery(repo)); -// savedHandler.reset(); -// kenai.logout(); -// savedHandler.waitUntilDone(); -// -// savedQueries = getSavedQueries(qtc); -// assertEquals(repo.queries.size(), savedQueries.length); -// -// repo.queries.clear(); -// LogHandler noQueriesHandler = new LogHandler("No queries.", LogHandler.Compare.ENDS_WITH); -// kenai.login(username, password.toCharArray()); -// noQueriesHandler.waitUntilDone(); -// -// savedQueries = getSavedQueries(qtc); -// assertEquals(repo.queries.size(), savedQueries.length); -// } -// -// private QueryTopComponent getQueryTC() { -// QueryTopComponent qtc = null; -// Set tcs = TopComponent.getRegistry().getOpened(); -// for (TopComponent tc : tcs) { -// if (tc instanceof QueryTopComponent) { -// qtc = (QueryTopComponent) tc; -// } -// } -// assertNotNull(qtc); -// return qtc; -// } -// -// private QueryProvider[] getSavedQueries(QueryTopComponent tc) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { -// return (QueryProvider[]) getField(tc, "savedQueries"); -// } -// -// private Object getField(Object o, String name) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { -// Field f = o.getClass().getDeclaredField(name); -// f.setAccessible(true); -// return f.get(o); -// } -// -// private static class KenaiRepository extends RepositoryProvider { -// List queries = new ArrayList(); -// QueryProvider newquery; -// -// public KenaiRepository() { -// this.newquery = new KenaiQuery(this); -// } -// -// @Override -// public String getID() { -// return "repoid"; -// } -// -// @Override -// public Image getIcon() { -// return null; -// } -// -// @Override -// public String getDisplayName() { -// return "kenai repo"; -// } -// -// @Override -// public String getTooltip() { -// return "kenai repo"; -// } -// -// @Override -// public String getUrl() { -// return "http://kenai.repo"; -// } -// -// @Override -// public IssueProvider getIssue(String id) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public void remove() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public BugtrackingController getController() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public QueryProvider createQuery() { -// return newquery; -// } -// -// @Override -// public IssueProvider createIssue() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public QueryProvider[] getQueries() { -// return queries.toArray(new QueryProvider[queries.size()]); -// } -// -// @Override -// public IssueProvider[] simpleSearch(String criteria) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// protected IssueCache getIssueCache() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// public Lookup getLookup() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public Collection getUsers() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// } -// -// private static class KenaiQuery extends QueryProvider { -// private RepositoryProvider repository; -// private BugtrackingController controler = new BugtrackingController() { -// private JPanel panel = new JPanel(); -// @Override -// public JComponent getComponent() { -// return panel; -// } -// @Override -// public HelpCtx getHelpCtx() { -// return null; -// } -// @Override -// public boolean isValid() { -// return true; -// } -// @Override -// public void applyChanges() throws IOException {} -// }; -// -// public KenaiQuery(RepositoryProvider repository) { -// this.repository = repository; -// } -// -// @Override -// public String getDisplayName() { -// return "kenai query"; -// } -// @Override -// public String getTooltip() { -// return "kenai query"; -// } -// @Override -// public BugtrackingController getController() { -// return controler; -// } -// @Override -// public RepositoryProvider getRepository() { -// return repository; -// } -// @Override -// public IssueProvider[] getIssues(int includeStatus) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// @Override -// public boolean contains(IssueProvider issue) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// @Override -// public int getIssueStatus(IssueProvider issue) { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// } -// -// @org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.bugtracking.spi.BugtrackingConnector.class) -// public static class KenaiConnector extends BugtrackingConnector { -// static String ID = "KenaiCconector"; -// private static KenaiRepository repo = new KenaiRepository(); -// -// public KenaiConnector() { -// } -// -// @Override -// public String getDisplayName() { -// return ID; -// } -// -// @Override -// public String getTooltip() { -// return ID; -// } -// -// @Override -// public RepositoryProvider createRepository() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public RepositoryProvider[] getRepositories() { -// return new RepositoryProvider[] {repo}; -// } -// -// public Lookup getLookup() { -// return Lookup.EMPTY; -// } -// -// @Override -// public String getID() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// @Override -// public Image getIcon() { -// throw new UnsupportedOperationException("Not supported yet."); -// } -// -// } - -} diff --git a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboModelTest.java b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboModelTest.java index c30039107304..31cf25deb43c 100644 --- a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboModelTest.java +++ b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboModelTest.java @@ -19,8 +19,6 @@ package org.netbeans.modules.bugtracking.ui.repository; -import org.netbeans.modules.bugtracking.ui.repository.RepositoryComboModel; -import javax.swing.ComboBoxModel; import org.junit.Test; import static org.junit.Assert.*; diff --git a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboSupportTest.java b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboSupportTest.java index 59ccb94bad3e..c8cf605d3126 100644 --- a/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboSupportTest.java +++ b/ide/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboSupportTest.java @@ -19,7 +19,6 @@ package org.netbeans.modules.bugtracking.ui.repository; -import org.netbeans.modules.bugtracking.ui.repository.RepositoryComboSupport; import java.awt.EventQueue; import java.io.File; import java.io.IOException; @@ -34,7 +33,7 @@ import org.junit.Test; import org.netbeans.modules.bugtracking.dummies.DummyBugtrackingConnector; import org.netbeans.modules.bugtracking.dummies.DummyBugtrackingOwnerSupport; -import org.netbeans.modules.bugtracking.kenai.DummyKenaiRepositories; +import org.netbeans.modules.bugtracking.dummies.DummyRepositories; import org.netbeans.modules.bugtracking.dummies.DummyNode; import org.netbeans.modules.bugtracking.dummies.DummyTopComponentRegistry; import org.netbeans.modules.bugtracking.dummies.DummyWindowManager; @@ -71,7 +70,7 @@ public class RepositoryComboSupportTest { @BeforeClass public static void setLookup() { MockLookup.setLayersAndInstances( - new DummyKenaiRepositories(), + new DummyRepositories(), new DummyWindowManager(), new DummyBugtrackingOwnerSupport(), new DummyProjectServices(), @@ -559,7 +558,7 @@ public TestLookup() { } private TestLookup(InstanceContent ic) { super(ic); - ic.add(new DummyKenaiRepositories()); + ic.add(new DummyRepositories()); ic.add(new DummyBugtrackingConnector()); ic.add(new DummyWindowManager()); ic.add(new DummyBugtrackingOwnerSupport()); diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java index f60fe0026967..04df3ab58e0d 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java @@ -19,21 +19,14 @@ package org.netbeans.modules.bugzilla; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Level; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; import org.netbeans.modules.bugtracking.api.Repository; import org.netbeans.modules.team.spi.TeamBugtrackingConnector; import org.netbeans.modules.bugzilla.repository.BugzillaRepository; import org.netbeans.modules.bugtracking.spi.BugtrackingConnector; import org.netbeans.modules.bugtracking.spi.RepositoryInfo; import org.netbeans.modules.bugzilla.api.NBBugzillaUtils; -import org.netbeans.modules.bugzilla.kenai.KenaiRepository; import org.netbeans.modules.bugzilla.repository.NBRepositorySupport; import org.netbeans.modules.bugzilla.util.BugzillaUtil; -import org.netbeans.modules.team.spi.TeamAccessorUtils; -import org.netbeans.modules.team.spi.TeamProject; import org.openide.util.NbBundle; /** @@ -54,10 +47,6 @@ public BugzillaConnector() {} @Override public Repository createRepository(RepositoryInfo info) { - Repository r = createKenaiRepository(info); - if(r != null) { - return r; - } BugzillaRepository bugzillaRepository = new BugzillaRepository(info); if(BugzillaUtil.isNbRepository(bugzillaRepository)) { NBRepositorySupport.getInstance().setNBBugzillaRepository(bugzillaRepository); @@ -75,67 +64,6 @@ public static String getConnectorName() { return NbBundle.getMessage(BugzillaConnector.class, "LBL_ConnectorName"); // NOI18N } - /****************************************************************************** - * Kenai - ******************************************************************************/ - - public Repository createKenaiRepository(RepositoryInfo info) { - String name = info.getValue(TeamBugtrackingConnector.TEAM_PROJECT_NAME); - TeamProject project = null; - if(name != null) { - project = TeamAccessorUtils.getTeamProject(info.getUrl(), name); - } - if(project == null || project.getType() != BugtrackingType.BUGZILLA) { - return null; - } - - KenaiRepository repo = createKenaiRepository(project, project.getDisplayName(), project.getFeatureLocation()); - if(BugzillaUtil.isNbRepository(repo)) { - NBRepositorySupport.getInstance().setNBBugzillaRepository(repo); - } - return BugzillaUtil.createRepository(repo); - } - - private KenaiRepository createKenaiRepository(TeamProject kenaiProject, String displayName, String location) { - final URL loc; - try { - loc = new URL(location); - } catch (MalformedURLException ex) { - Bugzilla.LOG.log(Level.WARNING, null, ex); - return null; - } - - String host = loc.getHost(); - int idx = location.indexOf(IBugzillaConstants.URL_BUGLIST); - if (idx <= 0) { - Bugzilla.LOG.log(Level.WARNING, "can't get issue tracker url from [{0}, {1}]", new Object[]{displayName, location}); // NOI18N - return null; - } - String url = location.substring(0, idx); - if (url.startsWith("http:")) { // XXX hack??? // NOI18N - url = "https" + url.substring(4); // NOI18N - } - String productParamUrl = null; - String productAttribute = "product="; // NOI18N - String product = null; - int idxProductStart = location.indexOf(productAttribute); - if (idxProductStart <= 0) { - Bugzilla.LOG.log(Level.WARNING, "can''t get issue tracker product from [{0}, {1}]", new Object[]{displayName, location}); // NOI18N - return null; - } else { - int idxProductEnd = location.indexOf("&", idxProductStart); // NOI18N - if(idxProductEnd > -1) { - productParamUrl = location.substring(idxProductStart, idxProductEnd); - product = location.substring(idxProductStart + productAttribute.length(), idxProductEnd); - } else { - productParamUrl = location.substring(idxProductStart); - product = location.substring(idxProductStart + productAttribute.length()); - } - } - - return new KenaiRepository(kenaiProject, displayName, url, host, productParamUrl, product); - } - @Override public BugtrackingType getType() { return BugtrackingType.BUGZILLA; diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaQueryProvider.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaQueryProvider.java index 3b36e44a2b37..116d93b50089 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaQueryProvider.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaQueryProvider.java @@ -21,10 +21,7 @@ import org.netbeans.modules.bugtracking.spi.QueryController; import org.netbeans.modules.bugtracking.spi.QueryProvider; import org.netbeans.modules.bugzilla.issue.BugzillaIssue; -import org.netbeans.modules.bugzilla.kenai.KenaiRepository; import org.netbeans.modules.bugzilla.query.BugzillaQuery; -import org.netbeans.modules.bugzilla.repository.BugzillaRepository; -import org.openide.util.NbBundle; /** * @@ -34,10 +31,7 @@ public class BugzillaQueryProvider implements QueryProvider @Override public void refresh(BugzillaQuery query) { - if(needsAndHasNoLogin(query)) { - return; - } query.getController().refresh(true); } - - /************************************************************************************ - * Kenai - ************************************************************************************/ - - private boolean needsAndHasNoLogin(BugzillaQuery query) { - BugzillaRepository repo = query.getRepository(); - if(repo instanceof KenaiRepository ) { - KenaiRepository kenaiRepo = (KenaiRepository) repo; - return kenaiRepo.isMyIssues(query) && !kenaiRepo.isLoggedIn(); - } - return false; - } - } diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java index ad8cc8f49026..e7ecaa411ab7 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java @@ -31,7 +31,6 @@ import java.util.MissingResourceException; import java.util.concurrent.Callable; import java.util.logging.Level; -import org.apache.commons.httpclient.RedirectException; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.mylyn.internal.bugzilla.core.BugzillaStatus; @@ -65,7 +64,6 @@ public class BugzillaExecutor { private static final String USERNAME_CONFIRM_MATCH = "Confirm Match"; // NOI18N private static final String INVALID_USERNAME_OR_PASSWORD = "invalid username or password"; // NOI18N private static final String REPOSITORY_LOGIN_FAILURE = "unable to login to"; // NOI18N - private static final String KENAI_LOGIN_REDIRECT = "/people/login?original_uri="; // NOI18N private static final String COULD_NOT_BE_FOUND = "could not be found"; // NOI18N private static final String REPOSITORY = "repository"; // NOI18N private static final String MIDAIR_COLLISION = "mid-air collision occurred while submitting to"; // NOI18N @@ -351,10 +349,6 @@ static ExceptionHandler createHandler(CoreException ce, BugzillaExecutor executo if(errormsg != null) { return new LoginHandler(ce, errormsg, executor, repository); } - errormsg = getKenaiRedirectError(ce); - if(errormsg != null) { - return new LoginHandler(ce, errormsg, executor, repository); - } errormsg = getNotFoundError(ce); if(errormsg != null) { return new NotFoundHandler(ce, errormsg, executor, repository); @@ -417,22 +411,6 @@ private static String getLoginError(BugzillaRepository repository, ValidateComma return null; } - private static String getKenaiRedirectError(CoreException ce) { - IStatus status = ce.getStatus(); - if(status == null) { - return null; - } - Throwable cause = status.getException(); - if(cause instanceof RedirectException) { - String msg = cause.getMessage(); - if(msg.contains(KENAI_LOGIN_REDIRECT)) { - Bugzilla.LOG.log(Level.FINER, "returned error message [{0}]", msg); // NOI18N - return NbBundle.getMessage(BugzillaExecutor.class, "MSG_INVALID_USERNAME_OR_PASSWORD"); // NOI18N - } - } - return null; - } - private static String getMidAirColisionError(CoreException ce) { String msg = getMessage(ce); if(msg != null) { diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/CommentsPanel.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/CommentsPanel.java index 0ff9d1644c0a..d8e36eccb687 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/CommentsPanel.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/CommentsPanel.java @@ -68,9 +68,7 @@ import org.netbeans.modules.bugtracking.commons.LinkButton; import org.netbeans.modules.bugtracking.commons.UIUtils; import org.netbeans.modules.bugzilla.Bugzilla; -import org.netbeans.modules.bugzilla.kenai.KenaiRepository; import org.netbeans.modules.bugzilla.repository.IssueField; -import org.netbeans.modules.team.spi.TeamAccessorUtils; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; @@ -217,15 +215,6 @@ private ExpandLabel addSection(GroupLayout layout, final Long number, String tex // state label JLabel stateLabel = null; - if (issue.getRepository() instanceof KenaiRepository) { - int index = author.indexOf('@'); // NOI18N - String userName = (index == -1) ? author : author.substring(0,index); - String host = ((KenaiRepository) issue.getRepository()).getHost(); - stateLabel = TeamAccessorUtils.createUserWidget(issue.getRepository().getUrl(), userName, host, TeamAccessorUtils.getChatLink(issue.getID())); - if (stateLabel != null) { - stateLabel.setText(null); - } - } // replay button LinkButton replyButton = new LinkButton(bundle.getString("Comments.replyButton.text")); // NOI18N diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java index 7064640fa36e..2a3f353d9824 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java @@ -113,7 +113,6 @@ import org.netbeans.modules.bugzilla.BugzillaConfig; import org.netbeans.modules.bugzilla.issue.BugzillaIssue.Attachment; import org.netbeans.modules.bugzilla.issue.BugzillaIssue.Comment; -import org.netbeans.modules.bugzilla.kenai.KenaiRepository; import org.netbeans.modules.bugzilla.repository.BugzillaConfiguration; import org.netbeans.modules.bugzilla.repository.BugzillaRepository; import org.netbeans.modules.bugzilla.repository.CustomIssueField; @@ -469,10 +468,7 @@ private void selectProduct() { } } else { BugzillaRepository repository = issue.getRepository(); - if (repository instanceof KenaiRepository) { - String productName = ((KenaiRepository)repository).getProductName(); - productCombo.setSelectedItem(productName); - } else if (BugzillaUtil.isNbRepository(repository)) { + if (BugzillaUtil.isNbRepository(repository)) { // IssueProvider 181224 String defaultProduct = "ide"; // NOI18N String defaultComponent = "Code"; // NOI18N @@ -512,7 +508,7 @@ void reloadForm(boolean force) { clearHighlights(); boolean isNew = issue.isNew(); - boolean showProductCombo = isNew || !(issue.getRepository() instanceof KenaiRepository) || NBBugzillaUtils.isNbRepository(issue.getRepository().getUrl()); + boolean showProductCombo = true; boolean hasTimeTracking = !isNew && issue.hasTimeTracking(); GroupLayout layout = (GroupLayout) attributesSectionPanel.getLayout(); if (showProductCombo) { @@ -621,7 +617,6 @@ void reloadForm(boolean force) { reloadField(addCommentArea, IssueField.COMMENT); } - boolean isKenaiRepository = (issue.getRepository() instanceof KenaiRepository); if (!isNew) { // reported field format = NbBundle.getMessage(IssuePanel.class, "IssuePanel.reportedLabel.format"); // NOI18N @@ -633,17 +628,6 @@ void reloadForm(boolean force) { String reportedTxt = MessageFormat.format(format, creationTxt, reporterTxt); reportedField.setText(reportedTxt); fixPrefSize(reportedField); - if (isKenaiRepository && (reportedStatusLabel.getIcon() == null)) { - int index = reporter.indexOf('@'); - String userName = (index == -1) ? reporter : reporter.substring(0,index); - String host = ((KenaiRepository) issue.getRepository()).getHost(); - JLabel label = TeamAccessorUtils.createUserWidget(issue.getRepository().getUrl(), userName, host, TeamAccessorUtils.getChatLink(issue.getID())); - if (label != null) { - label.setText(null); - ((GroupLayout) attributesSectionPanel.getLayout()).replace(reportedStatusLabel, label); - reportedStatusLabel = label; - } - } // modified field Date modification = issue.getLastModifyDate(); @@ -686,18 +670,6 @@ void reloadForm(boolean force) { String assignee = issue.getFieldValue(IssueField.ASSIGNED_TO); String selectedAssignee = (assignedField.getParent() == null) ? assignedCombo.getSelectedItem().toString() : assignedField.getText(); - if (isKenaiRepository && (assignee.trim().length() > 0) && (force || !selectedAssignee.equals(assignee))) { - int index = assignee.indexOf('@'); - String userName = (index == -1) ? assignee : assignee.substring(0,index); - String host = ((KenaiRepository) issue.getRepository()).getHost(); - JLabel label = TeamAccessorUtils.createUserWidget(issue.getRepository().getUrl(), userName, host, TeamAccessorUtils.getChatLink(issue.getID())); - if (label != null) { - label.setText(null); - ((GroupLayout) attributesSectionPanel.getLayout()).replace(assignedToStatusLabel, label); - label.setVisible(assignedToStatusLabel.isVisible()); - assignedToStatusLabel = label; - } - } if (force) { assignedToStatusLabel.setVisible(assignee.trim().length() > 0); } @@ -3305,9 +3277,6 @@ private void assignedComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN if (value instanceof RepositoryUser) { String assignee = ((RepositoryUser)value).getUserName(); BugzillaRepository repository = issue.getRepository(); - if (repository instanceof KenaiRepository) { - assignee += '@' + ((KenaiRepository)repository).getHost(); - } assignedCombo.setSelectedItem(assignee); } }//GEN-LAST:event_assignedComboActionPerformed diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/Bundle.properties b/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/Bundle.properties deleted file mode 100644 index b103116a7827..000000000000 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/Bundle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -MSG_WrongProjectWarning=Task {0} doesn''t belong to project ''{1}''.\nDo you want to open it anyway? \ No newline at end of file diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiConfiguration.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiConfiguration.java deleted file mode 100644 index de95c5bcb5e6..000000000000 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiConfiguration.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.bugzilla.kenai; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.netbeans.modules.bugzilla.repository.BugzillaConfiguration; -import org.netbeans.modules.bugzilla.repository.BugzillaRepository; -import org.netbeans.modules.bugzilla.util.BugzillaUtil; - -/** - * - * @author Tomas Stupka - */ -public class KenaiConfiguration extends BugzillaConfiguration { - private List products; - private KenaiRepository repository; - - /** one instance for all kenai repositories on on each kenai site */ - private static Map rcs; - - public KenaiConfiguration(KenaiRepository repository, String product) { - this.repository = repository; - ArrayList l = new ArrayList(); - l.add(product); - this.products = Collections.unmodifiableList(l); - } - - @Override - public List getProducts() { - if(!BugzillaUtil.isNbRepository(repository)) { - return products; - } else { - return super.getProducts(); - } - } - - @Override - public List getComponents(String product) { - return super.getComponents(product); - } - - @Override - public List getVersions(String product) { - return super.getVersions(product); - } - - void reset() { - if(rcs != null) { - rcs.remove(repository.getUrl()); - } - } - - @Override - protected RepositoryConfiguration getRepositoryConfiguration(BugzillaRepository repository, boolean forceRefresh) { - if(rcs == null) { - rcs = new HashMap(1); - } - RepositoryConfiguration rc = rcs.get(repository.getUrl()); - if(rc == null || forceRefresh) { - rc = super.getRepositoryConfiguration(repository, forceRefresh); - rcs.put(repository.getUrl(), rc); - } - if(rc != null && (!forceRefresh && !hasProduct(rc))) { - // mylyn is cashing the configuration for us so in case - // forceRefresh=false and it doesn't contain the given project - // we have to force refresh it one more time to get the needed - // project data from the server - forceRefresh = true; - rc = super.getRepositoryConfiguration(repository, forceRefresh); - } - return rc; - } - - private boolean hasProduct(RepositoryConfiguration rc) { - List knownProducts = rc.getProducts(); - for (String product : products) { - if(!knownProducts.contains(product)) { - return false; - } - } - return true; - } -} diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiQuery.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiQuery.java deleted file mode 100644 index a94ce8252c52..000000000000 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiQuery.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.bugzilla.kenai; - -import java.util.Collection; -import org.netbeans.modules.team.commons.LogUtils; -import org.netbeans.modules.bugzilla.BugzillaConfig; -import org.netbeans.modules.bugzilla.BugzillaConnector; -import org.netbeans.modules.bugzilla.issue.BugzillaIssue; -import org.netbeans.modules.bugzilla.repository.BugzillaRepository; -import org.netbeans.modules.bugzilla.query.BugzillaQuery; -import org.netbeans.modules.bugzilla.query.QueryController; -import org.openide.util.NbBundle; - -/** - * - * @author Tomas Stupka - */ -public class KenaiQuery extends BugzillaQuery { - private final String product; - private boolean predefinedQuery = false; - - public KenaiQuery(String name, BugzillaRepository repository, String urlParameters, String product, boolean saved, boolean predefined) { - super(name, repository, urlParameters, saved, false, false); - this.product = product; - this.predefinedQuery = predefined; - this.lastRefresh = BugzillaConfig.getInstance().getLastQueryRefresh(repository, getStoredQueryName()); - controller = createControler(repository, this, urlParameters); - } - - @Override - protected QueryController createControler(BugzillaRepository r, BugzillaQuery q, String parameters) { - KenaiQueryController c = new KenaiQueryController(r, q, parameters, product, predefinedQuery); - return c; - } - - void setUrlParameters(String urlParameters) { - super.urlParameters = urlParameters; - } - - @Override - protected void logQueryEvent(int count, boolean autoRefresh) { - LogUtils.logQueryEvent( - BugzillaConnector.getConnectorName(), - getDisplayName(), - count, - true, - autoRefresh); - } - - @Override - public String getStoredQueryName() { - return super.getStoredQueryName() + "-" + product; - } - - @Override - public boolean canRemove() { - return predefinedQuery ? false : super.canRemove(); - } -} diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiQueryController.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiQueryController.java deleted file mode 100644 index 5b544eddf2c7..000000000000 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiQueryController.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.bugzilla.kenai; - -import java.util.List; -import org.netbeans.modules.team.spi.OwnerInfo; -import org.netbeans.modules.team.commons.LogUtils; -import org.netbeans.modules.bugzilla.BugzillaConnector; -import org.netbeans.modules.bugzilla.issue.BugzillaIssue; -import org.netbeans.modules.bugzilla.repository.BugzillaRepository; -import org.netbeans.modules.bugzilla.query.BugzillaQuery; -import org.netbeans.modules.bugzilla.query.QueryController; -import org.netbeans.modules.bugzilla.repository.IssueField; -import org.netbeans.modules.bugzilla.util.BugzillaUtil; -import org.openide.DialogDescriptor; -import org.openide.DialogDisplayer; -import org.openide.NotifyDescriptor.Confirmation; -import org.openide.nodes.Node; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; - -/** - * - * @author Tomas Stupka - */ -public class KenaiQueryController extends QueryController { - private final String product; - private final boolean predefinedQuery; - - public KenaiQueryController(BugzillaRepository repository, BugzillaQuery query, String urlParameters, String product, boolean predefinedQuery) { - super(repository, query, urlParameters, false, false); - this.product = product; - this.predefinedQuery = predefinedQuery; - postPopulate(urlParameters, false); - } - - @Override - public boolean providesMode(QueryMode mode) { - // can't edit predefined quries, otherwise all posible modes accepted - return !predefinedQuery || mode != QueryMode.EDIT; - } - - @Override - public void populate(String urlParameters) { - if(BugzillaUtil.isNbRepository(getRepository())) { - if(urlParameters == null) { // is new - OwnerInfo ownerInfo = query.getOwnerInfo(); - if(ownerInfo == null) { - // XXX not sure why we need this - i'm going to keep it for now, - // doesn't seem to harm - Node[] selection = WindowManager.getDefault().getRegistry().getActivatedNodes(); - ownerInfo = getRepository().getOwnerInfo(selection); - } - if(ownerInfo != null) { - StringBuilder sb = new StringBuilder(); - String owner = ownerInfo.getOwner(); - if(owner == null || !owner.equals(product) ) { - // XXX is this even possible? - } else { - sb.append("product="); // NOI18N - sb.append(owner); - List data = ownerInfo.getExtraData(); - if(data != null && data.size() > 0) { - sb.append("&component="); // NOI18N - sb.append(data.get(0)); - } - urlParameters = sb.toString(); - - // select only if owner awailable - selectFirstProduct(); - } - } - if(urlParameters == null) { - urlParameters = "product=" + product; // NOI18N - } - } - - super.populate(urlParameters); - } else { - super.populate(urlParameters); - disableProduct(); - selectFirstProduct(); - } - } - - @Override - protected void enableFields(boolean bl) { - super.enableFields(bl); - - if(predefinedQuery) { - // override - for predefined kenai queries are those always disabled - panel.modifyButton.setEnabled(false); - panel.removeButton.setEnabled(false); - } - } - - @Override - protected void openIssue(BugzillaIssue issue) { - if(issue != null) { - if(!checkIssueProduct(issue)) { - return; - } - } - super.openIssue(issue); - } - - @Override - protected void onCloneQuery () { - String p = getUrlParameters(false); - BugzillaQuery q = new KenaiQuery(null, getRepository(), p, product, false, false); - BugzillaUtil.openQuery(q); - } - - private boolean checkIssueProduct(BugzillaIssue issue) { - String issueProduct = issue.getRepositoryFieldValue(IssueField.PRODUCT); - if(!issueProduct.equals(product)) { - Confirmation dd = new DialogDescriptor.Confirmation( - NbBundle.getMessage( - KenaiQueryController.class, - "MSG_WrongProjectWarning", - new Object[] {issue.getID(), issueProduct}), - Confirmation.YES_NO_OPTION); - return DialogDisplayer.getDefault().notify(dd) == Confirmation.YES_OPTION; - } - return true; - } - -} diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiRepository.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiRepository.java deleted file mode 100644 index df14ad021337..000000000000 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/kenai/KenaiRepository.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.bugzilla.kenai; - -import java.awt.Image; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.net.PasswordAuthentication; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.MissingResourceException; -import java.util.Set; -import java.util.logging.Level; -import org.netbeans.modules.team.spi.TeamAccessor; -import org.netbeans.modules.team.spi.TeamProject; -import org.netbeans.modules.team.spi.OwnerInfo; -import org.netbeans.modules.team.spi.RepositoryUser; -import org.netbeans.modules.bugtracking.spi.RepositoryInfo; -import org.netbeans.modules.bugtracking.commons.TextUtils; -import org.netbeans.modules.bugzilla.Bugzilla; -import org.netbeans.modules.bugzilla.BugzillaConnector; -import org.netbeans.modules.bugzilla.issue.BugzillaIssue; -import org.netbeans.modules.bugzilla.query.BugzillaQuery; -import org.netbeans.modules.bugzilla.query.QueryParameter; -import org.netbeans.modules.bugzilla.repository.BugzillaConfiguration; -import org.netbeans.modules.bugzilla.repository.BugzillaRepository; -import org.netbeans.modules.bugzilla.repository.IssueField; -import org.netbeans.modules.bugzilla.util.BugzillaConstants; -import org.netbeans.modules.bugzilla.util.BugzillaUtil; -import org.netbeans.modules.team.spi.TeamAccessorUtils; -import org.netbeans.modules.team.spi.TeamBugtrackingConnector; -import org.openide.nodes.Node; -import org.openide.util.ImageUtilities; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; - -/** - * - * @author Tomas Stupka, Jan Stola - */ -public class KenaiRepository extends BugzillaRepository implements PropertyChangeListener { - - private String urlParam; - private Image icon; - private final String product; - private KenaiQuery myIssues; - private KenaiQuery allIssues; - private String host; - private final TeamProject kenaiProject; - - KenaiRepository(TeamProject kenaiProject, String repoName, String url, String host, String userName, char[] password, String urlParam, String product) { - super(createInfo(repoName, url, kenaiProject)); // use name as id - can't be changed anyway - this.urlParam = urlParam; - - if (url.contains("netbeans.org")) { //NOI18N - icon = ImageUtilities.loadImage("org/netbeans/modules/kenai/resources/netbeans-small.png", false); // NOI18N - } else if (url.contains("kenai.com")) { //NOI18N - icon = ImageUtilities.loadImage("org/netbeans/modules/kenai/resources/kenai-small.png", false); // NOI18N - } else if (url.contains("java.net")) { //NOI18N - icon = ImageUtilities.loadImage("org/netbeans/modules/kenai/resources/javanet.png", false); // NOI18N - } - - if(icon == null) { - // how is this possible ? - icon = ImageUtilities.loadImage("org/netbeans/modules/bugtracking/ui/resources/kenai-small.png", true); // NOI18N - } - - this.product = product; - this.host = host; - assert kenaiProject != null; - this.kenaiProject = kenaiProject; - TeamAccessor kenaiAccessor = TeamAccessorUtils.getTeamAccessor(url); - if (kenaiAccessor != null) { - kenaiAccessor.addPropertyChangeListener(this, kenaiProject.getWebLocation().toString()); - } - } - - public KenaiRepository(TeamProject kenaiProject, String repoName, String url, String host, String urlParam, String product) { - this(kenaiProject, repoName, url, host, getKenaiUser(kenaiProject), getKenaiPassword(kenaiProject), urlParam, product); - } - - @Override - public Image getIcon() { - return icon; - } - - @Override - public BugzillaQuery createQuery() { - KenaiQuery q = new KenaiQuery(null, this, null, product, false, false); - return q; - } - - @Override - public BugzillaQuery createPersistentQuery (String queryName, String urlParams, boolean urlDef) { - return new KenaiQuery(queryName, this, urlParams, product, true, false); - } - - @Override - public BugzillaIssue createIssue() { - return super.createIssue(); - } - - @Override - public synchronized Collection getQueries() { - List ret = new LinkedList(); - ret.addAll(super.getQueries()); - ret.addAll(getDefinedQueries()); - return ret; - } - - @Override - public Collection getUnsubmittedIssues () { - Set unsubmitted = new LinkedHashSet(super.getUnsubmittedIssues()); - for (Iterator it = unsubmitted.iterator(); it.hasNext(); ) { - BugzillaIssue issue = it.next(); - if (!product.equals(issue.getRepositoryFieldValue(IssueField.PRODUCT))) { - // coming from another team repository built on top of the same - // bugzilla instance - it.remove(); - } - } - return unsubmitted; - } - - private Collection getDefinedQueries() { - List queries = new ArrayList(); - - BugzillaQuery mi = getMyIssuesQuery(); - if(mi != null) { - queries.add(mi); - } - - BugzillaQuery ai = getAllIssuesQuery(); - if(ai != null) { - queries.add(ai); - } - - return queries; - } - - public TeamProject getKenaiProject() { - return kenaiProject; - } - - public synchronized BugzillaQuery getAllIssuesQuery() throws MissingResourceException { - if(!providePredefinedQueries() || BugzillaUtil.isNbRepository(this)) return null; - if (allIssues == null) { - StringBuffer url = new StringBuffer(); - url = new StringBuffer(); - url.append(urlParam); - url.append(MessageFormat.format(BugzillaConstants.ALL_ISSUES_PARAMETERS, product)); - allIssues = - new KenaiQuery( - TeamAccessorUtils.ALL_ISSUES_QUERY_DISPLAY_NAME, - this, - url.toString(), - product, - true, - true); - } - return allIssues; - } - - public synchronized BugzillaQuery getMyIssuesQuery() throws MissingResourceException { - if(!providePredefinedQueries()) return null; - if (myIssues == null) { - String url = getMyIssuesQueryUrl(); - myIssues = - new KenaiQuery( - TeamAccessorUtils.MY_ISSUES_QUERY_DISPLAY_NAME, - this, - url.toString(), - product, - true, - true); - } - return myIssues; - } - - private String getMyIssuesQueryUrl() { - StringBuilder url = new StringBuilder(); - url.append(urlParam); - String user = getKenaiUser(kenaiProject); - if (user == null) { - user = ""; // NOI18N - } - - // XXX what if user already mail address? - // XXX escape @? - String userMail = user + "@" + host; // NOI18N - String urlFormat = BugzillaUtil.isNbRepository(this) ? BugzillaConstants.NB_MY_ISSUES_PARAMETERS_FORMAT : BugzillaConstants.MY_ISSUES_PARAMETERS_FORMAT; - url.append(MessageFormat.format(urlFormat, product, userMail)); - return url.toString(); - } - - @Override - public synchronized void refreshConfiguration() { - KenaiConfiguration conf = (KenaiConfiguration) getConfiguration(); - conf.reset(); - super.refreshConfiguration(); - } - - @Override - protected BugzillaConfiguration createConfiguration(boolean forceRefresh) { - KenaiConfiguration kc = new KenaiConfiguration(this, product); - kc.initialize(this, forceRefresh); - return kc; - } - - @Override - public void ensureCredentials() { - authenticate(null); - } - - @Override - public boolean authenticate(String errroMsg) { - PasswordAuthentication pa = TeamAccessorUtils.getPasswordAuthentication(kenaiProject.getWebLocation().toString(), true); - if(pa == null) { - return false; - } - - String user = pa.getUserName(); - char[] password = pa.getPassword(); - - setTaskRepository(user, password); - - return true; - } - - public boolean isLoggedIn() { - return TeamAccessorUtils.isLoggedIn(kenaiProject.getWebLocation()); - } - - public boolean isMyIssues(BugzillaQuery q) { - return myIssues == q; - } - - /** - * Returns the name of the bz product - should be the same as the name of the kenai project that owns this repository - * @return - */ - public String getProductName () { - return product; - } - - private static String getKenaiUser(TeamProject kenaiProject) { - PasswordAuthentication pa = TeamAccessorUtils.getPasswordAuthentication(kenaiProject.getWebLocation().toString(), false); - if(pa != null) { - return pa.getUserName(); - } - return ""; // NOI18N - } - - private static char[] getKenaiPassword(TeamProject kenaiProject) { - PasswordAuthentication pa = TeamAccessorUtils.getPasswordAuthentication(kenaiProject.getWebLocation().toString(), false); - if(pa != null) { - return pa.getPassword(); - } - return new char[0]; // NOI18N - } - - @Override - protected QueryParameter[] getSimpleSearchParameters() { - List ret = new ArrayList(); - ret.add(new QueryParameter.SimpleQueryParameter("product", new String[] { product }, getTaskRepository().getCharacterEncoding() )); //NOI18N - - // XXX this relies on the fact that the user can't change the selection - // while the quicksearch is oppened. Works for now, but might change in the future - Node[] nodes = WindowManager.getDefault().getRegistry().getActivatedNodes(); - OwnerInfo ownerInfo = getOwnerInfo(nodes); - if(ownerInfo != null && ownerInfo.getOwner().equals(product)) { - List data = ownerInfo.getExtraData(); - if(data != null && data.size() > 0) { - ret.add(new QueryParameter.SimpleQueryParameter("component", new String[] { data.get(0) }, getTaskRepository().getCharacterEncoding())); //NOI18N - } - } - - return ret.toArray(new QueryParameter[0]); - } - - @Override - public Collection getUsers() { - return TeamAccessorUtils.getProjectMembers(kenaiProject); - } - - public String getHost() { - return host; - } - - private static String getRepositoryId(String name, String url) { - return TextUtils.encodeURL(url) + ":" + name; // NOI18N - } - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if(evt.getPropertyName().equals(TeamAccessor.PROP_LOGIN)) { - - // XXX move to spi? - // get kenai credentials - String user; - char[] psswd; - PasswordAuthentication pa = - TeamAccessorUtils.getPasswordAuthentication(kenaiProject.getWebLocation().toString(), false); // do not force login - if(pa != null) { - user = pa.getUserName(); - psswd = pa.getPassword(); - } else { - user = ""; // NOI18N - psswd = new char[0]; // NOI18N - } - - setTaskRepository(user, psswd); - - synchronized(KenaiRepository.this) { - if(evt.getNewValue() != null) { - if(myIssues != null) { - // XXX this is a mess - setting the controller and the query - KenaiQueryController c = (KenaiQueryController) myIssues.getController(); - String url = getMyIssuesQueryUrl(); - c.populate(url); - myIssues.setUrlParameters(url); - } - } - } - } - } - - @Override - public OwnerInfo getOwnerInfo(Node[] nodes) { - OwnerInfo ownerInfo = super.getOwnerInfo(nodes); - if(ownerInfo != null) { - if(ownerInfo.getOwner().equals(product)) { - return ownerInfo; - } else { - Bugzilla.LOG.log( - Level.WARNING, - " returned owner [{0}] for {1} is different then product [{2}]", - new Object[]{ - ownerInfo.getOwner(), - nodes[0], - product}); // NOI18N - return null; - } - } - return null; - } - - private boolean providePredefinedQueries() { - String provide = System.getProperty("org.netbeans.modules.bugzilla.noPredefinedQueries"); // NOI18N - return !"true".equals(provide); // NOI18N - } - - private static RepositoryInfo createInfo(String repoName, String url, TeamProject project) { - String id = getRepositoryId(repoName, url); - String tooltip = NbBundle.getMessage(BugzillaRepository.class, "LBL_RepositoryTooltipNoUser", new Object[] {repoName, url}); // NOI18N - RepositoryInfo i = new RepositoryInfo(id, BugzillaConnector.ID, url, repoName, tooltip); - i.putValue(TeamBugtrackingConnector.TEAM_PROJECT_NAME, project.getName()); - return i; - } - - @Override - protected RepositoryInfo createInfo(String id, String url, String name, String user, String httpUser, char[] password, char[] httpPassword, boolean localUserEnabled) { - RepositoryInfo i = super.createInfo(id, url, name, user, httpUser, password, httpPassword, localUserEnabled); - i.putValue(TeamBugtrackingConnector.TEAM_PROJECT_NAME, kenaiProject.getName()); - return i; - } - - -} diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java index 26a17f3eb911..396c39290bbf 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java @@ -67,7 +67,6 @@ import org.netbeans.modules.bugzilla.BugzillaConfig; import org.netbeans.modules.bugzilla.repository.BugzillaRepository; import org.netbeans.modules.bugzilla.issue.BugzillaIssue; -import org.netbeans.modules.bugzilla.kenai.KenaiRepository; import org.netbeans.modules.bugzilla.query.QueryParameter.AllWordsTextFieldParameter; import org.netbeans.modules.bugzilla.util.BugzillaUtil; import org.netbeans.modules.bugzilla.query.QueryParameter.CheckBoxParameter; @@ -258,9 +257,7 @@ public boolean providesMode(QueryMode mode) { public void opened() { wasOpened = true; if(query.isSaved()) { - setIssueCount(query.getSize()); // XXX this probably won't work - // if the query is alredy open and - // a refresh is invoked on kenai + setIssueCount(query.getSize()); if(!query.wasRun()) { onRefresh(); } diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java index 76cd6868e763..ffc7f9ece47e 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java @@ -26,7 +26,6 @@ import java.util.logging.Level; import javax.swing.JButton; import javax.swing.JPanel; -import javax.swing.SwingUtilities; import javax.swing.UIManager; import org.eclipse.core.runtime.CoreException; import org.netbeans.modules.bugtracking.api.Repository; @@ -37,7 +36,6 @@ import org.netbeans.modules.bugzilla.BugzillaConnector; import org.netbeans.modules.bugzilla.repository.BugzillaRepository; import org.netbeans.modules.bugzilla.issue.BugzillaIssue; -import org.netbeans.modules.bugzilla.kenai.KenaiRepository; import org.netbeans.modules.bugzilla.query.BugzillaQuery; import org.netbeans.modules.bugzilla.repository.BugzillaConfiguration; import org.netbeans.modules.mylyn.util.commands.GetRepositoryTasksCommand; @@ -156,11 +154,11 @@ public static boolean isNbRepository(String url) { } public static boolean showQAContact(BugzillaRepository repo) { - return NBBugzillaUtils.isNbRepository(repo.getUrl()) || !(repo instanceof KenaiRepository); + return true; } public static boolean showStatusWhiteboard(BugzillaRepository repo) { - return NBBugzillaUtils.isNbRepository(repo.getUrl()) || !(repo instanceof KenaiRepository); + return true; } public static boolean showIssueType(BugzillaRepository repo) { diff --git a/ide/git/src/org/netbeans/modules/git/Annotator.java b/ide/git/src/org/netbeans/modules/git/Annotator.java index ba243708b23f..f821dbc81ea8 100644 --- a/ide/git/src/org/netbeans/modules/git/Annotator.java +++ b/ide/git/src/org/netbeans/modules/git/Annotator.java @@ -229,7 +229,6 @@ public Image annotateIcon(Image icon, VCSContext context) { for (File file : context.getRootFiles()) { if (file.isDirectory()) { folderAnnotation = true; - Utils.addFolderToLog(file); break; } } diff --git a/ide/git/src/org/netbeans/modules/git/ui/blame/AnnotationBar.java b/ide/git/src/org/netbeans/modules/git/ui/blame/AnnotationBar.java index b2f3de6ebf20..01b7cb2f1ab2 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/blame/AnnotationBar.java +++ b/ide/git/src/org/netbeans/modules/git/ui/blame/AnnotationBar.java @@ -59,7 +59,6 @@ import org.netbeans.modules.git.ui.history.SearchHistoryAction; import org.netbeans.modules.git.ui.repository.Revision; import org.netbeans.modules.git.utils.GitUtils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.netbeans.spi.diff.DiffProvider; import org.openide.awt.Actions; import org.openide.util.actions.SystemAction; @@ -160,11 +159,6 @@ final class AnnotationBar extends JComponent implements Accessible, PropertyChan */ private File repositoryRoot; - /** - * Holdes kenai users - */ - private Map kenaiUsersMap = null; - /* * Holds parent/previous revisions for each line revision */ @@ -288,7 +282,7 @@ public void setAnnotationMessage(String message) { public void annotationLines (File file, List annotateLines) { // set repository root for popup menu, now should be the right time repositoryRoot = Git.getInstance().getRepositoryRoot(getCurrentFile()); - final List lines = new LinkedList(annotateLines); + final List lines = new LinkedList<>(annotateLines); int lineCount = lines.size(); /** 0 based line numbers => 1 based line numbers*/ final int ann2editorPermutation[] = new int[lineCount]; @@ -358,11 +352,9 @@ public void annotationLines (File file, List annotateLines) { @Override public void run() { StyledDocument sd = (StyledDocument) doc; - Iterator it = lines.iterator(); - previousRevisions = Collections.synchronizedMap(new HashMap()); - elementAnnotations = Collections.synchronizedMap(new HashMap(lines.size())); - while (it.hasNext()) { - AnnotateLine line = it.next(); + previousRevisions = Collections.synchronizedMap(new HashMap<>()); + elementAnnotations = Collections.synchronizedMap(new HashMap<>(lines.size())); + for (AnnotateLine line : lines) { int lineNum = ann2editorPermutation[line.getLineNum() -1]; try { int lineOffset = NbDocument.findLineOffset(sd, lineNum -1); @@ -374,24 +366,7 @@ public void run() { } } }); - -// final String url = HgUtils.getRemoteRepository(repositoryRoot); -// final boolean isKenaiRepository = url != null && HgKenaiAccessor.getInstance().isKenai(url); -// if(isKenaiRepository) { -// kenaiUsersMap = new HashMap(); -// Iterator it = lines.iterator(); -// while (it.hasNext()) { -// AnnotateLine line = it.next(); -// String author = line.getAuthor(); -// if(author != null && !author.equals("") && !kenaiUsersMap.keySet().contains(author)) { -// KenaiUser ku = HgKenaiAccessor.getInstance().forName(author, url); -// if(ku != null) { -// kenaiUsersMap.put(author, ku); -// } -// } -// } -// } - + // lazy listener registration caret = textComponent.getCaret(); if (caret != null) { @@ -644,23 +619,6 @@ public void run() { popupMenu.add(previousAnnotationsMenu); previousAnnotationsMenu.setVisible(false); - if(isKenai() && al != null) { - String author = al.getAuthor().toString(); - final int lineNr = al.getLineNum(); - final KenaiUser ku = kenaiUsersMap.get(author); - if(ku != null) { - popupMenu.addSeparator(); - JMenuItem chatMenu = new JMenuItem(NbBundle.getMessage(AnnotationBar.class, "CTL_MenuItem_Chat", author)); - chatMenu.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - ku.startChat(KenaiUser.getChatLink(getCurrentFileObject(), lineNr)); - } - }); - popupMenu.add(chatMenu); - } - } - JSeparator separator = new JPopupMenu.Separator(); popupMenu.add(separator); @@ -944,12 +902,12 @@ public void run() { AnnotationMarkProvider amp = AnnotationMarkInstaller.getMarkProvider(textComponent); if (amp != null) { - List marks = new ArrayList(elementAnnotations.size()); + List marks = new ArrayList<>(elementAnnotations.size()); // I cannot affort to lock elementAnnotations for long time // it's accessed from editor thread too Iterator> it2; synchronized(elementAnnotations) { - it2 = new HashSet>(elementAnnotations.entrySet()).iterator(); + it2 = new HashSet<>(elementAnnotations.entrySet()).iterator(); } while (it2.hasNext()) { Map.Entry next = it2.next(); @@ -1026,9 +984,7 @@ private int getBarWidth() { longestString = elementAnnotationsSubstitute; } else { synchronized(elementAnnotations) { - Iterator it = elementAnnotations.values().iterator(); - while (it.hasNext()) { - AnnotateLine line = it.next(); + for (AnnotateLine line : elementAnnotations.values()) { String displayName = getDisplayName(line); // NOI18N if (displayName.length() > longestString.length()) { longestString = displayName; @@ -1038,7 +994,7 @@ private int getBarWidth() { } char[] data = longestString.toCharArray(); int w = getGraphics().getFontMetrics(component.getFont()).charsWidth(data, 0, data.length); - return w + 4 + (isKenai() ? 18 : 0); + return w + 4; } @NbBundle.Messages({ @@ -1122,17 +1078,6 @@ private void paintView(View view, Graphics g, int yBase) { g.drawString(annotation, textx, texty); } - boolean isKenai() { - return kenaiUsersMap != null && kenaiUsersMap.size() > 0; - } - - KenaiUser getKenaiUser(String author) { - if(kenaiUsersMap == null) { - return null; - } - return kenaiUsersMap.get(author); - } - /** * Presents commit message as tooltips. */ @@ -1438,7 +1383,7 @@ public void componentShown(ComponentEvent e) { private Map getPreviousRevisions () { Map revisions = previousRevisions; - return revisions == null ? new HashMap(0) : revisions; + return revisions == null ? new HashMap<>(0) : revisions; } /** diff --git a/ide/git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java b/ide/git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java index bd99dfe35782..5c48e7a7e4a7 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java +++ b/ide/git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java @@ -60,11 +60,9 @@ import org.netbeans.modules.git.Git; import org.netbeans.modules.git.ui.history.SearchHistoryAction; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport; -import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.AuthorLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.IssueLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.StyledDocumentHyperlink; import org.netbeans.modules.versioning.util.VCSHyperlinkProvider; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.openide.util.Exceptions; /** @@ -265,29 +263,9 @@ public TooltipContentPanel(JTextComponent parentPane) { } // author - { - String author = annotateLine.getAuthor().toString(); - StyledDocumentHyperlink l = linkerSupport.getLinker(AuthorLinker.class, 0); - if (master.isKenai()) { - KenaiUser kenaiUser = master.getKenaiUser(author); - if (kenaiUser != null) { - l = new AuthorLinker( - kenaiUser, - authorStyle, - doc, - author, - KenaiUser.getChatLink( - master.getCurrentFileObject(), - annotateLine.getLineNum())); - linkerSupport.add(l, 0); - } - } - if (l != null) { - l.insertString(doc, authorStyle); - } else { - doc.insertString(doc.getLength(), author, normalStyle); - } - } + String author = annotateLine.getAuthor().toString(); + doc.insertString(doc.getLength(), author, normalStyle); + // date doc.insertString(doc.getLength(), " ", normalStyle); doc.insertString(doc.getLength(), DateFormat.getDateInstance().format(new Date(annotateLine.getRevisionInfo().getCommitTime())), normalStyle); diff --git a/ide/git/src/org/netbeans/modules/git/ui/history/SearchExecutor.java b/ide/git/src/org/netbeans/modules/git/ui/history/SearchExecutor.java index a0c8cd74eba0..34a4256c8870 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/history/SearchExecutor.java +++ b/ide/git/src/org/netbeans/modules/git/ui/history/SearchExecutor.java @@ -36,7 +36,6 @@ import org.netbeans.modules.git.ui.repository.RepositoryInfo; import org.netbeans.modules.git.ui.repository.Revision; import org.netbeans.modules.git.utils.GitUtils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; import org.openide.util.NbBundle; /** @@ -46,7 +45,7 @@ */ class SearchExecutor extends GitProgressSupport { - private final SearchHistoryPanel master; + private final SearchHistoryPanel master; private final int limitRevisions; private final boolean showMerges; private final String message; @@ -226,12 +225,11 @@ private List appendResults (GitRevisionInfo[] logMessages, C } private void setResults (final List results) { - final Map kenaiUserMap = SearchHistoryPanel.createKenaiUsersMap(results); EventQueue.invokeLater(() -> { if(results.isEmpty()) { - master.setResults(null, kenaiUserMap, -1); + master.setResults(null, -1); } else { - master.setResults(results, kenaiUserMap, limitRevisions); + master.setResults(results, limitRevisions); } }); } diff --git a/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryPanel.java b/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryPanel.java index 035f24018917..d978839c9f7a 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryPanel.java +++ b/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryPanel.java @@ -69,7 +69,6 @@ import org.netbeans.modules.git.ui.history.SummaryView.GitLogEntry; import org.netbeans.modules.git.ui.repository.RepositoryInfo; import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; import org.openide.awt.Actions; import org.openide.util.ImageUtilities; import org.openide.util.WeakListeners; @@ -104,7 +103,6 @@ class SearchHistoryPanel extends javax.swing.JPanel implements ExplorerManager.P private static final Icon ICON_EXPANDED = UIManager.getIcon("Tree.expandedIcon"); //NOI18N private int showingResults; - private Map kenaiUserMap; private List logEntries; private boolean selectFirstRevision; private DiffResultsViewFactory diffViewFactory; @@ -291,7 +289,7 @@ final void refreshComponents(boolean refreshResults) { } else { if (tbSummary.isSelected()) { if (summaryView == null) { - summaryView = new SummaryView(this, logEntries = createLogEntries(results), kenaiUserMap); + summaryView = new SummaryView(this, logEntries = createLogEntries(results)); } resultsPanel.add(summaryView.getComponent()); summaryView.requestFocusInWindow(); @@ -337,13 +335,12 @@ final void updateActions () { prevAction.setEnabled(!tbSummary.isSelected() && diffView != null && diffView.isPrevEnabled()); } - void setResults (List newResults, Map kenaiUserMap, int limit) { - setResults(newResults, kenaiUserMap, false, limit); + void setResults(List newResults, int limit) { + setResults(newResults, false, limit); } - private void setResults (List newResults, Map kenaiUserMap, boolean searching, int limit) { + private void setResults(List newResults, boolean searching, int limit) { this.results = newResults; - this.kenaiUserMap = kenaiUserMap; this.searchInProgress = searching; showingResults = limit; if (newResults != null && newResults.size() < limit) { @@ -366,7 +363,7 @@ public SearchCriteriaPanel getCriteria() { void executeSearch() { searchStarted = true; cancelBackgroundTasks(); - setResults(null, null, true, -1); + setResults(null, true, -1); GitModuleConfig.getDefault().setShowHistoryMerges(criteria.isIncludeMerges()); if (currentBranch != null) { // search history opened with request to work only on current branch @@ -674,11 +671,6 @@ boolean hasMoreResults () { return showingResults > -1; } - static Map createKenaiUsersMap (List results) { - // TODO implement kenai support for git - return Collections.emptyMap(); - } - void getMoreRevisions (PropertyChangeListener callback, int count) { if (currentSearch == null) { throw new IllegalStateException("No search task active"); //NOI18N @@ -819,41 +811,36 @@ protected void perform () { GitClientExceptionHandler.notifyException(ex, true); return; } - final Map additionalUsersMap = createKenaiUsersMap(newResults); if (!isCanceled()) { - EventQueue.invokeLater(new Runnable() { - @Override - public void run () { - if (!isCanceled()) { - Set visibleRevisions = new HashSet<>(results.size()); - for (RepositoryRevision rev : results) { - visibleRevisions.add(rev.getLog().getRevision()); - } - - List toAdd = new ArrayList<>(newResults.size()); - for (RepositoryRevision rev : newResults) { - if (!visibleRevisions.contains(rev.getLog().getRevision())) { - toAdd.add(rev); - } - } - results.addAll(toAdd); - if (count == -1) { - showingResults = -1; - } else { - showingResults = count; - } - if (showingResults > newResults.size()) { - showingResults = -1; - } - logEntries = createLogEntries(results); - kenaiUserMap.putAll(additionalUsersMap); - if (diffView != null) { - diffView.refreshResults(results); - } - if (summaryView != null) { - summaryView.entriesChanged(logEntries); + EventQueue.invokeLater(() -> { + if (!isCanceled()) { + Set visibleRevisions = new HashSet<>(results.size()); + for (RepositoryRevision rev : results) { + visibleRevisions.add(rev.getLog().getRevision()); + } + + List toAdd = new ArrayList<>(newResults.size()); + for (RepositoryRevision rev : newResults) { + if (!visibleRevisions.contains(rev.getLog().getRevision())) { + toAdd.add(rev); } } + results.addAll(toAdd); + if (count == -1) { + showingResults = -1; + } else { + showingResults = count; + } + if (showingResults > newResults.size()) { + showingResults = -1; + } + logEntries = createLogEntries(results); + if (diffView != null) { + diffView.refreshResults(results); + } + if (summaryView != null) { + summaryView.entriesChanged(logEntries); + } } }); } diff --git a/ide/git/src/org/netbeans/modules/git/ui/history/SummaryView.java b/ide/git/src/org/netbeans/modules/git/ui/history/SummaryView.java index 28d76be19c22..a0140d7755bf 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/history/SummaryView.java +++ b/ide/git/src/org/netbeans/modules/git/ui/history/SummaryView.java @@ -52,7 +52,6 @@ import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight; import org.netbeans.modules.versioning.spi.VCSContext; import org.netbeans.modules.versioning.util.Utils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.openide.filesystems.FileUtil; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; @@ -289,12 +288,12 @@ public String toString () { return event.toString(); } } - - public SummaryView (SearchHistoryPanel master, List results, Map kenaiUserMap) { - super(createViewSummaryMaster(master), results, kenaiUserMap); + + public SummaryView(SearchHistoryPanel master, List results) { + super(createViewSummaryMaster(master), results); this.master = master; } - + private static SummaryViewMaster createViewSummaryMaster (final SearchHistoryPanel master) { final Map colors = Map.of( "A", GitUtils.getColorString(AnnotationColorProvider.getInstance().ADDED_FILE.getActualColor()), diff --git a/ide/mercurial/nbproject/org-netbeans-modules-mercurial.sig b/ide/mercurial/nbproject/org-netbeans-modules-mercurial.sig index 361d33342787..7a4112d6afae 100644 --- a/ide/mercurial/nbproject/org-netbeans-modules-mercurial.sig +++ b/ide/mercurial/nbproject/org-netbeans-modules-mercurial.sig @@ -1,5 +1,5 @@ #Signature file v4.1 -#Version 1.65.0 +#Version 1.66.0 CLSS public java.lang.Object cons public init() @@ -22,11 +22,7 @@ meth public static boolean isClientAvailable(boolean) meth public static boolean isRepository(java.lang.String) meth public static java.io.File openCloneWizard(java.lang.String,boolean) throws java.net.MalformedURLException meth public static void addRecentUrl(java.lang.String) throws java.net.MalformedURLException -meth public static void cloneRepository(java.lang.String,java.io.File,java.lang.String,java.lang.String,java.lang.String) throws java.net.MalformedURLException - anno 0 java.lang.Deprecated() meth public static void cloneRepository(java.lang.String,java.io.File,java.lang.String,java.lang.String,java.lang.String,boolean) throws java.net.MalformedURLException -meth public static void cloneRepository(java.lang.String,java.io.File,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.net.MalformedURLException - anno 0 java.lang.Deprecated() meth public static void cloneRepository(java.lang.String,java.io.File,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean) throws java.net.MalformedURLException meth public static void commit(java.io.File[],java.lang.String) meth public static void openCloneWizard(java.lang.String) throws java.net.MalformedURLException diff --git a/ide/mercurial/nbproject/project.properties b/ide/mercurial/nbproject/project.properties index 3efb2aadc321..86231a992a77 100644 --- a/ide/mercurial/nbproject/project.properties +++ b/ide/mercurial/nbproject/project.properties @@ -19,7 +19,7 @@ javac.source=1.8 nbm.homepage=http://wiki.netbeans.org/wiki/view/MercurialVersionControl nbm.module.author=John Rice and Padraig O'Briain nbm.needs.restart=true -spec.version.base=1.66.0 +spec.version.base=2.0.0 #qa-functional test.qa-functional.cp.extra=${openide.nodes.dir}/modules/org-openide-nodes.jar:\${openide.util.dir}/lib/org-openide-util.jar:${openide.util.ui.dir}/lib/org-openide-util-ui.jar diff --git a/ide/mercurial/nbproject/project.xml b/ide/mercurial/nbproject/project.xml index 33219349a200..3116d523f0f5 100644 --- a/ide/mercurial/nbproject/project.xml +++ b/ide/mercurial/nbproject/project.xml @@ -417,7 +417,6 @@ org.netbeans.modules.bugtracking.bridge - org.netbeans.modules.kenai.ui org.netbeans.modules.mercurial.api diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/Mercurial.java b/ide/mercurial/src/org/netbeans/modules/mercurial/Mercurial.java index b9835aaf66aa..947824fa2454 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/Mercurial.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/Mercurial.java @@ -39,7 +39,6 @@ import org.openide.filesystems.FileUtil; import org.netbeans.modules.mercurial.util.HgCommand; import org.openide.util.NbBundle; -import org.netbeans.modules.mercurial.kenai.HgKenaiAccessor; import org.netbeans.modules.mercurial.ui.log.HgLogMessage.HgRevision; import org.netbeans.modules.mercurial.ui.repository.HgURL; import org.netbeans.modules.mercurial.ui.shelve.ShelveChangesAction; @@ -198,7 +197,6 @@ public void asyncInit() { Runnable init = new Runnable() { @Override public void run() { - HgKenaiAccessor.getInstance().registerVCSNoficationListener(); synchronized(Mercurial.this) { checkVersionIntern(); } diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java b/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java index 3c629e0475db..0f1b15b99434 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java @@ -174,7 +174,6 @@ public Image annotateIcon(Image icon, VCSContext context) { for (File file : context.getRootFiles()) { if (file.isDirectory()) { folderAnnotation = true; - Utils.addFolderToLog(file); break; } } diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/api/Mercurial.java b/ide/mercurial/src/org/netbeans/modules/mercurial/api/Mercurial.java index eb286a9404d1..6c334cd0083b 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/api/Mercurial.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/api/Mercurial.java @@ -61,38 +61,8 @@ public class Mercurial { /** - *

Depracated, use {@link #cloneRepository(String,File,String,String,String,boolean)} instead.

* Clones the given repository to the given directory. The method blocks - * until the whole chcekout is done. Do not call in AWT. - * After the clone a scan for netbeans projects will be started. - * - * @param repositoryUrl URL of the Mercurial repository to be cloned - * @param targetDir target where cloned repository should be created - * @param cloneName name of the cloned repository - * (name of the root folder of the clone) - * @param defaultPull initial URL for pulling updates - * @param defaultPush initial URL for pushing updates - */ - @Deprecated - public static void cloneRepository(String repositoryUrl, - File targetDir, - String cloneName, - String defaultPull, - String defaultPush) throws MalformedURLException { - assert !SwingUtilities.isEventDispatchThread() : "Accessing remote repository. Do not call in awt!"; - cloneRepository(repositoryUrl, - targetDir, - cloneName, - defaultPull, - defaultPush, - null, - null, - true); - } - - /** - * Clones the given repository to the given directory. The method blocks - * until the whole chcekout is done. Do not call in AWT. + * until the whole checkout is done. Do not call in AWT. * * @param repositoryUrl URL of the Mercurial repository to be cloned * @param targetDir target where cloned repository should be created @@ -119,43 +89,9 @@ public static void cloneRepository(String repositoryUrl, scanForProjects); } - /** - *

Depracated, use {@link #cloneRepository(String,File,String,String,String,String,String,boolean)} instead.

- * Clones the given repository to the given directory. The method blocks - * until the whole chcekout is done. Do not call in AWT. - * After the clone a scan for netbeans projects will be started. - * - * @param repositoryUrl URL of the Mercurial repository to be cloned - * @param targetDir target where cloned repository should be created - * @param cloneName name of the cloned repository - * (name of the root folder of the clone) - * @param defaultPull initial URL for pulling updates - * @param defaultPush initial URL for pushing updates - * @param username username for access to the given repository - * @param password password for access to the given repository - */ - @Deprecated - public static void cloneRepository(String repositoryUrl, - File targetDir, - String cloneName, - String pullUrl, - String pushUrl, - String username, - String password) - throws MalformedURLException { - cloneRepository(repositoryUrl, - targetDir, - cloneName, - pullUrl, - pushUrl, - username, - password, - true); - } - /** * Clones the given repository to the given directory. The method blocks - * until the whole chcekout is done. Do not call in AWT. + * until the whole checkout is done. Do not call in AWT. * * @param repositoryUrl URL of the Mercurial repository to be cloned * @param targetDir target where cloned repository should be created diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/Bundle.properties b/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/Bundle.properties deleted file mode 100644 index 7b2bd4176364..000000000000 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/Bundle.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -MSG_NotificationBubble_Description=The following file(s) were changed:<\br>{0} \ - Show revision details diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/HgKenaiAccessor.java b/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/HgKenaiAccessor.java deleted file mode 100644 index 86360541194e..000000000000 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/HgKenaiAccessor.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.mercurial.kenai; - -import java.beans.PropertyChangeListener; -import java.io.File; -import java.net.PasswordAuthentication; -import java.util.HashSet; -import java.util.Set; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; -import org.openide.util.Lookup; - -/** - * - * @author Tomas Stupka, Ondra Vrabec - */ -public class HgKenaiAccessor { - - private static HgKenaiAccessor instance; - private VCSKenaiAccessor kenaiAccessor = null; - private Set queriedUrls = new HashSet(5); - - private HgKenaiAccessor() { - kenaiAccessor = Lookup.getDefault().lookup(VCSKenaiAccessor.class); - } - - public static HgKenaiAccessor getInstance() { - if(instance == null) { - instance = new HgKenaiAccessor(); - } - return instance; - } - - public boolean isKenai(String url) { - return kenaiAccessor != null && kenaiAccessor.isKenai(url); - } - - public boolean isLoggedIntoKenai (String url) { - return kenaiAccessor != null && kenaiAccessor.isLogged(url); - } - - public PasswordAuthentication getPasswordAuthentication(String url, boolean forceRelogin) { - if(kenaiAccessor != null) { - if(forceRelogin && queriedUrls.contains(url)) { - // we already queried the authentication for this url, but it didn't - // seem to be accepted -> force a new login, the current user - // might not be authorized for the given kenai project (url). - if(!kenaiAccessor.showLogin()) { - return null; - } - } - queriedUrls.add(url); - return kenaiAccessor.getPasswordAuthentication(url); - } else { - return null; - } - } - - public boolean isUserOnline(String user) { - return kenaiAccessor != null ? kenaiAccessor.isUserOnline(user) : false; - } - - public KenaiUser forName(String user, String url) { - return kenaiAccessor != null ? kenaiAccessor.forName(user, url) : null; - } - - public String getRevisionUrl(String repositoryUrl, String revision) { - return kenaiAccessor == null ? null : kenaiAccessor.getRevisionUrl(repositoryUrl, revision); - } - - private void removeVCSNoficationListener(PropertyChangeListener l) { - if(kenaiAccessor != null) { - kenaiAccessor.removeVCSNoficationListener(l); - } - } - - private void addVCSNoficationListener(PropertyChangeListener l) { - if(kenaiAccessor != null) { - kenaiAccessor.addVCSNoficationListener(l); - } - } - - public void registerVCSNoficationListener() { - if("true".equals(System.getProperty("kenai.vcs.notifications.ignore"))) { - return; - } - addVCSNoficationListener(new KenaiNotificationListener()); - } - - /** - * Returns false only when the given repository is a kenai one, current user is logged in and does not have read access rights - * @param repositoryUrl - * @return - */ - public boolean canRead (String repositoryUrl) { - return isAuthorized(repositoryUrl, VCSKenaiAccessor.RepositoryActivity.READ); - } - - /** - * Returns false only when the given repository is a kenai one, current user is logged in and does not have push access rights - * @param repositoryUrl - * @return - */ - public boolean canWrite (String repositoryUrl) { - return isAuthorized(repositoryUrl, VCSKenaiAccessor.RepositoryActivity.WRITE); - } - - private boolean isAuthorized (String repositoryUrl, VCSKenaiAccessor.RepositoryActivity permission) { - return kenaiAccessor == null || !kenaiAccessor.isLogged(repositoryUrl) || kenaiAccessor.isAuthorized(repositoryUrl, permission); - } - -} diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/KenaiNotificationListener.java b/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/KenaiNotificationListener.java deleted file mode 100644 index d92a8ae7cb36..000000000000 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/kenai/KenaiNotificationListener.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.mercurial.kenai; - -import java.io.File; -import java.net.URL; -import java.util.LinkedList; -import java.util.List; -import javax.swing.JTextPane; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; -import org.netbeans.modules.mercurial.FileInformation; -import org.netbeans.modules.mercurial.Mercurial; -import org.netbeans.modules.mercurial.util.HgUtils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.VCSKenaiModification; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.VCSKenaiNotification; -import org.openide.awt.HtmlBrowser; -import org.openide.util.NbBundle; - -/** - * - * @author Tomas Stupka - */ -public class KenaiNotificationListener extends VCSKenaiAccessor.KenaiNotificationListener { - - protected void handleVCSNotification(final VCSKenaiNotification notification) { - if(notification.getService() != VCSKenaiAccessor.Service.VCS_HG) { - Mercurial.LOG.fine("rejecting VCS notification " + notification + " because not from hg"); // NOI18N - return; - } - File projectDir = notification.getProjectDirectory(); - if(!Mercurial.getInstance().isManaged(projectDir)) { - assert false : " project " + projectDir + " not managed"; - Mercurial.LOG.fine("rejecting VCS notification " + notification + " for " + projectDir + " because not versioned by hg"); // NOI18N - return; - } - Mercurial.LOG.fine("accepting VCS notification " + notification + " for " + projectDir); // NOI18N - - File[] files = Mercurial.getInstance().getFileStatusCache().listFiles(new File[] { projectDir }, FileInformation.STATUS_LOCAL_CHANGE); - List modifications = notification.getModifications(); - - List notifyFiles = new LinkedList(); - String revision = null; - for (File file : files) { - String path = HgUtils.getRelativePath(file); - if(path == null) { - assert false : file.getAbsolutePath() + " - no relative path"; // NOI18N - continue; - } - path = trim(path); - for (VCSKenaiModification modification : modifications) { - String resource = modification.getResource(); - resource = trim(resource); - LOG.finer(" changed file " + path + ", " + resource); // NOI18N - if(path.equals(resource)) { - LOG.fine(" will notify " + file + ", " + notification); // NOI18N - notifyFiles.add(file); - if(revision == null) { - revision = modification.getId(); - } - break; - } - } - } - if(notifyFiles.size() > 0) { - notifyFileChange(notifyFiles.toArray(new File[0]), projectDir, notification.getUri().toString(), revision); - } - } - - @Override - protected void setupPane(JTextPane pane, final File[] files, final File projectDir, final String url, final String revision) { - String text = NbBundle.getMessage( - KenaiNotificationListener.class, - "MSG_NotificationBubble_Description", - getFileNames(files), - HgKenaiAccessor.getInstance().getRevisionUrl(url, revision)); //NOI18N - pane.setText(text); - - pane.addHyperlinkListener(new HyperlinkListener() { - public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { - URL url = e.getURL(); - assert url != null; - HtmlBrowser.URLDisplayer displayer = HtmlBrowser.URLDisplayer.getDefault (); - assert displayer != null : "HtmlBrowser.URLDisplayer found."; //NOI18N - if (displayer != null) { - displayer.showURL (url); - } else { - Mercurial.LOG.info("No URLDisplayer found."); //NOI18N - } - } - } - }); - } - -} diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotationBar.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotationBar.java index eec55dcb8f9b..203b41b9415a 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotationBar.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotationBar.java @@ -88,7 +88,6 @@ import org.netbeans.modules.mercurial.Mercurial; import org.netbeans.modules.mercurial.OutputLogger; import org.netbeans.modules.mercurial.WorkingCopyInfo; -import org.netbeans.modules.mercurial.kenai.HgKenaiAccessor; import org.netbeans.modules.mercurial.ui.diff.DiffAction; import org.netbeans.modules.mercurial.ui.log.HgLogMessage; import org.netbeans.modules.mercurial.ui.log.HgLogMessage.HgRevision; @@ -98,7 +97,6 @@ import org.netbeans.modules.mercurial.util.HgCommand; import org.netbeans.modules.mercurial.util.HgUtils; import org.netbeans.modules.versioning.util.Utils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.netbeans.spi.diff.DiffProvider; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; @@ -205,11 +203,6 @@ final class AnnotationBar extends JComponent implements Accessible, PropertyChan */ private File repositoryRoot; - /** - * Holdes kenai users - */ - private Map kenaiUsersMap = null; - /* * Holds parent/previous revisions for each line revision */ @@ -380,22 +373,6 @@ public void run() { }); final String url = HgUtils.getRemoteRepository(repositoryRoot); - final boolean isKenaiRepository = url != null && HgKenaiAccessor.getInstance().isKenai(url); - if(isKenaiRepository) { - kenaiUsersMap = new HashMap(); - Iterator it = lines.iterator(); - while (it.hasNext()) { - AnnotateLine line = it.next(); - String author = line.getAuthor(); - if(author != null && !author.equals("") && !kenaiUsersMap.containsKey(author)) { - KenaiUser ku = HgKenaiAccessor.getInstance().forName(author, url); - if(ku != null) { - kenaiUsersMap.put(author, ku); - } - } - } - } - // lazy listener registration caret = textComponent.getCaret(); if (caret != null) { @@ -631,23 +608,6 @@ public void run() { }); popupMenu.add(previousAnnotationsMenu); - if(isKenai() && al != null) { - String author = al.getAuthor(); - final int lineNr = al.getLineNum(); - final KenaiUser ku = kenaiUsersMap.get(author); - if(ku != null) { - popupMenu.addSeparator(); - JMenuItem chatMenu = new JMenuItem(NbBundle.getMessage(AnnotationBar.class, "CTL_MenuItem_Chat", author)); - chatMenu.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - ku.startChat(KenaiUser.getChatLink(getCurrentFileObject(), lineNr)); - } - }); - popupMenu.add(chatMenu); - } - } - JMenuItem menu; menu = new JMenuItem(loc.getString("CTL_MenuItem_CloseAnnotations")); // NOI18N menu.addActionListener(new ActionListener() { @@ -990,9 +950,7 @@ private int getBarWidth() { longestString = elementAnnotationsSubstitute; } else { synchronized(elementAnnotations) { - Iterator it = elementAnnotations.values().iterator(); - while (it.hasNext()) { - AnnotateLine line = it.next(); + for (AnnotateLine line : elementAnnotations.values()) { String displayName = getDisplayName(line); // NOI18N if (displayName.length() > longestString.length()) { longestString = displayName; @@ -1002,7 +960,7 @@ private int getBarWidth() { } char[] data = longestString.toCharArray(); int w = getGraphics().getFontMetrics().charsWidth(data, 0, data.length); - return w + 4 + (isKenai() ? 18 : 0); + return w + 4; } private String getDisplayName(AnnotateLine line) { @@ -1079,17 +1037,6 @@ private void paintView(View view, Graphics g, int yBase) { g.drawString(annotation, textx, texty); } - boolean isKenai() { - return kenaiUsersMap != null && kenaiUsersMap.size() > 0; - } - - KenaiUser getKenaiUser(String author) { - if(kenaiUsersMap == null) { - return null; - } - return kenaiUsersMap.get(author); - } - /** * Presents commit message as tooltips. */ diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/TooltipWindow.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/TooltipWindow.java index e79e6c135379..58621c124837 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/TooltipWindow.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/TooltipWindow.java @@ -59,11 +59,9 @@ import org.netbeans.modules.mercurial.Mercurial; import org.netbeans.modules.mercurial.ui.log.LogAction; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport; -import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.AuthorLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.IssueLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.StyledDocumentHyperlink; import org.netbeans.modules.versioning.util.VCSHyperlinkProvider; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.openide.util.Exceptions; /** @@ -255,29 +253,8 @@ public TooltipContentPanel(JTextComponent parentPane) { } // author - { - String author = annotateLine.getAuthor(); - StyledDocumentHyperlink l = linkerSupport.getLinker(AuthorLinker.class, 0); - if (master.isKenai()) { - KenaiUser kenaiUser = master.getKenaiUser(author); - if (kenaiUser != null) { - l = new AuthorLinker( - kenaiUser, - authorStyle, - doc, - author, - KenaiUser.getChatLink( - master.getCurrentFileObject(), - annotateLine.getLineNum())); - linkerSupport.add(l, 0); - } - } - if (l != null) { - l.insertString(doc, authorStyle); - } else { - doc.insertString(doc.getLength(), author, normalStyle); - } - } + String author = annotateLine.getAuthor(); + doc.insertString(doc.getLength(), author, normalStyle); // date doc.insertString(doc.getLength(), " ", normalStyle); diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java index d905089531e3..aa29cff2db2e 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java @@ -19,7 +19,6 @@ package org.netbeans.modules.mercurial.ui.clone; import org.netbeans.modules.versioning.util.Utils; -import java.net.PasswordAuthentication; import java.net.URISyntaxException; import java.util.MissingResourceException; import org.netbeans.modules.versioning.spi.VCSContext; @@ -32,7 +31,6 @@ import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectManager; import org.netbeans.modules.mercurial.HgException; -import org.netbeans.modules.mercurial.kenai.HgKenaiAccessor; import org.netbeans.modules.mercurial.HgProgressSupport; import org.netbeans.modules.mercurial.Mercurial; import org.netbeans.modules.mercurial.OutputLogger; @@ -51,7 +49,6 @@ import org.openide.util.Utilities; import static org.netbeans.modules.mercurial.ui.properties.HgProperties.HGPROPNAME_DEFAULT_PULL; import static org.netbeans.modules.mercurial.ui.properties.HgProperties.HGPROPNAME_DEFAULT_PUSH; -import static org.netbeans.modules.mercurial.ui.properties.HgProperties.HGPROPNAME_USERNAME; /** * Clone action for mercurial: @@ -218,15 +215,7 @@ public List call () throws Exception { HgConfigFiles hgConfigFiles = new HgConfigFiles(target); if (hgConfigFiles.getException() == null) { Utils.logVCSExternalRepository("HG", source.toHgCommandUrlStringWithoutUserInfo()); //NOI18N - if (source.isKenaiURL()) { - initializeDefaultPullPushUrlForKenai(hgConfigFiles); - String kenaiUserName = getKenaiUserName(); - if (kenaiUserName != null) { - hgConfigFiles.setProperty(HGPROPNAME_USERNAME, kenaiUserName); - } - } else { - initializeDefaultPullPushUrl(hgConfigFiles); - } + initializeDefaultPullPushUrl(hgConfigFiles); } else { Mercurial.LOG.log(Level.WARNING, "{0}: Cannot set default push and pull path", this.getClass().getName()); // NOI18N Mercurial.LOG.log(Level.INFO, null, hgConfigFiles.getException()); @@ -288,51 +277,6 @@ private void initializeDefaultPullPushUrl(HgConfigFiles hgConfigFiles) { } } - private void initializeDefaultPullPushUrlForKenai(HgConfigFiles hgConfigFiles) { - /* - * Mercurial itself sets just "default" in 'hgrc' file. - * We make sure that "default-push" is set, too - see - * bug #125835 ("default-push should be set - * automatically"). Because Kenai username and password - * should not be saved, we also modify the "default" - we - * strip the userdata (username and password) if any. - */ - if ((pullPath == null) && (pushPath == null)) { - String defaultPull = hgConfigFiles.getDefaultPull(false); - String modifiedPullUrl = HgURL.stripUserInfo(defaultPull); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PULL, modifiedPullUrl); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PUSH, modifiedPullUrl); - - } else if ((pullPath != null) && (pushPath == null)) { - String defaultPull = pullPath.toHgCommandUrlStringWithoutUserInfo(); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PULL, defaultPull); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PUSH, defaultPull); - - } else if ((pullPath == null) && (pushPath != null)) { - String defaultPull = hgConfigFiles.getDefaultPull(false); - String modifiedPullUrl = HgURL.stripUserInfo(defaultPull); - String defaultPush = pushPath.toHgCommandUrlStringWithoutUserInfo(); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PULL, modifiedPullUrl); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PUSH, defaultPush); - - } else if ((pullPath != null) && (pushPath != null)) { - String defaultPull = pullPath.toHgCommandUrlStringWithoutUserInfo(); - String defaultPush = pushPath.toHgCommandUrlStringWithoutUserInfo(); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PULL, defaultPull); - hgConfigFiles.setProperty(HGPROPNAME_DEFAULT_PUSH, defaultPush); - } - } - - private String getKenaiUserName() { - PasswordAuthentication passwordAuthentication - = HgKenaiAccessor.getInstance().getPasswordAuthentication( - source.toUrlStringWithoutUserInfo(), - false); - return (passwordAuthentication != null) - ? passwordAuthentication.getUserName() - : null; - } - private void openProject(final File clonePrjFile, final ProjectManager projectManager, final Mercurial hg) throws MissingResourceException { SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchExecutor.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchExecutor.java index b1b7c11e656f..a8031444248b 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchExecutor.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchExecutor.java @@ -40,7 +40,6 @@ import org.netbeans.modules.mercurial.ui.log.RepositoryRevision.Kind; import org.netbeans.modules.mercurial.util.HgCommand; import org.netbeans.modules.mercurial.util.HgUtils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; @@ -178,14 +177,13 @@ private Kind getCurrentRevisionKind () { } private void checkFinished(final List results) { - final Map kenaiUserMap = SearchHistoryPanel.createKenaiUsersMap(results); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if(results.isEmpty()) { - master.setResults(null, kenaiUserMap, -1); + master.setResults(null, -1); } else { - master.setResults(results, kenaiUserMap, limitRevisions); + master.setResults(results, limitRevisions); } } diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.form b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.form index afd6f35f871a..24fae2e35698 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.form +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.form @@ -88,7 +88,6 @@ - @@ -182,7 +181,6 @@ - diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.java index 429e285a4244..2f1f25efa55a 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryPanel.java @@ -52,7 +52,6 @@ import org.netbeans.modules.mercurial.HgModuleConfig; import org.netbeans.modules.mercurial.HgProgressSupport; import org.netbeans.modules.mercurial.Mercurial; -import org.netbeans.modules.mercurial.kenai.HgKenaiAccessor; import org.netbeans.modules.mercurial.ui.diff.DiffSetupSource; import org.netbeans.modules.mercurial.ui.diff.Setup; import org.netbeans.modules.mercurial.ui.log.HgLogMessage.HgRevision; @@ -61,7 +60,6 @@ import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight; import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight.Kind; import org.netbeans.modules.versioning.util.NoContentPanel; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; import org.openide.awt.Mnemonics; import org.openide.explorer.ExplorerManager; import org.openide.nodes.Node; @@ -94,7 +92,6 @@ class SearchHistoryPanel extends javax.swing.JPanel implements ExplorerManager.P private SearchHistoryTopComponent.DiffResultsViewFactory diffViewFactory; private String currentBranch; private int showingResults; - private Map kenaiUserMap; private List logEntries; private static final Icon ICON_COLLAPSED = UIManager.getIcon("Tree.collapsedIcon"); //NOI18N @@ -313,7 +310,7 @@ final void refreshComponents(boolean refreshResults) { } else { if (tbSummary.isSelected()) { if (summaryView == null) { - summaryView = new SummaryView(this, logEntries = createLogEntries(results), kenaiUserMap); + summaryView = new SummaryView(this, logEntries = createLogEntries(results)); } resultsPanel.add(summaryView.getComponent()); summaryView.requestFocusInWindow(); @@ -353,13 +350,12 @@ final void updateActions () { nextAction.setEnabled(!tbSummary.isSelected() && diffView != null && diffView.isNextEnabled()); prevAction.setEnabled(!tbSummary.isSelected() && diffView != null && diffView.isPrevEnabled()); } - public void setResults(List newResults, Map kenaiUserMap, int limit) { - setResults(newResults, kenaiUserMap, false, limit); + public void setResults(List newResults, int limit) { + setResults(newResults, false, limit); } - private void setResults(List newResults, Map kenaiUserMap, boolean searching, int limit) { + private void setResults(List newResults, boolean searching, int limit) { this.results = newResults; - this.kenaiUserMap = kenaiUserMap; this.searchInProgress = searching; showingResults = limit; if (newResults != null && newResults.size() < limit) { @@ -381,7 +377,7 @@ public SearchCriteriaPanel getCriteria() { private synchronized void search() { searchStarted = true; cancelBackgroundSearch(); - setResults(null, null, true, -1); + setResults(null, true, -1); HgModuleConfig.getDefault().setShowHistoryMerges(criteria.isIncludeMerges()); currentSearch = new SearchExecutor(this); currentSearch.start(); @@ -856,7 +852,6 @@ private Search (int count) { @Override protected void perform () { final List newResults = executor.search(count, this); - final Map additionalUsersMap = createKenaiUsersMap(newResults); if (!isCanceled()) { EventQueue.invokeLater(new Runnable() { @Override @@ -883,7 +878,6 @@ public void run () { showingResults = -1; } logEntries = createLogEntries(results); - kenaiUserMap.putAll(additionalUsersMap); if (diffView != null) { diffView.refreshResults(results); } @@ -897,32 +891,6 @@ public void run () { } } - static Map createKenaiUsersMap (List results) { - Map kenaiUsersMap = new HashMap(); - if(results.size() > 0) { - String url = HgUtils.getRemoteRepository(results.get(0).getRepositoryRoot()); - boolean isKenaiRepository = url != null && HgKenaiAccessor.getInstance().isKenai(url); - if(isKenaiRepository) { - for (RepositoryRevision repositoryRevision : results) { - String author = repositoryRevision.getLog().getAuthor(); - String username = repositoryRevision.getLog().getUsername(); - if(author != null && !author.equals("")) { - if (username == null || username.isEmpty()) { - username = author; - } - if(!kenaiUsersMap.containsKey(author)) { - VCSKenaiAccessor.KenaiUser kenaiUser = HgKenaiAccessor.getInstance().forName(username, url); - if(kenaiUser != null) { - kenaiUsersMap.put(author, kenaiUser); - } - } - } - } - } - } - return kenaiUsersMap; - } - List createLogEntries(List results) { List ret = new LinkedList(); for (RepositoryRevision repositoryRevision : results) { diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java index 3a77a8c69601..4b7ec810ae8a 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java @@ -46,7 +46,6 @@ import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight; import org.netbeans.modules.versioning.spi.VCSContext; import org.netbeans.modules.versioning.util.Utils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.openide.filesystems.FileUtil; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; @@ -293,8 +292,8 @@ public String toString () { } } - public SummaryView (SearchHistoryPanel master, List results, Map kenaiUserMap) { - super(createViewSummaryMaster(master), results, kenaiUserMap); + public SummaryView (SearchHistoryPanel master, List results) { + super(createViewSummaryMaster(master), results); this.master = master; } diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/Bundle.properties b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/Bundle.properties index 344d959561b1..b5177026d91f 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/Bundle.properties +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/Bundle.properties @@ -91,8 +91,6 @@ ChangesetPickerPanel.options=Options MSG_Fetching_Revisions = Fetching Revisions... MSG_Revision_Default = parent of the working copy MSG_Refreshing_Revisions=Refreshing revisions -MSG_Repository.kenai.insufficientRights.read=Insufficient rights: You are not authorized to access the repository. -MSG_Repository.kenai.insufficientRights.write=Insufficient rights: You are not authorized to push into the repository. ChangesetPickerPanel.jLabel3.text=Next: #NOI18N ChangesetPickerPanel.btnFetch20.text=20 diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/HgURL.java b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/HgURL.java index 6128ac7d8ae1..9efb2ec9a30d 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/HgURL.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/ui/repository/HgURL.java @@ -24,7 +24,6 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; -import org.netbeans.modules.mercurial.kenai.HgKenaiAccessor; import org.openide.util.NbBundle; import org.openide.util.Utilities; @@ -494,10 +493,6 @@ public boolean isFile() { return scheme == Scheme.FILE; } - public boolean isKenaiURL() { - return HgKenaiAccessor.getInstance().isKenai(toUrlStringWithoutUserInfo()); - } - /** * get the protocol * @return either http, https, file, static-http, ssh diff --git a/ide/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java b/ide/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java index fd2f29051fff..b32482815796 100644 --- a/ide/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java +++ b/ide/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java @@ -66,7 +66,6 @@ import org.netbeans.modules.mercurial.WorkingCopyInfo; import org.netbeans.modules.mercurial.commands.StatusCommand; import org.netbeans.modules.mercurial.config.HgConfigFiles; -import org.netbeans.modules.mercurial.kenai.HgKenaiAccessor; import org.netbeans.modules.mercurial.ui.branch.HgBranch; import org.netbeans.modules.mercurial.ui.log.HgLogMessage; import org.netbeans.modules.mercurial.ui.log.HgLogMessage.HgRevision; @@ -925,7 +924,6 @@ public static List doPush (File repository, final HgURL toUrl, if (repository == null || toUrl == null) return null; InterRepositoryCommand command = new InterRepositoryCommand(); - command.acquireCredentialsFirst = true; command.defaultUrl = new HgConfigFiles(repository).getDefaultPush(false); command.hgCommandType = HG_PUSH_CMD; command.logger = logger; @@ -2238,14 +2236,8 @@ public static List doClone(HgURL repository, File target, OutputLogger l List list = null; boolean retry = true; - // acquire credentials for kenai PasswordAuthentication credentials = null; - HgKenaiAccessor supp = HgKenaiAccessor.getInstance(); String rawUrl = repository.toUrlStringWithoutUserInfo(); - if (supp.isKenai(rawUrl) && supp.isLoggedIntoKenai(rawUrl)) { - credentials = supp.getPasswordAuthentication(rawUrl, false); - } - HgURL url = repository; while (retry) { retry = false; @@ -2289,9 +2281,8 @@ public static List doClone(HgURL repository, File target, OutputLogger l } } else { // save credentials - if (url.getPassword() != null && !supp.isKenai(rawUrl)) { // not kenai, credentials can be saved + if (url.getPassword() != null) { try { - // for kenai this is handled in CloneAction HgModuleConfig.getDefault().setProperty(target, HgConfigFiles.HG_DEFAULT_PULL, new HgURL(url.toUrlStringWithoutUserInfo(), url.getUsername(), null).toCompleteUrlString()); } catch (URISyntaxException ex) { @@ -4152,23 +4143,11 @@ private static PasswordAuthentication handleAuthenticationError(List cmd PasswordAuthentication credentials = null; String msg = cmdOutput.get(cmdOutput.size() - 1).toLowerCase(); if (isAuthMsg(msg) && showLoginDialog) { - HgKenaiAccessor support = HgKenaiAccessor.getInstance(); - if(support.isKenai(url)) { - checkKenaiPermissions(hgCommand, url, support); - // try to login - credentials = handleKenaiAuthorisation(support, url); - } else { - credentials = credentialsSupport.getUsernamePasswordCredentials(repository, url, userName); - } + credentials = credentialsSupport.getUsernamePasswordCredentials(repository, url, userName); } return credentials; } - private static PasswordAuthentication handleKenaiAuthorisation(HgKenaiAccessor support, String url) { - PasswordAuthentication pa = support.getPasswordAuthentication(url, true); - return pa; - } - public static boolean isAuthMsg(String msg) { return msg.contains(HG_AUTHORIZATION_REQUIRED_ERR) || msg.contains(HG_AUTHORIZATION_FAILED_ERR); @@ -4730,7 +4709,6 @@ private static class InterRepositoryCommand { protected String hgCommand; protected String hgCommandType; protected String defaultUrl; - protected boolean acquireCredentialsFirst; protected boolean outputDetails; protected List additionalOptions; protected UserCredentialsSupport credentialsSupport; @@ -4765,19 +4743,8 @@ public List invoke() throws HgException { boolean retry = true; boolean showLoginWindow = !Boolean.TRUE.equals(disabledUI.get()); credentials = null; - HgKenaiAccessor supp = HgKenaiAccessor.getInstance(); String rawUrl = remoteUrl.toUrlStringWithoutUserInfo(); - acquireCredentialsFirst |= supp.isLoggedIntoKenai(rawUrl); - if (supp.isKenai(rawUrl)) { - if (acquireCredentialsFirst) { - // will force user to login into kenai, if he isn't yet - credentials = supp.getPasswordAuthentication(rawUrl, false); - if (credentials == null) { - // show log window only once, user probably canceled - showLoginWindow = false; - } - } - } else if (remoteUrl.getUsername() != null && remoteUrl.getPassword() == null) { + if (remoteUrl.getUsername() != null && remoteUrl.getPassword() == null) { char[] password = KeyringSupport.read(HgUtils.PREFIX_VERSIONING_MERCURIAL_URL, remoteUrl.toHgCommandStringWithNoPassword()); //NOI18N if (password != null) { credentials = new PasswordAuthentication(remoteUrl.getUsername(), password); @@ -4831,7 +4798,7 @@ public List invoke() throws HgException { if ((credentials = handleAuthenticationError(list, repository, rawUrl, credentials == null ? "" : credentials.getUserName(), credentialsSupport, hgCommandType, showLoginWindow)) != null) { //NOI18N // auth redone, try again retry = true; - if (!supp.isKenai(rawUrl) && credentials != null) { + if (credentials != null) { try { KeyringSupport.save(HgUtils.PREFIX_VERSIONING_MERCURIAL_URL, new HgURL(remoteUrl.toHgCommandUrlString(), credentials.getUserName(), null).toHgCommandStringWithNoPassword(), credentials.getPassword().clone(), null); } catch (URISyntaxException ex) { @@ -4845,7 +4812,7 @@ public List invoke() throws HgException { } } } finally { - if (!supp.isKenai(rawUrl) && credentials != null) { + if (credentials != null) { savePathProperties(); Arrays.fill(credentials.getPassword(), '\0'); } @@ -4862,16 +4829,6 @@ private void savePathProperties () { } } - private static void checkKenaiPermissions (String hgCommand, String repositoryUrl, HgKenaiAccessor ka) throws HgException { - if (HG_PUSH_CMD.equals(hgCommand)) { //NOI18N - if (!ka.canWrite(repositoryUrl)) { - throw new HgException(NbBundle.getMessage(Repository.class, "MSG_Repository.kenai.insufficientRights.write")); //NOI18N - } - } else if (!ka.canRead(repositoryUrl)) { - throw new HgException(NbBundle.getMessage(Repository.class, "MSG_Repository.kenai.insufficientRights.read")); //NOI18N - } - } - private static String prepareLogTemplate (File temporaryFolder, String changesetFileName) throws IOException { InputStream isChangeset = HgCommand.class.getResourceAsStream(changesetFileName); InputStream isStyle = HgCommand.class.getResourceAsStream(HG_LOG_STYLE_NAME); diff --git a/ide/subversion/nbproject/project.xml b/ide/subversion/nbproject/project.xml index 0052366e3ae9..1f5e34777233 100644 --- a/ide/subversion/nbproject/project.xml +++ b/ide/subversion/nbproject/project.xml @@ -431,7 +431,6 @@ org.netbeans.modules.bugtracking.bridge - org.netbeans.modules.kenai.ui org.netbeans.modules.odcs.subversion org.netbeans.modules.subversion.api diff --git a/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java b/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java index ba1477a127c1..2a32313c9406 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java @@ -596,9 +596,6 @@ private Image annotateFolderIcon(VCSContext context, Image icon) { if (info == null) { filesToRefresh.add(file); } - if (file.isDirectory()) { - Utils.addFolderToLog(file); - } } cache.refreshAsync(filesToRefresh); diff --git a/ide/subversion/src/org/netbeans/modules/subversion/Subversion.java b/ide/subversion/src/org/netbeans/modules/subversion/Subversion.java index 4966b5db12a5..d052cb0014ba 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/Subversion.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/Subversion.java @@ -19,7 +19,6 @@ package org.netbeans.modules.subversion; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.config.SvnConfigFiles; import org.netbeans.modules.subversion.util.Context; import org.netbeans.modules.subversion.client.*; @@ -32,13 +31,13 @@ import java.util.logging.Level; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.net.PasswordAuthentication; import java.util.ArrayList; import org.netbeans.modules.subversion.ui.ignore.IgnoreAction; import org.netbeans.modules.versioning.spi.VCSInterceptor; import org.netbeans.api.queries.SharabilityQuery; import org.netbeans.modules.subversion.config.PasswordFile; import org.netbeans.modules.subversion.ui.repository.RepositoryConnection; +import org.netbeans.modules.versioning.spi.VersioningSupport; import org.netbeans.modules.versioning.util.DelayScanRegistry; import org.netbeans.modules.versioning.util.VCSHyperlinkProvider; import org.openide.filesystems.FileUtil; @@ -117,8 +116,6 @@ private void init() { filesystemHandler = new FilesystemHandler(this); refreshHandler = new SvnClientRefreshHandler(); prepareCache(); - - asyncInit(); } public void attachListeners(SubversionVCS svcs) { @@ -126,15 +123,6 @@ public void attachListeners(SubversionVCS svcs) { addPropertyChangeListener(svcs); } - private void asyncInit() { - getRequestProcessor().post(new Runnable() { - @Override - public void run() { - SvnKenaiAccessor.getInstance().registerVCSNoficationListener(); - } - }, 500); - } - RequestProcessor.Task cleanupTask; private void prepareCache() { @@ -219,26 +207,16 @@ public SvnClient getClient(SVNUrl repositoryUrl, SvnProgressSupport progressSupp Parameters.notNull("repositoryUrl", repositoryUrl); //NOI18N String username = ""; // NOI18N char[] password = null; - - SvnKenaiAccessor kenaiSupport = SvnKenaiAccessor.getInstance(); - if(kenaiSupport.isKenai(repositoryUrl.toString())) { - PasswordAuthentication pa = kenaiSupport.getPasswordAuthentication(repositoryUrl.toString(), false); - if(pa != null) { - username = pa.getUserName(); - password = pa.getPassword(); - } - } else { - RepositoryConnection rc = SvnModuleConfig.getDefault().getRepositoryConnection(repositoryUrl.toString()); - if(rc != null) { - username = rc.getUsername(); - password = rc.getPassword(); - } else if(!Utilities.isWindows()) { - PasswordFile pf = PasswordFile.findFileForUrl(repositoryUrl); - if(pf != null) { - username = pf.getUsername(); - String psswdString = pf.getPassword(); - password = psswdString != null ? psswdString.toCharArray() : null; - } + RepositoryConnection rc = SvnModuleConfig.getDefault().getRepositoryConnection(repositoryUrl.toString()); + if(rc != null) { + username = rc.getUsername(); + password = rc.getPassword(); + } else if(!Utilities.isWindows()) { + PasswordFile pf = PasswordFile.findFileForUrl(repositoryUrl); + if(pf != null) { + username = pf.getUsername(); + String psswdString = pf.getPassword(); + password = psswdString != null ? psswdString.toCharArray() : null; } } return getClient(repositoryUrl, username, password, progressSupport); @@ -501,7 +479,9 @@ public File getTopmostManagedAncestor (File file) { } break; } - if (org.netbeans.modules.versioning.util.Utils.isScanForbidden(file)) break; + if (VersioningSupport.isExcluded(file)) { + break; + } // is the folder a special one where metadata should not be looked for? boolean forbiddenFolder = org.netbeans.modules.versioning.util.Utils.isForbiddenFolder(file); if (!forbiddenFolder && SvnUtils.hasMetadata(file)) { diff --git a/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientCallback.java b/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientCallback.java index d2c139f93069..f5380a5911e8 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientCallback.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientCallback.java @@ -19,12 +19,10 @@ package org.netbeans.modules.subversion.client; import java.awt.Dialog; -import java.net.PasswordAuthentication; import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.SvnModuleConfig; import org.netbeans.modules.subversion.ui.repository.RepositoryConnection; import org.openide.DialogDescriptor; @@ -169,20 +167,6 @@ public String getSSLClientCertPath() { return certFilePath; } - private void getKenaiAuthData(SvnKenaiAccessor support) { - final String urlString = url.toString(); - - PasswordAuthentication pa = support.getPasswordAuthentication(urlString, true); - if(pa == null) { - throw new RuntimeException(new InterruptedException(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_ActionCanceledByUser"))); //NOI18N - } - String user = pa.getUserName(); - char[] psswd = pa.getPassword(); - - username = user != null ? user : ""; - password = psswd; - } - private void showDialog(DialogDescriptor dialogDescriptor) { dialogDescriptor.setModal(true); dialogDescriptor.setValid(false); @@ -192,20 +176,15 @@ private void showDialog(DialogDescriptor dialogDescriptor) { } private void getAuthData() { - SvnKenaiAccessor support = SvnKenaiAccessor.getInstance(); - if(support != null && support.isKenai(url.toString())) { - getKenaiAuthData(support); - } else { - RepositoryConnection rc = SvnModuleConfig.getDefault().getRepositoryConnection(url.toString()); - if (rc != null) { - username = rc.getUsername(); - password = rc.getPassword(); - certFilePath = rc.getCertFile(); - certPassword = rc.getCertPassword(); - sshPort = rc.getSshPortNumber(); - if (sshPort <= 0) { - sshPort = 22; - } + RepositoryConnection rc = SvnModuleConfig.getDefault().getRepositoryConnection(url.toString()); + if (rc != null) { + username = rc.getUsername(); + password = rc.getPassword(); + certFilePath = rc.getCertFile(); + certPassword = rc.getCertPassword(); + sshPort = rc.getSshPortNumber(); + if (sshPort <= 0) { + sshPort = 22; } } } diff --git a/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientExceptionHandler.java b/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientExceptionHandler.java index 32895cfde55c..e4b5e33253a1 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientExceptionHandler.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/client/SvnClientExceptionHandler.java @@ -28,7 +28,6 @@ import java.io.UnsupportedEncodingException; import java.net.InetSocketAddress; import java.net.MalformedURLException; -import java.net.PasswordAuthentication; import java.net.Socket; import java.net.URI; import java.net.URISyntaxException; @@ -59,7 +58,6 @@ import javax.swing.JButton; import org.netbeans.modules.subversion.Subversion; import org.netbeans.modules.subversion.client.SvnClientFactory.ConnectionType; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.SvnModuleConfig; import org.netbeans.modules.subversion.WorkingCopyAttributesCache; import org.netbeans.modules.subversion.client.cli.CommandlineClient; @@ -172,23 +170,6 @@ public boolean handleException() throws SVNClientException { } throw getException(); } - - private boolean handleKenaiAuthorization(SvnKenaiAccessor support, String url) { - PasswordAuthentication pa = support.getPasswordAuthentication(url, true); - if(pa == null) { - return false; - } - - String user = pa.getUserName(); - char[] password = pa.getPassword(); - - adapter.setUsername(user != null ? user : ""); - if (connectionType != ConnectionType.javahl) { - adapter.setPassword(password != null ? new String(password) : ""); - } - - return true; - } void setMethod (String methodName) { this.methodName = methodName; @@ -201,73 +182,54 @@ private boolean handleRepositoryConnectError() throws SVNClientException { return false; } - SvnKenaiAccessor support = SvnKenaiAccessor.getInstance(); - String sUrl = url.toString(); - if(support.isKenai(sUrl)) { - if ("commit".equals(methodName)) { //NOI18N - if (!support.canWrite(sUrl)) { - throw new SVNClientException(NbBundle.getMessage(Repository.class, "MSG_Repository.kenai.insufficientRights.write"));//NOI18N - } - } else if (!support.canRead(sUrl)) { - throw new SVNClientException(NbBundle.getMessage(Repository.class, "MSG_Repository.kenai.insufficientRights.read"));//NOI18N - } - return support.showLogin() && handleKenaiAuthorization(support, sUrl); - } else { - if (Thread.interrupted()) { - Subversion.LOG.log(Level.FINE, "SvnClientExceptionHandler.handleRepositoryConnectError(): canceled"); //NOI18N - return false; - } - Repository repository = new Repository(Repository.FLAG_SHOW_PROXY, org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_ConnectionParameters")); // NOI18N - repository.selectUrl(url, true); + if (Thread.interrupted()) { + Subversion.LOG.log(Level.FINE, "SvnClientExceptionHandler.handleRepositoryConnectError(): canceled"); //NOI18N + return false; + } + Repository repository = new Repository(Repository.FLAG_SHOW_PROXY, org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_ConnectionParameters")); // NOI18N + repository.selectUrl(url, true); - JButton retryButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Action_Retry")); // NOI18N - String title = ((exceptionMask & EX_NO_HOST_CONNECTION) == exceptionMask) ? - org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_CouldNotConnect") : - org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_AuthFailed"); - Object option = repository.show(title, new HelpCtx(this.getClass()), new Object[] {retryButton, org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Action_Cancel")}, // NOI18N - retryButton); + JButton retryButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Action_Retry")); // NOI18N + String title = ((exceptionMask & EX_NO_HOST_CONNECTION) == exceptionMask) ? + org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_CouldNotConnect") : + org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_AuthFailed"); + Object option = repository.show(title, new HelpCtx(this.getClass()), new Object[] {retryButton, org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Action_Cancel")}, // NOI18N + retryButton); - boolean ret = (option == retryButton); - if(ret) { - RepositoryConnection rc = repository.getSelectedRC(); - String username = rc.getUsername(); - char[] password = rc.getPassword(); + boolean ret = (option == retryButton); + if(ret) { + RepositoryConnection rc = repository.getSelectedRC(); + String username = rc.getUsername(); + char[] password = rc.getPassword(); - adapter.setUsername(username); - if (connectionType != ConnectionType.javahl) { - adapter.setPassword(password != null ? new String(password) : ""); //NOI18N - } - SvnModuleConfig.getDefault().insertRecentUrl(rc); + adapter.setUsername(username); + if (connectionType != ConnectionType.javahl) { + adapter.setPassword(password != null ? new String(password) : ""); //NOI18N } - return ret; + SvnModuleConfig.getDefault().insertRecentUrl(rc); } + return ret; } @NbBundle.Messages("CTL_Action_Cancel=Cancel") public static boolean handleAuth (SVNUrl url) { - SvnKenaiAccessor support = SvnKenaiAccessor.getInstance(); - String sUrl = url.toString(); - if(support.isKenai(sUrl)) { - return support.showLogin() && support.getPasswordAuthentication(sUrl, true) != null; - } else { - Repository repository = new Repository(Repository.FLAG_SHOW_PROXY, org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_ConnectionParameters")); // NOI18N - repository.selectUrl(url, true); + Repository repository = new Repository(Repository.FLAG_SHOW_PROXY, org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_ConnectionParameters")); // NOI18N + repository.selectUrl(url, true); - JButton retryButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Action_Retry")); // NOI18N - String title = org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_AuthFailed"); - Object option = repository.show( - title, - new HelpCtx("org.netbeans.modules.subversion.client.SvnClientExceptionHandler"), //NOI18N - new Object[] { retryButton, - Bundle.CTL_Action_Cancel() - }, retryButton); + JButton retryButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Action_Retry")); // NOI18N + String title = org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_Error_AuthFailed"); + Object option = repository.show( + title, + new HelpCtx("org.netbeans.modules.subversion.client.SvnClientExceptionHandler"), //NOI18N + new Object[] { retryButton, + Bundle.CTL_Action_Cancel() + }, retryButton); - boolean ret = (option == retryButton); - if(ret) { - SvnModuleConfig.getDefault().insertRecentUrl(repository.getSelectedRC()); - } - return ret; + boolean ret = (option == retryButton); + if(ret) { + SvnModuleConfig.getDefault().insertRecentUrl(repository.getSelectedRC()); } + return ret; } private boolean handleNoCertificateError() throws SVNClientException { diff --git a/ide/subversion/src/org/netbeans/modules/subversion/kenai/KenaiNotificationListener.java b/ide/subversion/src/org/netbeans/modules/subversion/kenai/KenaiNotificationListener.java deleted file mode 100644 index 27eb5012b086..000000000000 --- a/ide/subversion/src/org/netbeans/modules/subversion/kenai/KenaiNotificationListener.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.subversion.kenai; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; -import java.util.logging.Level; -import javax.swing.JTextPane; -import org.netbeans.modules.subversion.FileInformation; -import org.netbeans.modules.subversion.FileStatusCache; -import org.netbeans.modules.subversion.Subversion; -import org.netbeans.modules.subversion.notifications.NotificationsManager; -import org.netbeans.modules.subversion.util.SvnUtils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.VCSKenaiModification; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.VCSKenaiNotification; -import org.tigris.subversion.svnclientadapter.SVNClientException; - -/** - * - * @author Tomas Stupka - */ -public class KenaiNotificationListener extends VCSKenaiAccessor.KenaiNotificationListener { - - @Override - protected void handleVCSNotification(final VCSKenaiNotification notification) { - if(notification.getService() != VCSKenaiAccessor.Service.VCS_SVN) { - LOG.fine("rejecting VCS notification " + notification + " because not from svn"); // NOI18N - return; - } - File projectDir = notification.getProjectDirectory(); - if(!SvnUtils.isManaged(projectDir)) { - assert false : " project " + projectDir + " not managed"; // NOI18N - LOG.fine("rejecting VCS notification " + notification + " for " + projectDir + " because not versioned by svn"); // NOI18N - return; - } - LOG.fine("accepting VCS notification " + notification + " for " + projectDir); // NOI18N - - FileStatusCache cache = Subversion.getInstance().getStatusCache(); - File[] files = cache.listFiles(new File[] {projectDir}, FileInformation.STATUS_LOCAL_CHANGE); - List modifications = notification.getModifications(); - - List notifyFiles = new LinkedList(); - String revision = null; - for (File file : files) { - String path; - try { - path = SvnUtils.getRepositoryPath(file); - } catch (SVNClientException ex) { - LOG.log(Level.WARNING, file.getAbsolutePath(), ex); - continue; - } - path = trim(path); - for (VCSKenaiModification modification : modifications) { - String resource = modification.getResource(); - LOG.finer(" changed file " + path + ", " + resource); // NOI18N - - resource = trim(resource); - if(path.equals(resource)) { - LOG.fine(" will notify " + file + ", " + notification); // NOI18N - notifyFiles.add(file); - if(revision == null) { - revision = modification.getId(); - } - break; - } - } - } - if(notifyFiles.size() > 0) { - notifyFileChange(notifyFiles.toArray(new File[0]), projectDir, notification.getUri().toString(), revision); - try { - NotificationsManager.getInstance().notfied(files, Long.parseLong(revision)); - } catch (NumberFormatException e) { - LOG.log(Level.WARNING, revision, e); - } - } - } - - @Override - protected void setupPane(JTextPane pane, final File[] files, final File projectDir, final String url, final String revision) { - NotificationsManager.getInstance().setupPane(pane, files, getFileNames(files), projectDir, url, revision); - } - -} diff --git a/ide/subversion/src/org/netbeans/modules/subversion/kenai/SvnKenaiAccessor.java b/ide/subversion/src/org/netbeans/modules/subversion/kenai/SvnKenaiAccessor.java deleted file mode 100644 index 3cf83b109aae..000000000000 --- a/ide/subversion/src/org/netbeans/modules/subversion/kenai/SvnKenaiAccessor.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.subversion.kenai; - -import java.beans.PropertyChangeListener; -import java.io.File; -import java.net.PasswordAuthentication; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; -import org.openide.util.Lookup; - -/** - * - * @author Tomas Stupka - */ -public class SvnKenaiAccessor { - - private static SvnKenaiAccessor instance; - private VCSKenaiAccessor kenaiAccessor = null; - - private SvnKenaiAccessor() { - kenaiAccessor = Lookup.getDefault().lookup(VCSKenaiAccessor.class); - } - - public static SvnKenaiAccessor getInstance() { - if(instance == null) { - instance = new SvnKenaiAccessor(); - } - return instance; - } - - public boolean isKenai(String url) { - return kenaiAccessor != null && kenaiAccessor.isKenai(url); - } - - public PasswordAuthentication getPasswordAuthentication(String url, boolean forceRelogin) { - return kenaiAccessor != null ? kenaiAccessor.getPasswordAuthentication(url, forceRelogin) : null; - } - - /** - * Shows a login dialog - * @return true if successfully logged in - */ - public boolean showLogin () { - return kenaiAccessor != null ? kenaiAccessor.showLogin() : false; - } - - public boolean isOnline(String user) { - return kenaiAccessor != null && kenaiAccessor.isUserOnline(user); - } - - public KenaiUser forName(String user, String url) { - return kenaiAccessor != null ? kenaiAccessor.forName(user, url) : null; - } - - public boolean isLogged (String url) { - return kenaiAccessor != null && kenaiAccessor.isLogged(url); - } - - public String getRevisionUrl(String repositoryUrl, String revision) { - return kenaiAccessor == null ? null : kenaiAccessor.getRevisionUrl(repositoryUrl, revision); - } - - private void removeVCSNoficationListener(PropertyChangeListener l) { - if(kenaiAccessor != null) { - kenaiAccessor.removeVCSNoficationListener(l); - } - } - - private void addVCSNoficationListener(PropertyChangeListener l) { - if(kenaiAccessor != null) { - kenaiAccessor.addVCSNoficationListener(l); - } - } - - public void registerVCSNoficationListener() { - if("true".equals(System.getProperty("kenai.vcs.notifications.ignore"))) { - return; - } - addVCSNoficationListener(new KenaiNotificationListener()); - } - - /** - * Returns false only when the given repository is a kenai one, current user is logged in and does not have read access rights - * @param repositoryUrl - * @return - */ - public boolean canRead (String repositoryUrl) { - return isAuthorized(repositoryUrl, VCSKenaiAccessor.RepositoryActivity.READ); - } - - /** - * Returns false only when the given repository is a kenai one, current user is logged in and does not have commit access rights - * @param repositoryUrl - * @return - */ - public boolean canWrite (String repositoryUrl) { - return isAuthorized(repositoryUrl, VCSKenaiAccessor.RepositoryActivity.WRITE); - } - - private boolean isAuthorized (String repositoryUrl, VCSKenaiAccessor.RepositoryActivity permission) { - return kenaiAccessor == null || !kenaiAccessor.isLogged(repositoryUrl) || kenaiAccessor.isAuthorized(repositoryUrl, permission); - } - -} diff --git a/ide/subversion/src/org/netbeans/modules/subversion/notifications/NotificationsManager.java b/ide/subversion/src/org/netbeans/modules/subversion/notifications/NotificationsManager.java index 7a08138e03f8..c28b18199a3b 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/notifications/NotificationsManager.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/notifications/NotificationsManager.java @@ -19,7 +19,6 @@ package org.netbeans.modules.subversion.notifications; -import java.awt.EventQueue; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -40,7 +39,6 @@ import org.netbeans.modules.subversion.Subversion; import org.netbeans.modules.subversion.client.SvnClient; import org.netbeans.modules.subversion.client.SvnClientExceptionHandler; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.ui.diff.DiffAction; import org.netbeans.modules.subversion.ui.diff.Setup; import org.netbeans.modules.subversion.ui.history.SearchHistoryAction; @@ -72,7 +70,6 @@ public class NotificationsManager { private final RequestProcessor rp; private final RequestProcessor.Task notificationTask; private final FileStatusCache cache; - private final SvnKenaiAccessor kenaiAccessor; private Boolean enabled; private Map notifiedFiles = Collections.synchronizedMap(new HashMap()); @@ -82,7 +79,6 @@ private NotificationsManager () { rp = new RequestProcessor("SubversionNotifications", 1, true); //NOI18N notificationTask = rp.create(new NotificationTask()); cache = Subversion.getInstance().getStatusCache(); - kenaiAccessor = SvnKenaiAccessor.getInstance(); } /** @@ -103,9 +99,9 @@ public static synchronized NotificationsManager getInstance() { * @param file file to scan */ public void scheduleFor(File file) { - if (isSeen(file) || !isUpToDate(file) || !isEnabled(file, false)) { + if (isSeen(file) || !isUpToDate(file) || !isEnabled(file)) { if (LOG.isLoggable(Level.FINER)) { - LOG.log(Level.FINER, "File {0} is {1} up to date, notifications enabled: {2}", new Object[]{file.getAbsolutePath(), isUpToDate(file) ? "" : "not ", isEnabled(file, false)}); //NOI18N + LOG.log(Level.FINER, "File {0} is {1} up to date, notifications enabled: {2}", new Object[]{file.getAbsolutePath(), isUpToDate(file) ? "" : "not ", isEnabled(file)}); //NOI18N } return; } @@ -152,31 +148,12 @@ public void hyperlinkUpdate(HyperlinkEvent e) { }); } - /** - * Notifications are enabled only for logged kenai users and unless disabled by a switch - * @return - */ - private boolean isEnabled (File file, boolean checkUrl) { + private boolean isEnabled (File file) { if (enabled == null) { // let's leave a possibility to disable the notifications enabled = !"false".equals(System.getProperty("subversion.notificationsEnabled", "true")); //NOI18N } - boolean retval = false; - if (enabled.booleanValue()) { - if (checkUrl) { - assert !EventQueue.isDispatchThread(); - SVNUrl url = null; - try { - url = SvnUtils.getRepositoryRootUrl(file); - } catch (SVNClientException ex) { } - if (url != null) { - retval = kenaiAccessor.isLogged(url.toString()); - } - } else { - retval = true; - } - } - return retval; + return enabled; } private boolean isUpToDate(File file) { @@ -226,7 +203,7 @@ private void removeDirectories (Collection filesToScan) { private void removeNotEnabled (Collection filesToScan) { for (Iterator it = filesToScan.iterator(); it.hasNext();) { File file = it.next(); - if (!isEnabled(file, true)) { + if (!isEnabled(file)) { if (LOG.isLoggable(Level.FINER)) { LOG.log(Level.FINER, "File {0} is probably not from kenai, notifications disabled", new Object[] { file.getAbsolutePath() } ); //NOI18N } @@ -379,9 +356,6 @@ private void notifyChanges (HashMap notifications, SVNUrl re private SVNUrl getRepositoryRoot (File file) { SVNUrl repositoryUrl = null; SVNUrl url = getRepositoryUrl(file); - if (url != null && kenaiAccessor.isKenai(url.toString()) && kenaiAccessor.isLogged(url.toString())) { - repositoryUrl = url; - } return repositoryUrl; } diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/AnnotationBar.java b/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/AnnotationBar.java index 02622652a8d8..78b9b0c633fb 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/AnnotationBar.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/AnnotationBar.java @@ -24,7 +24,6 @@ import org.netbeans.editor.Utilities; import org.netbeans.api.editor.fold.*; import org.netbeans.api.diff.*; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.netbeans.spi.diff.*; import org.netbeans.modules.subversion.ui.update.RevertModifications; import org.netbeans.modules.subversion.ui.update.RevertModificationsAction; @@ -61,7 +60,6 @@ import org.netbeans.api.editor.settings.FontColorNames; import org.netbeans.api.editor.settings.FontColorSettings; import org.netbeans.modules.subversion.client.SvnClient; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.client.SvnClientExceptionHandler; import org.tigris.subversion.svnclientadapter.ISVNInfo; import org.tigris.subversion.svnclientadapter.ISVNNotifyListener; @@ -162,11 +160,6 @@ final class AnnotationBar extends JComponent implements Accessible, PropertyChan */ private final Map renderingHints; - /** - * Holdes kenai users - */ - private Map kenaiUsersMap = null; - private File file; /** * This is not null when the displayed annotations do not belong directly to the displayed file but to another. @@ -325,30 +318,6 @@ public void run() { } } }); - - boolean isKenaiRepository = false; - SVNUrl url = null; - try { - url = SvnUtils.getRepositoryUrl(file); - isKenaiRepository = url != null && SvnKenaiAccessor.getInstance().isKenai(url.toString()); - if(isKenaiRepository) { - kenaiUsersMap = new HashMap(); - Iterator it = lines.iterator(); - while (it.hasNext()) { - AnnotateLine line = it.next(); - String author = line.getAuthor(); - if(author != null && !author.equals("") && !kenaiUsersMap.containsKey(author)) { - KenaiUser ku = SvnKenaiAccessor.getInstance().forName(author, url.toString()); - if(ku != null) { - kenaiUsersMap.put(author, ku); - } - } - } - } - } catch (SVNClientException ex) { - Subversion.LOG.log(Level.WARNING, null, ex); - } - // lazy listener registration caret = textComponent.getCaret(); @@ -570,23 +539,6 @@ public void run() { popupMenu.add(previousAnnotationsMenu); previousAnnotationsMenu.setVisible(false); - if(isKenai() && al != null) { - String author = al.getAuthor(); - final int lineNr = al.getLineNum(); - final KenaiUser ku = kenaiUsersMap.get(author); - if(ku != null) { - popupMenu.addSeparator(); - JMenuItem chatMenu = new JMenuItem(NbBundle.getMessage(AnnotationBar.class, "CTL_MenuItem_Chat", author)); - chatMenu.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - ku.startChat(KenaiUser.getChatLink(getCurrentFileObject(), lineNr)); - } - }); - popupMenu.add(chatMenu); - } - } - JMenuItem menu; menu = new JMenuItem(loc.getString("CTL_MenuItem_CloseAnnotations")); menu.addActionListener(new ActionListener() { @@ -889,7 +841,7 @@ private int getBarWidth() { Graphics g = getGraphics(); if( g != null) { int w = g.getFontMetrics().charsWidth(data, 0, data.length); - return w + 4 + (isKenai() ? 18 : 0); + return w + 4; } else { return 0; } @@ -968,17 +920,6 @@ private void paintView(View view, Graphics g, int yBase) { g.drawString(annotation, textx, texty); } - boolean isKenai() { - return kenaiUsersMap != null && kenaiUsersMap.size() > 0; - } - - KenaiUser getKenaiUser(String author) { - if(kenaiUsersMap == null) { - return null; - } - return kenaiUsersMap.get(author); - } - /** * Presents commit message as tooltips. */ diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/TooltipWindow.java b/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/TooltipWindow.java index 561c3c6def92..5894569e7558 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/TooltipWindow.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/blame/TooltipWindow.java @@ -55,11 +55,9 @@ import javax.swing.text.StyledDocument; import org.netbeans.modules.subversion.Subversion; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport; -import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.AuthorLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.IssueLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.StyledDocumentHyperlink; import org.netbeans.modules.versioning.util.VCSHyperlinkProvider; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; /** * Window displaying the line annotation with links to bugtracking in the commit message. @@ -241,29 +239,8 @@ public TooltipContentPanel(JTextComponent parentPane) { doc.insertString(doc.getLength(), annotateLine.getRevision() + " - ", normalStyle); // author - { - String author = annotateLine.getAuthor(); - StyledDocumentHyperlink l = linkerSupport.getLinker(AuthorLinker.class, 0); - if (master.isKenai()) { - KenaiUser kenaiUser = master.getKenaiUser(author); - if (kenaiUser != null) { - l = new AuthorLinker( - kenaiUser, - authorStyle, - doc, - author, - KenaiUser.getChatLink( - master.getCurrentFileObject(), - annotateLine.getLineNum())); - linkerSupport.add(l, 0); - } - } - if (l != null) { - l.insertString(doc, authorStyle); - } else { - doc.insertString(doc.getLength(), author, normalStyle); - } - } + String author = annotateLine.getAuthor(); + doc.insertString(doc.getLength(), author, normalStyle); // date doc.insertString(doc.getLength(), " ", normalStyle); diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchExecutor.java b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchExecutor.java index 720548e5f111..47236fa49b6a 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchExecutor.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchExecutor.java @@ -273,7 +273,7 @@ private void checkFinished() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - master.setResults(results, SearchHistoryPanel.createKenaiUsersMap(results), limit); + master.setResults(results, limit); } }); } diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.form b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.form index 6ba3a6f140d1..b31f27036e74 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.form +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.form @@ -92,7 +92,6 @@ - @@ -188,7 +187,6 @@ - diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.java b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.java index 8b15fbdf6444..14ea6575bf43 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SearchHistoryPanel.java @@ -45,11 +45,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import javax.swing.AbstractAction; @@ -65,11 +63,9 @@ import org.netbeans.modules.subversion.SvnModuleConfig; import org.netbeans.modules.subversion.client.SvnClientExceptionHandler; import org.netbeans.modules.subversion.client.SvnProgressSupport; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.ui.history.SummaryView.SvnLogEntry; import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight; import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight.Kind; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; import org.tigris.subversion.svnclientadapter.SVNClientException; /** @@ -100,7 +96,6 @@ class SearchHistoryPanel extends javax.swing.JPanel implements ExplorerManager.P private static final Icon ICON_COLLAPSED = UIManager.getIcon("Tree.collapsedIcon"); //NOI18N private static final Icon ICON_EXPANDED = UIManager.getIcon("Tree.expandedIcon"); //NOI18N private int showingResults; - private Map kenaiUserMap; private List logEntries; private boolean selectFirstRevision; @@ -286,7 +281,7 @@ final void refreshComponents(boolean refreshResults) { } else { if (tbSummary.isSelected()) { if (summaryView == null) { - summaryView = new SummaryView(this, logEntries = createLogEntries(results), kenaiUserMap); + summaryView = new SummaryView(this, logEntries = createLogEntries(results)); } resultsPanel.add(summaryView.getComponent()); summaryView.requestFocusInWindow(); @@ -320,13 +315,12 @@ private void selectFirstRevision () { } } - void setResults (List newResults, Map kenaiUserMap, int limit) { - setResults(newResults, kenaiUserMap, false, limit); + void setResults (List newResults, int limit) { + setResults(newResults, false, limit); } - private void setResults (List newResults, Map kenaiUserMap, boolean searching, int limit) { + private void setResults (List newResults, boolean searching, int limit) { this.results = newResults; - this.kenaiUserMap = kenaiUserMap; this.searchInProgress = searching; showingResults = limit; if (newResults != null && newResults.size() < limit) { @@ -360,7 +354,7 @@ boolean isShowInfo() { private synchronized void search() { cancelBackgroundTasks(); - setResults(null, null, true, -1); + setResults(null, true, -1); currentSearch = new SearchExecutor(this); currentSearch.start(); } @@ -744,29 +738,6 @@ boolean hasMoreResults () { return showingResults > -1; } - static Map createKenaiUsersMap (List results) { - Map kenaiUsersMap = new HashMap(); - if (!results.isEmpty()) { - SVNUrl url = results.get(0).getRepositoryRootUrl(); - boolean isKenaiRepository = url != null && SvnKenaiAccessor.getInstance().isKenai(url.toString()); - if(isKenaiRepository) { - kenaiUsersMap = new HashMap(); - for (RepositoryRevision repositoryRevision : results) { - String author = repositoryRevision.getLog().getAuthor(); - if(author != null && !author.isEmpty()) { - if(!kenaiUsersMap.containsKey(author)) { - VCSKenaiAccessor.KenaiUser kenaiUser = SvnKenaiAccessor.getInstance().forName(author, url.toString()); - if(kenaiUser != null) { - kenaiUsersMap.put(author, kenaiUser); - } - } - } - } - } - } - return kenaiUsersMap; - } - void getMoreRevisions (PropertyChangeListener callback, int count) { if (currentSearch == null) { throw new IllegalStateException("No search task active"); //NOI18N @@ -850,7 +821,6 @@ private Search (SVNUrl repoUrl, int count) { @Override protected void perform () { final List newResults = executor.search(repoUrl, count, this); - final Map additionalUsersMap = createKenaiUsersMap(newResults); if (!isCanceled()) { EventQueue.invokeLater(new Runnable() { @Override @@ -877,7 +847,6 @@ public void run () { showingResults = -1; } logEntries = createLogEntries(results); - kenaiUserMap.putAll(additionalUsersMap); if (diffView != null) { diffView.refreshResults(results); } diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SummaryView.java b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SummaryView.java index 6085657c6771..0c671bf39d6e 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SummaryView.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/history/SummaryView.java @@ -47,7 +47,6 @@ import org.netbeans.modules.versioning.history.AbstractSummaryView; import org.netbeans.modules.versioning.history.AbstractSummaryView.SummaryViewMaster.SearchHighlight; import org.netbeans.modules.versioning.util.Utils; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.openide.filesystems.FileUtil; import org.openide.util.WeakListeners; import org.tigris.subversion.svnclientadapter.SVNClientException; @@ -259,8 +258,8 @@ public String toString () { } } - public SummaryView (SearchHistoryPanel master, List results, Map kenaiUserMap) { - super(createViewSummaryMaster(master), results, kenaiUserMap); + public SummaryView (SearchHistoryPanel master, List results) { + super(createViewSummaryMaster(master), results); this.master = master; } diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/repository/Bundle.properties b/ide/subversion/src/org/netbeans/modules/subversion/ui/repository/Bundle.properties index d96a2239c3a7..59d8f3047a8b 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/repository/Bundle.properties +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/repository/Bundle.properties @@ -118,8 +118,6 @@ SvnkitSSHPanel.certFileLabel.text=Iden&tity File: SvnkitSSHPanel.certFileLabel.toolTipText=Path to the private key identity file MSG_Repository_InvalidSvnUrl=Invalid svn url\:{0} -MSG_Repository.kenai.insufficientRights.read=Insufficient rights: You are not authorized to access the repository. -MSG_Repository.kenai.insufficientRights.write=Insufficient rights: You are not authorized to commit into the repository. SshPanel.certFileLabel.text=Identity File: SvnkitSSHPanel.browseButton.text=&Browse... SvnkitSSHPanel.browseButton.toolTipText=Lets you select the path to a private key file diff --git a/ide/subversion/src/org/netbeans/modules/subversion/ui/wizards/repositorystep/RepositoryStep.java b/ide/subversion/src/org/netbeans/modules/subversion/ui/wizards/repositorystep/RepositoryStep.java index 23f7c47d65cd..4174d1094dbc 100644 --- a/ide/subversion/src/org/netbeans/modules/subversion/ui/wizards/repositorystep/RepositoryStep.java +++ b/ide/subversion/src/org/netbeans/modules/subversion/ui/wizards/repositorystep/RepositoryStep.java @@ -33,7 +33,6 @@ import org.netbeans.modules.subversion.client.SvnClient; import org.netbeans.modules.subversion.client.SvnClientExceptionHandler; import org.netbeans.modules.subversion.client.WizardStepProgressSupport; -import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; import org.netbeans.modules.subversion.ui.repository.Repository; import org.netbeans.modules.subversion.ui.repository.RepositoryConnection; import org.netbeans.modules.subversion.ui.wizards.AbstractStep; @@ -203,10 +202,6 @@ public void perform() { setCancellableDelegate(client); info = client.getInfo(url); } catch (SVNClientException ex) { - if (SvnClientExceptionHandler.isAuthentication(ex.getMessage()) && !SvnKenaiAccessor.getInstance().canRead(SvnUtils.decodeToString(url))) { - invalidMsg = new AbstractStep.WizardMessage(NbBundle.getMessage(Repository.class, "MSG_Repository.kenai.insufficientRights.read"), false); //NOI18N - return; - } annotate(ex); invalidMsg = new AbstractStep.WizardMessage(SvnClientExceptionHandler.parseExceptionMessage(ex), false); } diff --git a/ide/team.commons/nbproject/project.xml b/ide/team.commons/nbproject/project.xml index 29dbf2bb9430..f2427adc6bbc 100644 --- a/ide/team.commons/nbproject/project.xml +++ b/ide/team.commons/nbproject/project.xml @@ -206,12 +206,10 @@ oracle.jdevimpl.nbteam.ide org.netbeans.modules.bugtracking org.netbeans.modules.bugtracking.bridge - org.netbeans.modules.bugtracking.kenai org.netbeans.modules.odcs.tasks.bridge org.netbeans.modules.bugtracking.commons org.netbeans.modules.bugzilla org.netbeans.modules.jira - org.netbeans.modules.kenai.ui org.netbeans.modules.localtasks org.netbeans.modules.odcs.ui org.netbeans.modules.odcs.versioning diff --git a/ide/team.commons/src/org/netbeans/modules/team/commons/LogUtils.java b/ide/team.commons/src/org/netbeans/modules/team/commons/LogUtils.java index 9059007519f6..139b44e28a76 100644 --- a/ide/team.commons/src/org/netbeans/modules/team/commons/LogUtils.java +++ b/ide/team.commons/src/org/netbeans/modules/team/commons/LogUtils.java @@ -144,8 +144,6 @@ public static String getKnownRepositoryFor (String repositoryUrl) { || repositoryUrl.contains("code.google.com") //NOI18N || repositoryUrl.contains("googlesource.com")) { //NOI18N return "GOOGLECODE"; //NOI18N - } else if (repositoryUrl.contains("kenai.com")) { //NOI18N - return "KENAI"; //NOI18N } else if (repositoryUrl.contains("java.net")) { //NOI18N return "JAVANET"; //NOI18N } else if (repositoryUrl.contains("netbeans.org")) { //NOI18N diff --git a/ide/team.commons/src/org/netbeans/modules/team/spi/OwnerInfo.java b/ide/team.commons/src/org/netbeans/modules/team/spi/OwnerInfo.java index a57619b6d438..432973eae965 100644 --- a/ide/team.commons/src/org/netbeans/modules/team/spi/OwnerInfo.java +++ b/ide/team.commons/src/org/netbeans/modules/team/spi/OwnerInfo.java @@ -25,18 +25,11 @@ * Wrapper for a OwnerInfo instance returned by a Kenai Server * * @author Tomas Stupka - * @see org.netbeans.modules.kenai.ui.api.NbModuleOwnerSupport */ public abstract class OwnerInfo { - /** - * @see org.netbeans.modules.kenai.ui.api.NbModuleOwnerSupport.OwnerInfo - */ public abstract String getOwner(); - /** - * @see org.netbeans.modules.kenai.ui.api.NbModuleOwnerSupport.OwnerInfo - */ public abstract List getExtraData(); } diff --git a/ide/team.commons/src/org/netbeans/modules/team/spi/TeamProject.java b/ide/team.commons/src/org/netbeans/modules/team/spi/TeamProject.java index 48cb89b0afa1..62a92c7017da 100644 --- a/ide/team.commons/src/org/netbeans/modules/team/spi/TeamProject.java +++ b/ide/team.commons/src/org/netbeans/modules/team/spi/TeamProject.java @@ -25,7 +25,6 @@ /** * Wrapper for a TeamProject instance returned by team * @author Tomas Stupka - * @see org.netbeans.modules.kenai.ui.api.NbModuleOwnerSupport */ public abstract class TeamProject { diff --git a/ide/versioning.util/nbproject/project.properties b/ide/versioning.util/nbproject/project.properties index ab71d8d62558..8db2eff013f6 100644 --- a/ide/versioning.util/nbproject/project.properties +++ b/ide/versioning.util/nbproject/project.properties @@ -20,7 +20,7 @@ javac.source=11 javac.target=11 javadoc.name=Versioning Support Utilities -spec.version.base=1.94.0 +spec.version.base=2.0.0 is.autoload=true # Fatal error: Fatal error: class javax.net.SocketFactory not found diff --git a/ide/versioning.util/nbproject/project.xml b/ide/versioning.util/nbproject/project.xml index fb169d42a0bc..4ad4c3e9d9c8 100644 --- a/ide/versioning.util/nbproject/project.xml +++ b/ide/versioning.util/nbproject/project.xml @@ -373,7 +373,6 @@ org.netbeans.modules.subversion.remote org.netbeans.modules.team.ide org.netbeans.modules.versioning.indexingbridge - org.netbeans.modules.versioning.kenai org.netbeans.modules.versioning.system.cvss org.netbeans.modules.versioning.ui org.netbeans.modules.proxy diff --git a/ide/versioning.util/src/org/netbeans/modules/proxy/Base64Encoder.java b/ide/versioning.util/src/org/netbeans/modules/proxy/Base64Encoder.java deleted file mode 100644 index c35942c1dc37..000000000000 --- a/ide/versioning.util/src/org/netbeans/modules/proxy/Base64Encoder.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.netbeans.modules.proxy; - -import java.nio.charset.StandardCharsets; -import java.util.Base64; - -/** - * Bas64 encode utility class. - * - * @author Maros Sandor - * @deprecated prefer java.util.Base64 instead - */ -@Deprecated -public class Base64Encoder { - - private static final Base64.Encoder MIME_ENCODER = Base64.getMimeEncoder( - 60, - System.getProperty("line.separator").getBytes(StandardCharsets.ISO_8859_1) - ); - - private Base64Encoder() { - } - - /** - * - * @deprecated use {@link java.util.Base64#getEncoder()}.encode(data) - * instead. - */ - @Deprecated - public static String encode(byte[] data) { - return encode(data, false); - } - - /** - * @deprecated use - * {@link java.util.Base64#getMimeEncoder(int, byte[])}.encode(s) instead. - */ - public static String encode(byte[] data, boolean useNewlines) { - if (useNewlines) { - return MIME_ENCODER.encodeToString(data); - } else { - return Base64.getEncoder().encodeToString(data); - } - } - - /** - * - * @deprecated use {@link java.util.Base64#getMimeDecoder()}.decode(s) - * instead. - */ - @Deprecated - public static byte[] decode(String s) { - return Base64.getMimeDecoder().decode(s); - } - -} diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/history/AbstractSummaryView.java b/ide/versioning.util/src/org/netbeans/modules/versioning/history/AbstractSummaryView.java index a5dfeedf81ba..830700473b1b 100644 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/history/AbstractSummaryView.java +++ b/ide/versioning.util/src/org/netbeans/modules/versioning/history/AbstractSummaryView.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.logging.Logger; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; import org.openide.util.Mutex; import org.openide.util.WeakListeners; import org.openide.windows.WindowManager; @@ -50,18 +49,18 @@ public abstract class AbstractSummaryView implements MouseListener, MouseMotionL private final PropertyChangeListener list; private final ExpandCollapseGeneralAction expandCollapseAction; private JList resultsList; - private JScrollPane scrollPane; + private final JScrollPane scrollPane; - private VCSHyperlinkSupport linkerSupport = new VCSHyperlinkSupport(); + private final VCSHyperlinkSupport linkerSupport = new VCSHyperlinkSupport(); private static final int NEXT_FILES_INITIAL_PAGING = 50; - public AbstractSummaryView(SummaryViewMaster master, final List results, Map kenaiUsersMap) { + public AbstractSummaryView(SummaryViewMaster master, final List results) { this.master = master; list = WeakListeners.propertyChange(this, null); - resultsList = new JList<>(new DefaultListModel()); + resultsList = new JList<>(new DefaultListModel<>()); resultsList.setModel(new SummaryListModel(results, master.hasMoreResults())); - resultsList.setCellRenderer(new SummaryCellRenderer(this, linkerSupport, kenaiUsersMap)); + resultsList.setCellRenderer(new SummaryCellRenderer(this, linkerSupport)); resultsList.setFixedCellHeight(-1); resultsList.addMouseListener(this); @@ -290,11 +289,8 @@ public void propertyChange (PropertyChangeEvent evt) { } private void refreshEvents (final LogEntry src) { - Mutex.EVENT.readAccess(new Runnable() { - @Override - public void run () { - ((SummaryListModel) resultsList.getModel()).addEvents(src); - } + Mutex.EVENT.readAccess(() -> { + ((SummaryListModel) resultsList.getModel()).addEvents(src); }); } @@ -325,16 +321,13 @@ void moreRevisions (Integer count) { } public void entriesChanged (final List entries) { - Mutex.EVENT.readAccess(new Runnable() { - @Override - public void run () { - List selection = resultsList.getSelectedValuesList(); - if (selection.size() > 0 && selection.get(selection.size() - 1) instanceof MoreRevisionsItem) { - int lastIndex = ((SummaryListModel) resultsList.getModel()).getSize() - 1; - resultsList.getSelectionModel().removeIndexInterval(lastIndex, lastIndex); - } - ((SummaryListModel) resultsList.getModel()).addEntries(entries, !master.hasMoreResults()); + Mutex.EVENT.readAccess(() -> { + List selection = resultsList.getSelectedValuesList(); + if (selection.size() > 0 && selection.get(selection.size() - 1) instanceof MoreRevisionsItem) { + int lastIndex = ((SummaryListModel) resultsList.getModel()).getSize() - 1; + resultsList.getSelectionModel().removeIndexInterval(lastIndex, lastIndex); } + ((SummaryListModel) resultsList.getModel()).addEntries(entries, !master.hasMoreResults()); }); } @@ -860,9 +853,9 @@ private class SummaryListModel extends AbstractListModel { private final List dispResults; public SummaryListModel (List entries, boolean hasMoreResults) { - allResults = new ArrayList(initializeResults(entries, master.hasMoreResults())); - dispResults = new ArrayList(allResults.size()); - revisions = new HashSet(); + allResults = new ArrayList<>(initializeResults(entries, master.hasMoreResults())); + dispResults = new ArrayList<>(allResults.size()); + revisions = new HashSet<>(); for (LogEntry entry : entries) { revisions.add(entry.getRevision()); } @@ -944,13 +937,8 @@ void addDummyEvents (LogEntry src) { } private void addEntries (List entries, boolean noMoreResults) { - List newEntries = new LinkedList(entries); - for (ListIterator it = newEntries.listIterator(); it.hasNext(); ) { - LogEntry entry = it.next(); - if (!revisions.add(entry.getRevision())) { - it.remove(); - } - } + List newEntries = new LinkedList<>(entries); + newEntries.removeIf(entry -> !revisions.add(entry.getRevision())); List itemsToAdd = expandResults(newEntries); if (!itemsToAdd.isEmpty()) { int addedAtIndex; @@ -987,15 +975,13 @@ private void refreshModel () { } fireIntervalAdded(this, 0, dispResults.size()); } else { - ListIterator allIterator = allResults.listIterator(); dispResults.add(new MoreRevisionsItem()); ListIterator dispIterator = dispResults.listIterator(); Item displayed = dispIterator.next(); index = 0; int addedStart = -1, addedLast = 0; int removedStart = -1, removedLast = 0; - while (allIterator.hasNext()) { - Item item = allIterator.next(); + for (Item item : allResults) { if (item == displayed) { fireAdds(addedStart, addedLast); addedStart = -1; addedLast = 0; diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/history/SummaryCellRenderer.java b/ide/versioning.util/src/org/netbeans/modules/versioning/history/SummaryCellRenderer.java index 7580fa03a2b8..f9a716477b22 100644 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/history/SummaryCellRenderer.java +++ b/ide/versioning.util/src/org/netbeans/modules/versioning/history/SummaryCellRenderer.java @@ -73,9 +73,7 @@ import org.netbeans.modules.versioning.util.Utils; import org.netbeans.modules.versioning.util.VCSHyperlinkProvider; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport; -import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.AuthorLinker; import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.IssueLinker; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor; import org.openide.ErrorManager; import org.openide.util.Exceptions; import org.openide.util.Lookup; @@ -92,7 +90,6 @@ class SummaryCellRenderer implements ListCellRenderer { private static final double DARKEN_FACTOR_UNINTERESTING = 0.95; private final AbstractSummaryView summaryView; - private final Map kenaiUsersMap; private final VCSHyperlinkSupport linkerSupport; private final Color selectionBackgroundColor = new JList().getSelectionBackground(); @@ -117,9 +114,8 @@ class SummaryCellRenderer implements ListCellRenderer { private final Map> renderers = new WeakHashMap<>(); - public SummaryCellRenderer(AbstractSummaryView summaryView, final VCSHyperlinkSupport linkerSupport, Map kenaiUsersMap) { + public SummaryCellRenderer(AbstractSummaryView summaryView, VCSHyperlinkSupport linkerSupport) { this.summaryView = summaryView; - this.kenaiUsersMap = kenaiUsersMap; this.linkerSupport = linkerSupport; searchHiliteAttrs = ((FontColorSettings) MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class)).getFontColors("highlight-search"); //NOI18N } @@ -248,14 +244,6 @@ public Collection getHyperlinkProviders() { return hpInstances; } - public VCSKenaiAccessor.KenaiUser getKenaiUser(String author) { - VCSKenaiAccessor.KenaiUser kenaiUser = null; - if (kenaiUsersMap != null && author != null && !author.isEmpty()) { - kenaiUser = kenaiUsersMap.get(author); - } - return kenaiUser; - } - private ListCellRenderer getRenderer (Object value) { Reference ref = renderers.get(value); return ref == null ? null : ref.get(); @@ -412,24 +400,11 @@ private void addAuthor (JTextPane pane, RevisionItem item, boolean selected, Col } else { style = normalStyle; } - Style authorStyle = createAuthorStyle(pane, normalStyle); Style hiliteStyle = createHiliteStyleStyle(pane, normalStyle, searchHiliteAttrs); String author = entry.getAuthor(); - AuthorLinker l = linkerSupport.getLinker(VCSHyperlinkSupport.AuthorLinker.class, id); - if(l == null) { - VCSKenaiAccessor.KenaiUser kenaiUser = getKenaiUser(author); - if (kenaiUser != null) { - l = new VCSHyperlinkSupport.AuthorLinker(kenaiUser, authorStyle, sd, author); - linkerSupport.add(l, id); - } - } - int pos = sd.getLength(); - if(l != null) { - l.insertString(sd, selected ? style : null); - } else { - sd.insertString(sd.getLength(), author, style); - } + sd.insertString(sd.getLength(), author, style); if (!selected) { + int pos = sd.getLength(); for (SearchHighlight highlight : highlights) { if (highlight.getKind() == SearchHighlight.Kind.AUTHOR) { int doclen = sd.getLength(); @@ -624,10 +599,6 @@ private Style createHiliteStyleStyle (JTextPane textPane, Style normalStyle, Att @Override public void paint(Graphics g) { super.paint(g); - AuthorLinker author = linkerSupport.getLinker(AuthorLinker.class, id); - if (author != null) { - author.computeBounds(revisionCell.getAuthorControl(), revisionCell); - } IssueLinker issue = linkerSupport.getLinker(IssueLinker.class, id); if (issue != null) { issue.computeBounds(revisionCell.getCommitMessageControl(), revisionCell); diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/util/TemplateSelector.java b/ide/versioning.util/src/org/netbeans/modules/versioning/util/TemplateSelector.java index bfe8e4851f29..6f1162dc4d54 100644 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/util/TemplateSelector.java +++ b/ide/versioning.util/src/org/netbeans/modules/versioning/util/TemplateSelector.java @@ -49,14 +49,6 @@ public TemplateSelector(Preferences preferences) { this.preferences = preferences; } - /** - * @deprecated use {@link #show(java.lang.String) } instead - */ - @Deprecated - public boolean show() { - return show(TemplatesPanel.class.getName()); - } - public boolean show (String helpCtxId) { getPanel().autoFillInCheckBox.setSelected(isAutofill()); getPanel().templateTextArea.setText(getTemplate()); diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/util/Utils.java b/ide/versioning.util/src/org/netbeans/modules/versioning/util/Utils.java index b3141ac50ff8..ae220bb7f020 100644 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/util/Utils.java +++ b/ide/versioning.util/src/org/netbeans/modules/versioning/util/Utils.java @@ -65,7 +65,6 @@ import org.netbeans.api.project.SourceGroup; import org.netbeans.api.project.Sources; import org.netbeans.api.queries.FileEncodingQuery; -import org.netbeans.api.queries.VersioningQuery; import org.netbeans.modules.versioning.core.api.VCSFileProxy; import org.netbeans.modules.versioning.spi.VersioningSystem; import org.openide.ErrorManager; @@ -259,28 +258,6 @@ public static Set getAllDataObjectFiles(File file) { return filesToCheckout; } - /** - * Some folders are special and versioning should not look for metadata in - * them. Folders like /net with automount enabled may take a long time to - * answer I/O on their children, so - * VCSFileProxy.exists("/net/.git") will freeze until it - * timeouts. You should call this method before asking any I/O on children - * of this folder you are unsure to actually exist. This does not mean - * however that whole subtree should be excluded from version control, only - * that you should not look for the metadata directly in this folder. - * Returns true if the given folder is among such folders. - * - * @param folderPath path to a folder to query - * @return true if the folder identified by the given path - * should be skipped when searching for metadata. - * @since 1.54 - * @deprecated use isForbiddenFolder(File) or isForbiddenFolder(VCSFileProxy) - */ - @Deprecated - public static boolean isForbiddenFolder (String folderPath) { - return forbiddenFolders.contains(folderPath); - } - /** * Some folders are special and versioning should not look for metadata in * them. Folders like /net with automount enabled may take a long time to @@ -865,21 +842,6 @@ public static CloneableEditorSupport openFile(FileObject fo, String revision) { return ces; } - /** - * Asks for permission to scan a given folder for versioning metadata. Misconfigured automount daemons may - * try to look for a "CVS" server if asked for "/net/CVS/Entries" file for example causing hangs and full load. - * Versioning systems must NOT scan a folder if this method returns true and should consider it as unversioned. - * - * @deprecated Use {@link VersioningSupport#isExcluded(java.io.File) } instead - * @param folder a folder to query - * @link http://www.netbeans.org/issues/show_bug.cgi?id=105161 - * @return true if scanning for versioning system metadata is forbidden in the given folder, false otherwise - */ - @Deprecated - public static boolean isScanForbidden(File folder) { - return VersioningSupport.isExcluded(folder); - } - /** * Opens a file in the editor area. * @@ -1169,24 +1131,12 @@ private static String getKnownRepositoryFor (String repositoryUrl) { repositoryUrl = repositoryUrl.toLowerCase(); if (repositoryUrl.contains("github.com")) { //NOI18N return "GITHUB"; //NOI18N - } else if (repositoryUrl.contains("gitorious.org")) { //NOI18N - return "GITORIOUS"; //NOI18N } else if (repositoryUrl.contains("bitbucket.org")) { //NOI18N return "BITBUCKET"; //NOI18N } else if (repositoryUrl.contains("sourceforge.net")) { //NOI18N return "SOURCEFORGE"; //NOI18N - } else if (repositoryUrl.contains("googlecode.com") //NOI18N - || repositoryUrl.contains("code.google.com") //NOI18N - || repositoryUrl.contains("googlesource.com")) { //NOI18N - return "GOOGLECODE"; //NOI18N - } else if (repositoryUrl.contains("kenai.com")) { //NOI18N - return "KENAI"; //NOI18N - } else if (repositoryUrl.contains("java.net")) { //NOI18N - return "JAVANET"; //NOI18N } else if (repositoryUrl.contains("netbeans.org")) { //NOI18N return "NETBEANS"; //NOI18N - } else if (repositoryUrl.contains("codeplex.com")) { //NOI18N - return "CODEPLEX"; //NOI18N } else if (repositoryUrl.contains(".eclipse.org")) { //NOI18N return "ECLIPSE"; //NOI18N } else { @@ -1274,34 +1224,6 @@ public static boolean isFromMultiFileDataObject (VCSContext ctx) { return false; } - /** - * Parses system property value and returns a priority for the given versioning system. - * The property should be defined as {@code versioning.versioningSystem.priority}. - * @param versioningSystem name of the vcs - * @return priority or {@link Integer#MAX_VALUE} as default - * @deprecated should not be used any more - */ - @Deprecated - public static Integer getPriority (String versioningSystem) { - Integer value = null; - String propName = "versioning." + versioningSystem + ".priority"; //NOI18N - String sValue = System.getProperty(propName, null); - if (sValue != null && !sValue.isEmpty()) { - try { - value = Integer.parseInt(sValue); - if (value <= 0) { - value = null; - } - } catch (NumberFormatException ex) { - Logger.getLogger(Utils.class.getName()).log(Level.INFO, "Wrong priority ({0}) value {1}, using default value", new Object[] {propName, sValue}); //NOI18N - } - } - if (value == null) { - value = Integer.MAX_VALUE; - } - return value; - } - private static File getTempDir (boolean deleteOnExit) { if (tempDir == null) { File tmpDir = new File(System.getProperty("java.io.tmpdir")); // NOI18N @@ -1436,47 +1358,6 @@ protected boolean asynchronousOpen() { } } - // ----- - // Usages logging based on repository URL (for Kenai) - - private static VCSKenaiAccessor kenaiAccessor; - private static final LinkedList loggedRoots = new LinkedList(); - private static final List foldersToCheck = new LinkedList(); - private static Runnable loggingTask = null; - - public static void logVCSKenaiUsage(String vcs, String repositoryUrl) { - VCSKenaiAccessor kenaiSup = getKenaiAccessor(); - if (kenaiSup != null) { - kenaiSup.logVcsUsage(vcs, repositoryUrl); - } - } - - private static VCSKenaiAccessor getKenaiAccessor() { - if (kenaiAccessor == null) { - kenaiAccessor = Lookup.getDefault().lookup(VCSKenaiAccessor.class); - } - return kenaiAccessor; - } - - /* - * Makes sure repository of given versioned folder is logged for usage - * (if on Kenai). Versioned folders are collected and a task invoked in 2s - * to process them. Roots are remembered so no subfolder is processed again - * (it's enough to log one usage per repository). Called from annotators so - * all user visible repositories are logged. - */ - public static void addFolderToLog(File folder) { - if (!checkFolderLogged(folder, false)) { - synchronized(foldersToCheck) { - foldersToCheck.add(folder); - if (loggingTask == null) { - loggingTask = new LogTask(); - Utils.postParallel(loggingTask, 2000); - } - } - } - } - /** * Determines versioning systems that manage files in given context. * @@ -1495,59 +1376,6 @@ public static VersioningSystem[] getOwners(VCSContext ctx) { return (VersioningSystem[]) owners.toArray(new VersioningSystem[0]); } - private static class LogTask implements Runnable { - @Override - public void run() { - File[] folders; - synchronized (foldersToCheck) { - folders = foldersToCheck.toArray(new File[0]); - foldersToCheck.clear(); - loggingTask = null; - } - for (File f : folders) { - if (!checkFolderLogged(f, false)) { // if other task has not processed the root yet - VersioningSystem vs = VersioningSupport.getOwner(f); - if (vs != null) { - File root = vs.getTopmostManagedAncestor(f); - if (root != null) { - checkFolderLogged(root, true); // remember the root - FileObject rootFO = FileUtil.toFileObject(root); - if (rootFO != null) { - String url = VersioningQuery.getRemoteLocation(rootFO.toURI()); - if (url != null) { - Object name = vs.getProperty(VersioningSystem.PROP_DISPLAY_NAME); - if (!(name instanceof String)) { - name = vs.getClass().getSimpleName(); - } - logVCSKenaiUsage(name.toString(), url); - } - } - } - } - } - } - } - } - - private static boolean checkFolderLogged(File folder, boolean add) { - synchronized(loggedRoots) { - for (File f : loggedRoots) { - String ancestorPath = f.getPath(); - String folderPath = folder.getPath(); - if (folderPath.startsWith(ancestorPath) - && (folderPath.length() == ancestorPath.length() - || folderPath.charAt(ancestorPath.length()) == File.separatorChar)) { - // folder is the same or subfolder of already logged one - return true; - } - } - if (add) { - loggedRoots.add(folder); - } - } - return false; - } - /** * Returns hash value for the given byte array and algoritmus in a hex string form. * @param alg Algoritmus to compute the hash value (see also Appendix A in the diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSHyperlinkSupport.java b/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSHyperlinkSupport.java index a11a4117317d..883c192a6892 100644 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSHyperlinkSupport.java +++ b/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSHyperlinkSupport.java @@ -36,11 +36,7 @@ import javax.swing.text.BadLocationException; import javax.swing.text.Position; import javax.swing.text.Style; -import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; -import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser; -import org.openide.util.Exceptions; -import org.openide.util.NbBundle; /** * Implementation provides hyperlink support for VCS anotation bar and history views @@ -49,7 +45,7 @@ */ public class VCSHyperlinkSupport { private static Logger LOG = Logger.getLogger(VCSHyperlinkSupport.class.getName()); - private Map> linkers = new HashMap>(); + private final Map> linkers = new HashMap<>(); public T getLinker(Class t, int idx) { return getLinker(t, Integer.toString(idx)); @@ -72,7 +68,7 @@ public void add(Hyperlink l, String idx) { if(l == null) return; List list = linkers.get(idx); if(list == null) { - list = new ArrayList(); + list = new ArrayList<>(); } list.add(l); linkers.put(idx, list); @@ -267,100 +263,6 @@ public void insertString(StyledDocument sd, Style style) throws BadLocationExcep } } - public static class AuthorLinker extends StyledDocumentHyperlink { - private static final String AUTHOR_ICON_STYLE = "authorIconStyle"; // NOI18N - - private Rectangle bounds; - private final int docstart; - private final int docend; - private final KenaiUser kenaiUser; - private final String author; - private final Style authorStyle; - private final String insertToChat; - - public AuthorLinker(KenaiUser kenaiUser, Style authorStyle, StyledDocument sd, String author) throws BadLocationException { - this(kenaiUser, authorStyle, sd, author, null); - } - - public AuthorLinker(KenaiUser kenaiUser, Style authorStyle, StyledDocument sd, String author, String insertToChat) throws BadLocationException { - this.kenaiUser = kenaiUser; - this.author = author; - this.authorStyle = authorStyle; - this.insertToChat = insertToChat; - - int doclen = sd.getLength(); - int textlen = author.length(); - - docstart = doclen; - docend = doclen + textlen; - } - - @Override - public void computeBounds(JTextPane textPane) { - computeBounds(textPane, null); - } - - public void computeBounds(JTextPane textPane, BoundsTranslator translator) { - Rectangle tpBounds = textPane.getBounds(); - TextUI tui = textPane.getUI(); - this.bounds = new Rectangle(); - try { - Rectangle startr = tui.modelToView(textPane, docstart, Position.Bias.Forward).getBounds(); - Rectangle endr = tui.modelToView(textPane, docend, Position.Bias.Backward).getBounds(); - if(kenaiUser.getIcon() != null) { - endr.x += kenaiUser.getIcon().getIconWidth(); - } - this.bounds = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height); - - if (null != translator) { - translator.correctTranslation(textPane, this.bounds); - } - } catch (BadLocationException ex) { - Exceptions.printStackTrace(ex); - } - } - - @Override - public boolean mouseClicked(Point p) { - if (bounds != null && bounds.contains(p)) { - if(insertToChat != null) { - kenaiUser.startChat(insertToChat); - } else { - kenaiUser.startChat(); - } - return true; - } - return false; - } - - @Override - public boolean mouseMoved(Point p, JComponent component) { - if (bounds != null && bounds.contains(p)) { - component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - component.setToolTipText(NbBundle.getMessage(VCSHyperlinkSupport.class, "LBL_StartChat", author)); - return true; - } - return false; - } - - @Override - public void insertString(StyledDocument sd, Style style) throws BadLocationException { - if(style == null) { - style = authorStyle; - } - sd.insertString(sd.getLength(), author, style); - - String iconStyleName = AUTHOR_ICON_STYLE + author; - Style iconStyle = sd.getStyle(iconStyleName); - if(iconStyle == null) { - iconStyle = sd.addStyle(iconStyleName, null); - StyleConstants.setIcon(iconStyle, kenaiUser.getIcon()); - } - sd.insertString(sd.getLength(), " ", style); - sd.insertString(sd.getLength(), " ", iconStyle); - } - } - public static interface BoundsTranslator { /** * Corrects the bounding rectangle of nested textpanes. diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSKenaiAccessor.java b/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSKenaiAccessor.java deleted file mode 100644 index 1a74f15ea406..000000000000 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/util/VCSKenaiAccessor.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.netbeans.modules.versioning.util; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.net.PasswordAuthentication; -import java.net.URI; -import java.util.Date; -import java.util.List; -import java.util.logging.Logger; -import javax.swing.Icon; -import javax.swing.JLabel; -import org.netbeans.api.java.classpath.ClassPath; -import org.netbeans.api.project.FileOwnerQuery; -import org.netbeans.api.project.Project; -import org.netbeans.api.project.ProjectUtils; -import org.openide.filesystems.FileObject; -import org.openide.filesystems.FileUtil; -import org.openide.util.RequestProcessor; - -/** - * Implementation provides access to kenai API - * - * @author Tomas Stupka - */ -public abstract class VCSKenaiAccessor { - - /** - * Some kenai vcs repository was changed - */ - public static final String PROP_KENAI_VCS_NOTIFICATION = "kenai.vcs.notification"; // NOI18N - - protected static final Logger LOG = Logger.getLogger("org.netbeans.modules.versioning.util.VCSKenaiSupport"); - - /** - * A Kenai service - */ - public enum Service { - VCS_SVN, - VCS_HG, - UNKNOWN; - } - - /** - * Kenai repository's access rights - */ - public enum RepositoryActivity { - READ, - WRITE - } - - /** - * Returns an instance of PasswordAuthentication holding the actuall - * Kenai credentials or null if user not logged in. - * - * @return - */ - public abstract PasswordAuthentication getPasswordAuthentication(String url); - - /** - * Returns an instance of PasswordAuthentication holding the actuall - * Kenai credentials or forces a login if forceLogin is true - * - * @param forceLogin opens a login dialog is user not logged in - * @return - */ - public abstract PasswordAuthentication getPasswordAuthentication(String url, boolean forceLogin); - - /** - * Returns true if the given url is a Kenai project VCS repository url, otherwise false. - * - * @param url - * @return - */ - public abstract boolean isKenai(String url); - - /** - * Opens the kenai login dialog. - * @return true if login successfull, otherwise false - */ - public abstract boolean showLogin(); - - /** - * Determines if the user is logged into kenai - * @return true if user is logged into kenai otherwise false - */ - public abstract boolean isLogged (String url); - - /** - * Returns a {@link KenaiUser} with the given name - * @param userName user name - * @return a KenaiUser instance - */ - public abstract KenaiUser forName(final String userName); - - /** - * Returns a {@link KenaiUser} with the given name associated with a kenai specified by the given url - * @param userName user name - * @param url url of the kenai the username is associated with - * @return a KenaiUser instance - */ - public abstract KenaiUser forName(final String userName, final String url); - - /** - * Determines wheter the user with the given name is online or not - * - * @param userName user name - * @return true if user is online, otherwise false - */ - public abstract boolean isUserOnline(String userName); - - /** - * Registers a listener to listen on changes in a kenai VCS repository - * @param l listener - */ - public abstract void addVCSNoficationListener(PropertyChangeListener l); - - /** - * Unregisters a listener to listen on changes in a kenai VCS repository - * @param l listener - */ - public abstract void removeVCSNoficationListener(PropertyChangeListener l); - - /** - * Returns a path to a web page showing information about a revision in the repository. - * @param sourcesUrl repository url - * @param revision required revision - * @return - */ - public abstract String getRevisionUrl (String sourcesUrl, String revision); - - /** - * Logs usage of a versioning system for a specific repository - if the - * repository is from Kenai. - * @param vcs name of the versioning system - * @param repositoryUrl repository URL - */ - public abstract void logVcsUsage(String vcs, String repositoryUrl); - - /** - * Returns false if currently logged user is not authorized to perform a given activity on a given kenai repository. - * @param repositoryURL repository url - * @param activity requested activity - * @return - */ - public abstract boolean isAuthorized (String repositoryURL, RepositoryActivity activity); - - /** - * Repesents a Kenai user - */ - public abstract static class KenaiUser { - - /** - * Determines wheter the {@link KenaiUser} is online or not - * @return true if user is online, othewise false - */ - public abstract boolean isOnline(); - - /** - * Register a listener - * @param listener - */ - public abstract void addPropertyChangeListener(PropertyChangeListener listener); - - /** - * Unregister a listener - * @param listener - */ - public abstract void removePropertyChangeListener(PropertyChangeListener listener); - - /** - * Returns an icon representing the users online status - * @return - */ - public abstract Icon getIcon(); - - /** - * Returns an widget representing the users - * @return - */ - public abstract JLabel createUserWidget(); - - /** - * Returns user name - * @return - */ - public abstract String getUser(); - - /** - * Start a chat session with this user - */ - public abstract void startChat(); - - /** - * Start a chat session with this user and inserts the given message - */ - public abstract void startChat(String msg); - - public static String getChatLink(FileObject fo, int line) { - ClassPath cp = ClassPath.getClassPath(fo, ClassPath.SOURCE); - String ret = ""; // NOI18N - if (cp != null) { - ret = cp.getResourceName(fo); - } else { - Project p = FileOwnerQuery.getOwner(fo); - if (p != null) { - ret = "{$" + // NOI18N - ProjectUtils.getInformation(p).getName() + - "}/" + // NOI18N - FileUtil.getRelativePath(p.getProjectDirectory(), fo); - } else { - ret = fo.getPath(); - } - } - ret += ":" + line; // NOI18N - ret = "FILE:" + ret; // NOI18N - return ret; - } - } - - /** - * Represents a change in a kenai VCS repository - */ - public abstract static class VCSKenaiNotification { - - /** - * The repository uri - * @return - */ - public abstract URI getUri(); - - /** - * Timestamp of change - * @return - */ - public abstract Date getStamp(); - - /** - * Determines the repository service - e.g svn, hg - * @return - */ - public abstract Service getService(); - - /** - * Notified modifications - * @return - */ - public abstract List getModifications(); - - /** - * Author who made the change - * @return - */ - public abstract String getAuthor(); - - /** - * Returns the netbeans projects directoru - */ - public abstract File getProjectDirectory(); - } - - /** - * Represenst a modification in a Kenai VCS repository - */ - public abstract static class VCSKenaiModification { - - /** - * Type of modification - */ - public static enum Type { - NEW, - CHANGE, - DELETE - } - - /** - * Determines the type of this modification - * @return - */ - public abstract Type getType(); - - /** - * Determines the affeted resource - * @return - */ - public abstract String getResource(); - - /** - * Identifies this modification - e.g reviosion or changeset - * @return - */ - public abstract String getId(); - } - - /** - * Hadles VCS notifications from kenai - */ - public abstract static class KenaiNotificationListener extends VCSNotificationDisplayer implements PropertyChangeListener { - - protected static Logger LOG = VCSKenaiAccessor.LOG; - - private final RequestProcessor rp = new RequestProcessor("Kenai VCS notifications"); //NOI18N - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if(evt.getPropertyName().equals(VCSKenaiAccessor.PROP_KENAI_VCS_NOTIFICATION)) { - final VCSKenaiNotification notification = (VCSKenaiNotification) evt.getNewValue(); - rp.post(new Runnable() { - @Override - public void run() { - handleVCSNotification(notification); - } - }); - } - } - - /** - * Do whatever you have to do with a nofitication - * - * @param notification - */ - protected abstract void handleVCSNotification(VCSKenaiNotification notification); - - } - -} diff --git a/ide/versioning.util/test/unit/src/org/netbeans/modules/proxy/Base64EncoderTest.java b/ide/versioning.util/test/unit/src/org/netbeans/modules/proxy/Base64EncoderTest.java deleted file mode 100644 index cb821a5164b3..000000000000 --- a/ide/versioning.util/test/unit/src/org/netbeans/modules/proxy/Base64EncoderTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.netbeans.modules.proxy; - -import java.nio.charset.StandardCharsets; -import org.junit.Test; -import static org.junit.Assert.*; - -public class Base64EncoderTest { - - /** - * Test of encode method, of class Base64Encoder. - */ - @Test - public void testEncode_byteArr() { - final byte[] data = ("Encode this string to Base64") - .getBytes(StandardCharsets.UTF_8); - final String expected = "RW5jb2RlIHRoaXMgc3RyaW5nIHRvIEJhc2U2NA=="; - - assertEquals(expected, Base64Encoder.encode(data)); - } - - /** - * Test of encode method, of class Base64Encoder. - */ - @Test - public void testEncode_byteArr_boolean_nowrap() { - final byte[] data = ("Encode this string to Base64") - .getBytes(StandardCharsets.UTF_8); - final String expected = "RW5jb2RlIHRoaXMgc3RyaW5nIHRvIEJhc2U2NA=="; - - assertEquals(expected, Base64Encoder.encode(data, false)); - } - - /** - * Test of encode method, of class Base64Encoder. - */ - @Test - public void testEncode_byteArr_boolean_wrap() { - final byte[] data = ("Encode this string to Base64, then wrap it in lines of" - + " no more than 60 chars using platform line separator") - .getBytes(StandardCharsets.UTF_8); - final String expected = "RW5jb2RlIHRoaXMgc3RyaW5nIHRvIEJhc2U2NCwgdGhlbiB3cmFwIGl0IGlu" + System.getProperty("line.separator") - + "IGxpbmVzIG9mIG5vIG1vcmUgdGhhbiA2MCBjaGFycyB1c2luZyBwbGF0Zm9y" + System.getProperty("line.separator") - + "bSBsaW5lIHNlcGFyYXRvcg=="; - - assertEquals(expected, Base64Encoder.encode(data, true)); - } - - /** - * Test of decode method, of class Base64Encoder. - */ - @Test - public void testDecode() { - final String encoded = "VGhpcyBzdHJpbmcgaGFzIGJlZW4gZGVjb2RlZCBmcm9tIEJhc2U2NA=="; - final byte[] expected = ("This string has been decoded from Base64") - .getBytes(StandardCharsets.UTF_8); - - assertArrayEquals(expected, Base64Encoder.decode(encoded)); - } - - /** - * Test of decode method, of class Base64Encoder. - */ - @Test - public void testDecode_nonPrintable() { - final String encoded = "\tVGhpcyBzdHJpbmcg\n" - + " aGFzIGJlZW4gZGVj\r" - + "b2RlZCBmcm9tIEJh" - + "c2U2NA== "; - final byte[] expected = ("This string has been decoded from Base64") - .getBytes(StandardCharsets.UTF_8); - - assertArrayEquals(expected, Base64Encoder.decode(encoded)); - } - -} diff --git a/java/maven.model/nbproject/project.xml b/java/maven.model/nbproject/project.xml index 6a671ce7c2ba..c118d385cefe 100644 --- a/java/maven.model/nbproject/project.xml +++ b/java/maven.model/nbproject/project.xml @@ -212,7 +212,6 @@ org.javeleon.netbeans org.netbeans.modules.groovy.support org.netbeans.modules.hudson.maven - org.netbeans.modules.kenai.maven org.netbeans.modules.licensechanger org.netbeans.modules.maven org.netbeans.modules.maven.apisupport diff --git a/java/maven/nbproject/project.xml b/java/maven/nbproject/project.xml index 1f3e9ff149f5..e65ec33f4930 100644 --- a/java/maven/nbproject/project.xml +++ b/java/maven/nbproject/project.xml @@ -619,7 +619,6 @@ org.netbeans.modules.groovy.support org.netbeans.modules.hudson.maven org.netbeans.modules.jbi.fuji.support - org.netbeans.modules.kenai.maven org.netbeans.api.maven org.netbeans.modules.maven.apisupport org.netbeans.modules.maven.checkstyle