mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Minor improvements
This commit is contained in:
parent
9d12bffc1b
commit
edb9bcb02e
|
@ -23,15 +23,16 @@ import java.net.URL;
|
|||
import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
import org.eclipse.core.resources.*;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.*;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.variables.IStringVariableManager;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.jdt.core.IClasspathEntry;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.progress.IProgressService;
|
||||
import org.teavm.dependency.*;
|
||||
import org.teavm.model.ClassHolderTransformer;
|
||||
import org.teavm.model.InstructionLocation;
|
||||
|
@ -131,6 +132,7 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder {
|
|||
putMarkers(tool.getDependencyViolations());
|
||||
} else if (!tool.wasCancelled()) {
|
||||
setClasses(profile, classesToResources(tool.getClasses()));
|
||||
refreshTarget(tool.getTargetDirectory());
|
||||
}
|
||||
if (!monitor.isCanceled()) {
|
||||
monitor.done();
|
||||
|
@ -140,6 +142,28 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
private void refreshTarget(File targetDirectory) {
|
||||
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IContainer[] targetContainers = workspaceRoot.findContainersForLocationURI(targetDirectory.toURI());
|
||||
for (final IContainer container : targetContainers) {
|
||||
if (container.exists()) {
|
||||
Job job = new Job("Refreshing target directory") {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
container.refreshLocal(IContainer.DEPTH_INFINITE, monitor);
|
||||
} catch (CoreException e) {
|
||||
TeaVMEclipsePlugin.logError(e);
|
||||
return TeaVMEclipsePlugin.makeError(e);
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private RuntimeCopyOperation mapRuntime(TeaVMRuntimeMode runtimeMode) {
|
||||
switch (runtimeMode) {
|
||||
case MERGE:
|
||||
|
|
|
@ -26,10 +26,10 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
|
|||
import org.eclipse.debug.core.model.IValue;
|
||||
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||
import org.eclipse.debug.ui.IValueDetailListener;
|
||||
import org.eclipse.jdt.ui.JavaUI;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.editors.text.EditorsUI;
|
||||
import org.eclipse.ui.IEditorRegistry;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.ide.FileStoreEditorInput;
|
||||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.teavm.debugging.CallFrame;
|
||||
|
@ -47,10 +47,19 @@ import org.teavm.model.ValueType;
|
|||
public class TeaVMDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
|
||||
@Override
|
||||
public String getEditorId(IEditorInput input, Object element) {
|
||||
if (element instanceof IFile || element instanceof ILineBreakpoint || element instanceof IStorage) {
|
||||
return JavaUI.ID_CU_EDITOR;
|
||||
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
|
||||
if (element instanceof IFile) {
|
||||
IFile file = (IFile)element;
|
||||
return registry.getDefaultEditor(file.getName()).getId();
|
||||
} else if (element instanceof ILineBreakpoint) {
|
||||
String fileName = ((ILineBreakpoint)element).getMarker().getResource().getName();
|
||||
return registry.getDefaultEditor(fileName).getId();
|
||||
} else if (element instanceof IStorage) {
|
||||
IStorage storage = (IStorage)element;
|
||||
return registry.getDefaultEditor(storage.getName()).getId();
|
||||
} else if (element instanceof URL) {
|
||||
return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
|
||||
URL url = (URL)element;
|
||||
return registry.getDefaultEditor(url.getFile()).getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
<teavm.version>0.2-SNAPSHOT</teavm.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
Loading…
Reference in New Issue
Block a user