Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2011-02-22 22:05:16 +0000
committerRyan D. Brooks2011-02-22 22:05:16 +0000
commite9abd65d12a1f5d3f1ddbef26e15c7934d6aae3f (patch)
tree4368b8d65e93db96004a8cff986549edd4220f84 /plugins/org.eclipse.osee.framework.ui.skynet
parentd0e617f8a969cb1c26b52f3b361cdf07ad050c4d (diff)
downloadorg.eclipse.osee-e9abd65d12a1f5d3f1ddbef26e15c7934d6aae3f.tar.gz
org.eclipse.osee-e9abd65d12a1f5d3f1ddbef26e15c7934d6aae3f.tar.xz
org.eclipse.osee-e9abd65d12a1f5d3f1ddbef26e15c7934d6aae3f.zip
refactor: Update AbstractBlam to use OperationLogger for output
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.skynet')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java39
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/ExecuteBlamOperation.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CheckDefaulHierarchy.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CountArtifactsOfTypeBlam.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatabaseHealth.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatastoreStatistics.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/EmailGroupsBlam.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ImageCaptureBlam.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateTxsBranchIdColumn.java8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateUserGroupBlam.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RenameFiles.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetPopulateExample.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetsExampleBlam.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamOutputSection.java44
17 files changed, 48 insertions, 118 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java
index 63cd111b514..eda68725d24 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java
@@ -15,7 +15,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.List;
-import java.util.logging.Level;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -26,10 +25,10 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -48,19 +47,19 @@ import org.xml.sax.SAXException;
* @author Ryan D. Brooks
*/
public abstract class AbstractBlam implements IDynamicWidgetLayoutListener {
- private Appendable output;
public static final String branchXWidgetXml =
"<xWidgets><XWidget xwidgetType=\"XBranchSelectWidget\" displayName=\"Branch\" /></xWidgets>";
public static final String emptyXWidgetsXml = "<xWidgets/>";
protected IOseeDatabaseService databaseService;
+ private OperationLogger logger;
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
throw new OseeStateException(
"either runOperation or createOperation but be overriden by subclesses of AbstractBlam");
}
- public IOperation createOperation(VariableMap variableMap, Appendable appendable) throws Exception {
- return new ExecuteBlamOperation(getName(), appendable, variableMap, this);
+ public IOperation createOperation(VariableMap variableMap, OperationLogger logger) throws Exception {
+ return new ExecuteBlamOperation(this, variableMap, logger);
}
/**
@@ -92,7 +91,6 @@ public abstract class AbstractBlam implements IDynamicWidgetLayoutListener {
contents = Lib.inputStreamToString(inStream);
} catch (IOException ex) {
OseeExceptions.wrapAndThrow(ex);
- contents = "";
}
return contents;
@@ -106,37 +104,18 @@ public abstract class AbstractBlam implements IDynamicWidgetLayoutListener {
return getClass().getSimpleName();
}
- public void setOutput(Appendable output) {
- this.output = output;
- }
-
public void setOseeDatabaseService(IOseeDatabaseService service) {
databaseService = service;
}
- protected Appendable getOutput() {
- return output;
- }
-
- public void print(String value) {
- if (output != null && value != null) {
- try {
- output.append(value);
- } catch (IOException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- public void println(String value) {
- if (Strings.isValid(value)) {
- print(value + "\n");
- }
+ public void report(String... row) {
+ logger.log(row);
}
- public void execute(Appendable appendable, VariableMap variableMap, IJobChangeListener jobChangeListener) {
+ public void execute(OperationLogger logger, VariableMap variableMap, IJobChangeListener jobChangeListener) {
try {
- IOperation blamOperation = createOperation(variableMap, appendable);
+ this.logger = logger;
+ IOperation blamOperation = createOperation(variableMap, logger);
Operations.executeAsJob(blamOperation, true, Job.LONG, jobChangeListener);
} catch (Exception ex) {
OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java
index 2731e3fe3fd..29842c0f745 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java
@@ -91,7 +91,7 @@ public class BlamEditor extends FormEditor implements IDirtiableEditor {
}
public void executeBlam() throws OseeArgumentException {
- getEditorInput().getBlamOperation().execute(overviewPage.getOutput(), getBlamVariableMap(),
+ getEditorInput().getBlamOperation().execute(overviewPage.getReporter(), getBlamVariableMap(),
new BlamEditorExecutionAdapter());
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java
index f702cf892d4..b492164cfc0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.skynet.blam;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.help.ui.OseeHelpContext;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
import org.eclipse.osee.framework.ui.skynet.blam.sections.BlamInputSection;
@@ -122,7 +123,7 @@ public class BlamOverviewPage extends FormPage {
outputSection.setText(text);
}
- public Appendable getOutput() {
+ public OperationLogger getReporter() {
return outputSection.getOutput();
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/ExecuteBlamOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/ExecuteBlamOperation.java
index 30951545696..23c2744214c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/ExecuteBlamOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/ExecuteBlamOperation.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.ui.skynet.blam;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
/**
@@ -20,33 +21,16 @@ import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
public class ExecuteBlamOperation extends AbstractOperation {
private final AbstractBlam blamOperation;
private final VariableMap variableMap;
- private final Appendable output;
- public ExecuteBlamOperation(String name, Appendable output, VariableMap variableMap, AbstractBlam blamOperation) {
- super(name, SkynetGuiPlugin.PLUGIN_ID);
+ public ExecuteBlamOperation(AbstractBlam blamOperation, VariableMap variableMap, OperationLogger logger) {
+ super(blamOperation.getName(), SkynetGuiPlugin.PLUGIN_ID, logger);
this.variableMap = variableMap;
this.blamOperation = blamOperation;
- this.output = output;
}
@Override
protected void doWork(IProgressMonitor monitor) throws Exception {
blamOperation.setOseeDatabaseService(SkynetGuiPlugin.getInstance().getOseeDatabaseService());
- blamOperation.setOutput(output);
- doSubWork(new InternalOperationAdapter(blamOperation), monitor, 1);
- }
-
- private final class InternalOperationAdapter extends AbstractOperation {
- private final AbstractBlam operation;
-
- public InternalOperationAdapter(AbstractBlam operation) {
- super(operation.getName(), SkynetGuiPlugin.PLUGIN_ID);
- this.operation = operation;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- operation.runOperation(variableMap, monitor);
- }
+ blamOperation.runOperation(variableMap, monitor);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CheckDefaulHierarchy.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CheckDefaulHierarchy.java
index 0ff5aaa04b6..074c9a68e69 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CheckDefaulHierarchy.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CheckDefaulHierarchy.java
@@ -41,10 +41,10 @@ public class CheckDefaulHierarchy extends AbstractBlam {
for (Artifact artifact : artifacts) {
try {
if (!artifact.hasParent()) {
- print("\n" + artifact.getGuid() + " has no parent\n");
+ report("\n" + artifact.getGuid() + " has no parent");
}
} catch (MultipleArtifactsExist ex) {
- print("\n" + ex.getLocalizedMessage() + "\n");
+ report("\n" + ex.getLocalizedMessage());
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CountArtifactsOfTypeBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CountArtifactsOfTypeBlam.java
index ed991d07b9a..50b585c7a22 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CountArtifactsOfTypeBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/CountArtifactsOfTypeBlam.java
@@ -55,7 +55,7 @@ public class CountArtifactsOfTypeBlam extends AbstractBlam {
ArtifactQuery.getArtifactCountFromTypeWithInheritence(artType, variableMap.getBranch("Branch"),
DeletionFlag.EXCLUDE_DELETED);
String str = String.format("\nAritfact Count for Type [%s] = %d\n\n", artType, count);
- print(str);
+ report(str);
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatabaseHealth.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatabaseHealth.java
index 8c718b739e1..1f4bd6f8efa 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatabaseHealth.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatabaseHealth.java
@@ -127,7 +127,7 @@ public class DatabaseHealth extends AbstractBlam {
checkForCancelledStatus(monitor);
if (operation != null) {
operation.setFixOperationEnabled(isFix);
- println(String.format("\nProcessing: [%s]", operation.getName()));
+ log(String.format("\nProcessing: [%s]", operation.getName()));
doSubWork(operation, monitor, workPercentage);
String detailedReport = operation.getDetailedReport().toString();
@@ -138,7 +138,7 @@ public class DatabaseHealth extends AbstractBlam {
} else {
ResultsEditor.open(operation.getResultsProvider());
}
- println(String.format("Completed: [%s]", operation.getName()));
+ log(String.format("Completed: [%s]", operation.getName()));
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatastoreStatistics.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatastoreStatistics.java
index 089164bd1bc..3bcd90e9a38 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatastoreStatistics.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/DatastoreStatistics.java
@@ -37,10 +37,7 @@ public class DatastoreStatistics extends AbstractBlam {
try {
chStmt.runPreparedQuery(1000, SELECT_ARTIFACT_COUNTS);
while (chStmt.next()) {
- print(chStmt.getString("name"));
- print(": ");
- print(String.valueOf(chStmt.getInt("total")));
- print("\n");
+ report(chStmt.getString("name") + ": " + chStmt.getInt("total"));
}
} finally {
chStmt.close();
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/EmailGroupsBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/EmailGroupsBlam.java
index 0c53d56525c..7de7bd23a1a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/EmailGroupsBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/EmailGroupsBlam.java
@@ -112,7 +112,7 @@ public class EmailGroupsBlam extends AbstractBlam {
emailTheadPool.shutdown();
emailTheadPool.awaitTermination(100, TimeUnit.MINUTES);
for (Future<String> future : futures) {
- println(future.get());
+ report(future.get());
}
}
@@ -120,7 +120,7 @@ public class EmailGroupsBlam extends AbstractBlam {
private void sendEmailTo(EmailGroupsData data, final User user) throws OseeCoreException {
final String emailAddress = user.getSoleAttributeValue(CoreAttributeTypes.Email, "");
if (!EmailUtil.isEmailValid(emailAddress)) {
- println(String.format("The email address \"%s\" for user %s is not valid.", emailAddress, user.getName()));
+ report(String.format("The email address \"%s\" for user %s is not valid.", emailAddress, user.getName()));
return;
}
final OseeEmail emailMessage = new OseeEmail(emailAddress, data.getSubject(), "", BodyType.Html);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ImageCaptureBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ImageCaptureBlam.java
index b559aecce59..0df8d10504c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ImageCaptureBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ImageCaptureBlam.java
@@ -59,10 +59,10 @@ public class ImageCaptureBlam extends AbstractBlam {
if (event.type == SWT.MouseUp) {
if (topLeftPoint == null) {
topLeftPoint = event.display.getCursorLocation();
- print("\nFirst Mouse Event " + topLeftPoint + "\n");
+ report("\nFirst Mouse Event " + topLeftPoint);
} else {
botRightPoint = event.display.getCursorLocation();
- print("Second Mouse Event " + botRightPoint + "\n");
+ report("Second Mouse Event " + botRightPoint);
GC gc = new GC(Display.getCurrent());
Image image =
new Image(Display.getCurrent(), botRightPoint.x - topLeftPoint.x, botRightPoint.y - topLeftPoint.y);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateTxsBranchIdColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateTxsBranchIdColumn.java
index d88087e59bb..d28fda03bcc 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateTxsBranchIdColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateTxsBranchIdColumn.java
@@ -59,7 +59,7 @@ public class PopulateTxsBranchIdColumn extends AbstractBlam {
tableName);
for (int i = 0; i < 1000000; i += blockSize) {
- println("> " + i + " and < " + (i + blockSize + 1));
+ report("> " + i + " and < " + (i + blockSize + 1));
ConnectionHandler.runPreparedUpdate(sql, i, i + blockSize + 1);
}
}
@@ -77,7 +77,7 @@ public class PopulateTxsBranchIdColumn extends AbstractBlam {
} finally {
chStmt.close();
}
- println("# of transactions: " + branchMap.size());
+ report("# of transactions: " + branchMap.size());
sql = String.format("select transaction_id, branch_id from %s where branch_id is null", tableName);
int counter = 0;
@@ -86,7 +86,7 @@ public class PopulateTxsBranchIdColumn extends AbstractBlam {
while (chStmt.next()) {
Integer branchId = branchMap.get(chStmt.getInt("transaction_id"));
if (branchId == null) {
- println("map not not have branch id for transaction id: " + chStmt.getInt("transaction_id"));
+ report("map not not have branch id for transaction id: " + chStmt.getInt("transaction_id"));
} else {
chStmt.updateObject("branch_id", branchId);
chStmt.updateRow();
@@ -97,6 +97,6 @@ public class PopulateTxsBranchIdColumn extends AbstractBlam {
chStmt.close();
}
- println("Updated " + counter + " rows");
+ report("Updated " + counter + " rows");
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateUserGroupBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateUserGroupBlam.java
index 05182b25578..d6e1875d231 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateUserGroupBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PopulateUserGroupBlam.java
@@ -61,12 +61,12 @@ public class PopulateUserGroupBlam extends AbstractBlam {
User user = emailToUser.get(emailAddress);
count++;
if (user == null) {
- println("User does not exist for: " + emailAddress);
+ report("User does not exist for: " + emailAddress);
} else {
users.add(user);
}
}
- println("addresses: " + count);
+ report("addresses: " + count);
SkynetTransaction transaction = new SkynetTransaction(BranchManager.getCommonBranch(), getName());
for (Artifact group : groups) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java
index 5cef371fa73..5d1d6948423 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java
@@ -99,8 +99,7 @@ public class RelationOrderRepairBlam extends AbstractBlam {
try {
type = RelationTypeManager.getType(typeSide.getFirst());
} catch (OseeTypeDoesNotExist ex) {
- getOutput().append(
- String.format("Type [%s] on artifact [%s] does not exist\n", typeSide.getFirst(), art.getName()));
+ report(String.format("Type [%s] on artifact [%s] does not exist\n", typeSide.getFirst(), art.getName()));
return;
}
RelationSide side = RelationSide.fromString(typeSide.getSecond());
@@ -110,7 +109,7 @@ public class RelationOrderRepairBlam extends AbstractBlam {
List<String> orderList = currentData.getOrderList(type, side);
List<String> actualOrder = Artifacts.toGuids(RelationManager.getRelatedArtifacts(art, type, side));
if (!orderList.equals(actualOrder)) {
- getOutput().append(String.format("Incorrect order on %s (%s %s)\n", art.getName(), type, side));
+ report(String.format("Incorrect order on %s (%s %s)\n", art.getName(), type, side));
currentData.storeFromGuids(type, side, RelationOrderBaseTypes.USER_DEFINED, actualOrder);
art.persist(transaction);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RenameFiles.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RenameFiles.java
index 7c4f50a9c49..c4747d34480 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RenameFiles.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RenameFiles.java
@@ -49,14 +49,14 @@ public class RenameFiles extends AbstractBlam {
if (rule.ruleWasApplicable()) {
File newFile = new File(newName.toString());
if (file.renameTo(newFile)) {
- println(file.getPath() + " became " + newFile.getPath());
+ report(file.getPath() + " became " + newFile.getPath());
renamedFileCount++;
} else {
- println(file.getPath() + " failed to become " + newFile.getPath());
+ report(file.getPath() + " failed to become " + newFile.getPath());
}
}
}
- println("Changed " + renamedFileCount + " files");
+ report("Changed " + renamedFileCount + " files");
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetPopulateExample.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetPopulateExample.java
index 379d81019f6..613ce51db8c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetPopulateExample.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetPopulateExample.java
@@ -36,12 +36,6 @@ public class XWidgetPopulateExample extends AbstractBlam {
@Override
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
// AWorkbench.popup("Execute", "Blam is an example only. Nothing done.");
- print("Test Output Line\n");
- print("Test Output Line\n");
- print("Test Output Line\n");
- print("Test Output Line\n");
- print("Test Output Line\n");
- print("Test Output Line\n");
monitor.done();
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetsExampleBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetsExampleBlam.java
index 9e01e42f697..ab970848811 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetsExampleBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/XWidgetsExampleBlam.java
@@ -30,7 +30,7 @@ public class XWidgetsExampleBlam extends AbstractBlam {
@Override
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
- println("Nothing to do here, this is only an example BLAM");
+ report("Nothing to do here, this is only an example BLAM");
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamOutputSection.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamOutputSection.java
index ee799808b2d..80006b76fb8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamOutputSection.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamOutputSection.java
@@ -12,6 +12,8 @@ package org.eclipse.osee.framework.ui.skynet.blam.sections;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.Widgets;
@@ -31,12 +33,13 @@ import org.eclipse.ui.forms.widgets.Section;
public class BlamOutputSection extends BaseBlamSection {
private Text formText;
- private Appendable appendableOutput;
+ private final OperationLogger OperationLogger;
private final Action executBlamAction;
public BlamOutputSection(FormEditor editor, AbstractBlam abstractBlam, Composite parent, FormToolkit toolkit, int style, Action executBlamAction) {
super(editor, abstractBlam, parent, toolkit, style);
this.executBlamAction = executBlamAction;
+ this.OperationLogger = new InternalReporter();
}
public void simluateRun() {
@@ -100,11 +103,8 @@ public class BlamOutputSection extends BaseBlamSection {
});
}
- public Appendable getOutput() {
- if (appendableOutput == null) {
- appendableOutput = new InternalAppendable();
- }
- return appendableOutput;
+ public OperationLogger getOutput() {
+ return OperationLogger;
}
@Override
@@ -120,34 +120,10 @@ public class BlamOutputSection extends BaseBlamSection {
super.refresh();
}
- private final class InternalAppendable implements Appendable {
-
- private void write(final String text) {
- appendText(text);
- }
-
- @Override
- public Appendable append(CharSequence csq) {
- if (csq == null) {
- write("null");
- } else {
- write(csq.toString());
- }
- return this;
- }
-
- @Override
- public Appendable append(char c) {
- write(new String(new char[] {c}));
- return this;
- }
-
+ private final class InternalReporter extends OperationLogger {
@Override
- public Appendable append(CharSequence csq, int start, int end) {
- CharSequence cs = csq == null ? "null" : csq;
- write(cs.subSequence(start, end).toString());
- return this;
+ public void log(String... row) {
+ appendText(Collections.toString(", ", (Object[]) row) + "\n");
}
-
}
-}
+} \ No newline at end of file

Back to the top