Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'LangEclipseIDE/master'
Browse files Browse the repository at this point in the history
Conflicts:
	plugin_ide.ui/src/LANG_PROJECT_ID/ide/ui/actions/LANGUAGE_OracleOpenDefinitionOperation.java
  • Loading branch information
bruno-medeiros committed Oct 27, 2015
2 parents 305bf1e + 579d45d commit 74fbd31
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
Expand Down Expand Up @@ -81,7 +82,19 @@ protected static void disableAutoBuild() {

@BeforeClass
public static void setUpExceptionListenerStatic() throws Exception {
logErrorListener = ErrorLogListener.createAndInstall();
logErrorListener = new ErrorLogListener(true) {
@Override
public void handleErrorStatus(IStatus status, String plugin) {
String msg = status.getMessage();

// Ignore error about early start of debug plugin
if(msg != null && msg.startsWith(EclipseUtils.MSG__ERROR_TRYING_TO_START_PLUGIN)) {
return;
}

super.handleErrorStatus(status, plugin);
}
};
}

@AfterClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,36 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;

public final class ErrorLogListener implements ILogListener {
public class ErrorLogListener implements ILogListener {

public ErrorLogListener(boolean register) {
if(register) {
Platform.addLogListener(this);
}
}

protected boolean errorOccurred = false;
protected IStatus status;

public static ErrorLogListener createAndInstall() {
ErrorLogListener loglistener = new ErrorLogListener() ;
Platform.addLogListener(loglistener);
return loglistener;
return new ErrorLogListener(true);
}

@Override
public synchronized void logging(IStatus status, String plugin) {
if(status.getSeverity() == IStatus.ERROR && errorOccurred == false) {
errorOccurred = true;
this.status = status;

System.out.println("!!!>>>>>>>>> Logged error from: " + plugin);
System.out.println(status);
handleErrorStatus(status, plugin);
}
}

public void handleErrorStatus(IStatus status, String plugin) {
errorOccurred = true;
this.status = status;

System.out.println("!!!>>>>>>>>> Logged error from: " + plugin);
System.out.println(status);
}

public synchronized void checkErrors() throws Throwable {
if(errorOccurred == true) {
reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

public class EclipseUtils {

public static final String MSG__ERROR_TRYING_TO_START_PLUGIN = "Error trying to start plugin: ";

public static IWorkspaceRoot getWorkspaceRoot() {
return ResourcesPlugin.getWorkspace().getRoot();
}
Expand All @@ -49,14 +51,13 @@ public static void startOtherPlugin(String pluginId) {
try {
Bundle debugPlugin = Platform.getBundle(pluginId);
if(debugPlugin == null) {
LangCore.logError("Error trying to start plugin `" + pluginId + "`: plugin not found.");
return;
throw new BundleException("Plugin not found");
}
if(debugPlugin.getState() != Bundle.STARTING) {
debugPlugin.start(Bundle.START_TRANSIENT);
}
} catch (BundleException e) {
LangCore.logError("Error trying to start plugin: " + pluginId, e);
LangCore.logError(MSG__ERROR_TRYING_TO_START_PLUGIN + pluginId, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ public abstract class AbstractOpenElementOperation extends AbstractEditorOperati

protected String statusErrorMessage;

/**
* @param dummy
*/
public AbstractOpenElementOperation(String operationName, ITextEditor editor, SourceRange range,
OpenNewEditorMode openEditorMode, Void dummy) {
OpenNewEditorMode openEditorMode) {
super(operationName, editor);

this.source = doc.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class GoOracleOpenDefinitionOperation extends AbstractOpenElementOperatio
public static final String OPEN_DEFINITION_OpName = "Open definition (go oracle)";

public GoOracleOpenDefinitionOperation(ITextEditor editor, SourceRange range, OpenNewEditorMode openEditorMode) {
super(OPEN_DEFINITION_OpName, editor, range, openEditorMode, null);
super(OPEN_DEFINITION_OpName, editor, range, openEditorMode);
}

@Override
Expand Down

0 comments on commit 74fbd31

Please sign in to comment.