Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
correct source formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BeckerFrank committed Nov 29, 2022
1 parent c3e0f3b commit f718156
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public InputStream getContents() throws CoreException {
.openStream();
} catch (Exception e) {
e.printStackTrace();
throw new CoreException(new Status(IStatus.ERROR, GitConnector.PLUGIN_ID,
e.getMessage()));
throw new CoreException(
new Status(IStatus.ERROR, GitConnector.PLUGIN_ID, e.getMessage()));
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ private void fetchChanges() {
Repository repository = scmRepository.getRepository();
RevWalk walk = new RevWalk(repository);

delegate.addAll(((GitConnector) scmRepository.getConnector()).diffCommit(scmRepository, repository, walk,
commit));
delegate.addAll(
((GitConnector) scmRepository.getConnector()).diffCommit(scmRepository, repository, walk, commit));
} catch (IOException e) {
e.printStackTrace();
// TODO: handle exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,9 @@ protected void populateNextChangeSets() {
}
if (repoProject != null && repoProject.equals(inputProject.getName())) {
String[] tokens = updatedChangeSet.getMessage().split(GIT_NEWLINE, 2);
commitList.add((tokens[0].length() > DIALOG_COMBO_MAX_CHARACTERS) ? tokens[0].substring(0,
DIALOG_COMBO_MAX_CHARACTERS - 3) + "..." : tokens[0]);
commitList.add((tokens[0].length() > DIALOG_COMBO_MAX_CHARACTERS)
? tokens[0].substring(0, DIALOG_COMBO_MAX_CHARACTERS - 3) + "..."
: tokens[0]);
filteredChangeSets.add(updatedChangeSet);
currentCommitListIndex++;

Expand Down Expand Up @@ -379,19 +380,17 @@ public void expansionStateChanged(ExpansionEvent e) {
// Author Name
final Label authorNameLabel = aToolkit.createLabel(basicSectionClient, "Author Name: ", SWT.WRAP);
authorNameLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
authorNameText = aToolkit.createLabel(basicSectionClient, selectedChangeSet == null
? ""
: selectedChangeSet.getAuthor().getName(), SWT.NONE);
authorNameText = aToolkit.createLabel(basicSectionClient,
selectedChangeSet == null ? "" : selectedChangeSet.getAuthor().getName(), SWT.NONE);
textGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
textGridData.horizontalSpan = 3;
authorNameText.setLayoutData(textGridData);

// Author Email
final Label authorEmailLabel = aToolkit.createLabel(basicSectionClient, "Author Email: ", SWT.WRAP);
authorEmailLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
authorEmailText = aToolkit.createLabel(basicSectionClient, selectedChangeSet == null
? ""
: selectedChangeSet.getAuthor().getEmail(), SWT.NONE);
authorEmailText = aToolkit.createLabel(basicSectionClient,
selectedChangeSet == null ? "" : selectedChangeSet.getAuthor().getEmail(), SWT.NONE);
textGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
textGridData.horizontalSpan = 3;
authorEmailText.setLayoutData(textGridData);
Expand All @@ -408,9 +407,8 @@ public void expansionStateChanged(ExpansionEvent e) {
// Repository Name
final Label messageLabel = aToolkit.createLabel(basicSectionClient, "Repository: ", SWT.WRAP);
messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
repositoryNameText = aToolkit.createLabel(basicSectionClient, selectedChangeSet == null
? ""
: selectedChangeSet.getRepository().getName(), SWT.NONE);
repositoryNameText = aToolkit.createLabel(basicSectionClient,
selectedChangeSet == null ? "" : selectedChangeSet.getRepository().getName(), SWT.NONE);
textGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
textGridData.horizontalSpan = 3;
repositoryNameText.setLayoutData(textGridData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ private ISVNRemoteResource resolveRemoteResource(IProgressMonitor monitor, ISVNR
return resource;
}

private IStorage resolveStorage(IProgressMonitor monitor, Long revNo, ISVNRepositoryLocation location, String path) {
private IStorage resolveStorage(IProgressMonitor monitor, Long revNo, ISVNRepositoryLocation location,
String path) {

try {
final SVNRevision revision = new SVNRevision.Number(revNo.longValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ private List<Change> buildChanges(SubclipseRepository repository, ISVNLogMessage
oldArtifact = resolveBaseArtifact(repository, newArtifact.getRepositoryURL(), sRevision,
isvnLogMessageChangePath, ctype);
} catch (MalformedURLException e) {
logger.log(new Status(IStatus.ERROR, SubclipseCorePlugin.PLUGIN_ID,
"Error resolving an artifact url" //$NON-NLS-1$
logger.log(
new Status(IStatus.ERROR, SubclipseCorePlugin.PLUGIN_ID, "Error resolving an artifact url" //$NON-NLS-1$
+ isvnLogMessageChangePath.getPath(), e));
}

Expand Down Expand Up @@ -237,8 +237,8 @@ public List<ChangeSet> getChangeSets(ScmRepository repository, IProgressMonitor
//TODO: retrieving all revisions per project repository can take really long time,
//need to discuss API to narrow down the list e.g. return an iterator
//For the time being we limit the possibility to review commits within the last 20
ISVNLogMessage[] messages = resolveChangeSets(repo, repo.getProjectSVNFolder(), SVNRevision.HEAD,
firstRevision, false, 20L);
ISVNLogMessage[] messages = resolveChangeSets(repo, repo.getProjectSVNFolder(), SVNRevision.HEAD, firstRevision,
false, 20L);

//Convert the messages to ChangeSet
List<ChangeSet> changeSets = new ArrayList<ChangeSet>(messages.length);
Expand Down Expand Up @@ -412,7 +412,8 @@ private SubclipseArtifact resolveBaseArtifact(SubclipseRepository repo, SVNUrl p
//Resolve the previous commit where this file took part
ISVNLogMessage[] filePreviousCommits = null;
boolean fetchChangePaths = true;
filePreviousCommits = resolveChangeSets(repo, pathUrl, sRevision, eRevision, fetchChangePaths, Long.valueOf(2L));
filePreviousCommits = resolveChangeSets(repo, pathUrl, sRevision, eRevision, fetchChangePaths,
Long.valueOf(2L));

String revisionId = null;
if (filePreviousCommits != null && filePreviousCommits.length > 1) {
Expand Down Expand Up @@ -569,8 +570,8 @@ public void run() {

try {
//Resolve the changes for the max chunk size
msgList = resolveChangeSets(repo, repo.getProjectSVNFolder(), startRevision, earliestRevision,
true, CHUNKSIZE);
msgList = resolveChangeSets(repo, repo.getProjectSVNFolder(), startRevision, earliestRevision, true,
CHUNKSIZE);

//adapt to ChangeSet
int size = msgList.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class SubclipseRepository extends ScmRepository {

private final SVNUrl folderUrlStr;

public SubclipseRepository(SubclipseConnector connector, ISVNRepositoryLocation location, IProject aSelectedProject) {
public SubclipseRepository(SubclipseConnector connector, ISVNRepositoryLocation location,
IProject aSelectedProject) {
this.location = location;
setName(location.getLocation());
setUrl(location.getUrl().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ public void widgetSelected(SelectionEvent e) {
try {
populateNextChangeSets();
} catch (CoreException e1) {
StatusHandler.log(new Status(IStatus.ERROR, SVNConnectorUi.ID_PLUGIN, IStatus.OK,
e.toString(), e1));
StatusHandler.log(
new Status(IStatus.ERROR, SVNConnectorUi.ID_PLUGIN, IStatus.OK, e.toString(), e1));
return;
}
commitList.select(selectedIndex);
Expand Down Expand Up @@ -317,8 +317,9 @@ protected void populateNextChangeSets() throws CoreException {
}
if (repoProject != null && repoProject.equals(inputProject.getName())) {
String[] tokens = updatedChangeSet.getMessage().split(NEWLINE, 2);
commitList.add((tokens[0].length() > DIALOG_COMBO_MAX_CHARACTERS) ? tokens[0].substring(0,
DIALOG_COMBO_MAX_CHARACTERS - 3) + "..." : tokens[0]);
commitList.add((tokens[0].length() > DIALOG_COMBO_MAX_CHARACTERS)
? tokens[0].substring(0, DIALOG_COMBO_MAX_CHARACTERS - 3) + "..."
: tokens[0]);
filteredChangeSets.add(updatedChangeSet);

addedCount++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public int compare(IProject o1, IProject o2) {
xmlMemento.save(writer);
return output;
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, ScmInternal.ID_PLUGIN,
"Unexpected error exporting project sets.", e)); //$NON-NLS-1$
throw new CoreException(
new Status(IStatus.ERROR, ScmInternal.ID_PLUGIN, "Unexpected error exporting project sets.", e)); //$NON-NLS-1$
} finally {
if (writer != null) {
try {
Expand Down Expand Up @@ -142,8 +142,8 @@ public static List<String> readProjectReferences(InputStream input, RepositoryPr
}
return referenceStrings;
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, ScmInternal.ID_PLUGIN,
"Unexpected error reading project sets.", e)); //$NON-NLS-1$
throw new CoreException(
new Status(IStatus.ERROR, ScmInternal.ID_PLUGIN, "Unexpected error reading project sets.", e)); //$NON-NLS-1$
}
}

Expand All @@ -155,14 +155,14 @@ private static XmlMemento getXMLMementoRoot() throws ParserConfigurationExceptio
return new XmlMemento(document, element);
}

private static XmlMemento[] importProjectSet(InputStream input) throws UnsupportedEncodingException,
InvocationTargetException {
private static XmlMemento[] importProjectSet(InputStream input)
throws UnsupportedEncodingException, InvocationTargetException {
XmlMemento xmlMemento = parseStream(input);
return xmlMemento.getChildren("provider"); //$NON-NLS-1$
}

private static XmlMemento parseStream(InputStream input) throws InvocationTargetException,
UnsupportedEncodingException {
private static XmlMemento parseStream(InputStream input)
throws InvocationTargetException, UnsupportedEncodingException {
InputStreamReader reader = new InputStreamReader(input, "UTF-8"); //$NON-NLS-1$
try {
return XmlMemento.createReadRoot(reader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,15 @@ private static ScmConnector loadConnector(String id) {
if (object instanceof ScmConnector) {
return (ScmConnector) object;
} else {
result.add(new Status(
IStatus.ERROR,
ScmInternal.ID_PLUGIN,
NLS.bind(
"Connector core ''{0}'' does not extend expected class for extension contributed by {1}", //$NON-NLS-1$
object.getClass().getCanonicalName(), element.getContributor().getName())));
result.add(new Status(IStatus.ERROR, ScmInternal.ID_PLUGIN, NLS.bind(
"Connector core ''{0}'' does not extend expected class for extension contributed by {1}", //$NON-NLS-1$
object.getClass().getCanonicalName(), element.getContributor().getName())));
}
} catch (Throwable e) {
result.add(new Status(
IStatus.ERROR,
ScmInternal.ID_PLUGIN,
NLS.bind(
"Connector core failed to load for extension contributed by {0}", element.getContributor().getName()), e)); //$NON-NLS-1$
result.add(new Status(IStatus.ERROR, ScmInternal.ID_PLUGIN,
NLS.bind("Connector core failed to load for extension contributed by {0}", //$NON-NLS-1$
element.getContributor().getName()),
e));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public IFileRevision getFileRevision(IProgressMonitor monitor) {

public IFileHistory getFileHistory(IProgressMonitor monitor) {
RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), connector.getProviderId());
IFileHistory history = provider.getFileHistoryProvider().getFileHistoryFor(resource, IFileHistoryProvider.NONE,
monitor);
IFileHistory history = provider.getFileHistoryProvider()
.getFileHistoryFor(resource, IFileHistoryProvider.NONE, monitor);
return history;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ public void testGetResourcePathChild() throws Exception {
.getRoot()
.findMember("/project1/src/org/eclipse/mylar/tests/project1/Project1Plugin.java");

assertEquals(
expectedResource,
ScmCore.findResource("/root/level1/level2/project1/src/org/eclipse/mylar/tests/project1/Project1Plugin.java"));
assertEquals(
expectedResource,
ScmCore.findResource("root/level1/level2/project1/src/org/eclipse/mylar/tests/project1/Project1Plugin.java"));
assertEquals(expectedResource, ScmCore
.findResource("/root/level1/level2/project1/src/org/eclipse/mylar/tests/project1/Project1Plugin.java"));
assertEquals(expectedResource, ScmCore
.findResource("root/level1/level2/project1/src/org/eclipse/mylar/tests/project1/Project1Plugin.java"));

}

Expand All @@ -88,7 +86,8 @@ public void testGetResourceFromProject() throws Exception {

assertEquals(expectedResource,
ScmCore.findResource("/src/org/eclipse/mylar/tests/project2/Project2Plugin.java"));
assertEquals(expectedResource, ScmCore.findResource("src/org/eclipse/mylar/tests/project2/Project2Plugin.java"));
assertEquals(expectedResource,
ScmCore.findResource("src/org/eclipse/mylar/tests/project2/Project2Plugin.java"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,15 @@ private static ScmConnectorUi loadConnector(String id) {
if (object instanceof ScmConnectorUi) {
return (ScmConnectorUi) object;
} else {
result.add(new Status(
IStatus.ERROR,
ScmUi.ID_PLUGIN,
NLS.bind(
"Connector ui ''{0}'' does not extend expected class for extension contributed by {1}", //$NON-NLS-1$
object.getClass().getCanonicalName(), element.getContributor().getName())));
result.add(new Status(IStatus.ERROR, ScmUi.ID_PLUGIN, NLS.bind(
"Connector ui ''{0}'' does not extend expected class for extension contributed by {1}", //$NON-NLS-1$
object.getClass().getCanonicalName(), element.getContributor().getName())));
}
} catch (Throwable e) {
result.add(new Status(
IStatus.ERROR,
ScmUi.ID_PLUGIN,
NLS.bind(
"Connector core failed to load for extension contributed by {0}", element.getContributor().getName()), e)); //$NON-NLS-1$
result.add(new Status(IStatus.ERROR, ScmUi.ID_PLUGIN,
NLS.bind("Connector core failed to load for extension contributed by {0}", //$NON-NLS-1$
element.getContributor().getName()),
e));
}
}
}
Expand Down

0 comments on commit f718156

Please sign in to comment.