Skip to content

Commit

Permalink
Added more shortcuts for all editors! Improved CSS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bio7 committed Feb 16, 2017
1 parent 947528f commit c70a4f9
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 91 deletions.
1 change: 1 addition & 0 deletions com.eco.bio7.themes_/css/dark/e4-dark_globalstyle.css
Expand Up @@ -434,3 +434,4 @@ ProgressIndicator#org-eclipse-ui-splash-progressIndicator {




44 changes: 44 additions & 0 deletions com.eco.bio7.themes_/css/e4-dark_win.css
Expand Up @@ -298,6 +298,7 @@ StatusLine, ImageBasedFrame{

Grid {
background-color: #2F2F2F ;
color: #AAAAAA;
flat-scroll-bar: true;
flat-scroll-bar-thumb: #a6a6a6;
flat-scroll-bar-page-increment: #f0f0f0;
Expand All @@ -315,5 +316,48 @@ ExpandBar {
color: #dddddd;
}

/* Label #com-eco-bio7-imagej {
background-color: #9c9696;
color: #000000; see property startupForegroundColor in the product
} */

Composite #com-eco-bio7-imagej {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}

#com-eco-bio7-imagej Label {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}

Composite #org-eclipse-ui-console-ConsoleView.MToolBar {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}

#org-eclipse-ui-console-ConsoleView.MToolBar Label {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}

Composite #com.eco.bio7.rbridge.RTable {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}

#com.eco.bio7.rbridge.RTable Label {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}


Composite #com.eco.bio7.thumbnails {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}

#com.eco.bio7.thumbnails Label {
background-color: #252525;
color: #dddddd; /* see property startupForegroundColor in the product */
}
2 changes: 1 addition & 1 deletion com.eco.bio7.util/src/com/eco/bio7/util/Util.java
Expand Up @@ -113,7 +113,7 @@ public boolean accept(File dir, String name) {
* @param path
* @return
*/
public String fileToString(String path) {// this function returns the
public static String fileToString(String path) {// this function returns the
// File as a String
FileInputStream fileinput = null;
try {
Expand Down
3 changes: 2 additions & 1 deletion com.eco.bio7/META-INF/MANIFEST.MF
Expand Up @@ -222,7 +222,8 @@ Require-Bundle: org.eclipse.ui,
com.eco.bio7.imagej2;bundle-version="1.0.0",
org.eclipse.nebula.widgets.grid;bundle-version="1.0.0",
com.eco.bio7.markdownedit;bundle-version="1.0.0",
org.eclipse.jface
org.eclipse.jface,
net.sourceforge.texlipse
Eclipse-LazyStart: true
Bundle-ClassPath:
bin/,
Expand Down
37 changes: 37 additions & 0 deletions com.eco.bio7/plugin.xml
Expand Up @@ -408,11 +408,22 @@
id="com.eco.bio7.compilejavaaction"
name="Compile Java">
</command>
<keyBinding
commandId="com.eco.bio7.compilejavaaction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+J">
</keyBinding>

<command
description="Execute a Bio7 Flow"
id="com.eco.bio7.executeflowaction"
name="Flow Action">
</command>
<keyBinding
commandId="com.eco.bio7.executeflowaction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+F">
</keyBinding>
<command
description="Debug a Bio7 Flow"
id="com.eco.bio7.debugflowaction"
Expand All @@ -423,21 +434,42 @@
id="com.eco.bio7.interpretgroovybeanshellaction"
name="Interpret Groovy/BeanShell Action">
</command>
<keyBinding
commandId="com.eco.bio7.interpretgroovybeanshellaction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+G">
</keyBinding>
<command
description="Interpret Python"
id="com.eco.bio7.interpretpythonaction"
name="Interpret Python Action">
</command>

<keyBinding
commandId="com.eco.bio7.interpretpythonaction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+P">
</keyBinding>
<command
description="Interpret Knitr"
id="com.eco.bio7.browser.knitrAction"
name="Knitr Action">
</command>
<keyBinding
commandId="com.eco.bio7.browser.knitrAction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+K">
</keyBinding>
<command
description="Interpret Markdown"
id="com.eco.bio7.RMarkdownAction"
name="Markdown Action">
</command>
<keyBinding
commandId="com.eco.bio7.RMarkdownAction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+M">
</keyBinding>
<command
description="Clear the R workspace"
id="com.eco.bio7.clear_r_workspace"
Expand Down Expand Up @@ -503,6 +535,11 @@
id="com.eco.bio7.interpretjavascriptaction"
name="Interpret JavaScript Action">
</command>
<keyBinding
commandId="com.eco.bio7.interpretjavascriptaction"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+S">
</keyBinding>
</extension>
<extension
id="product"
Expand Down
9 changes: 6 additions & 3 deletions com.eco.bio7/src/com/eco/bio7/actions/Compile.java
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocument;
Expand All @@ -24,10 +25,7 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.texteditor.ITextEditor;

import com.eco.bio7.compile.CompileClassAndMultipleClasses;
import com.eco.bio7.compile.CompilerMessages;
import com.eco.bio7.compile.JavaCompileWorkspaceJob;
Expand Down Expand Up @@ -60,11 +58,16 @@ public void run() {
IPreferenceStore store = Bio7EditorPlugin.getDefault().getPreferenceStore();
classbody = store.getBoolean("classbody");
IEditorPart editor = (IEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if(editor==null||editor instanceof CompilationUnitEditor==false){
return;
}
pag = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDocument doc = ((ITextEditor) editor).getDocumentProvider().getDocument(editor.getEditorInput());
resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);

IEditorInput editorInput = editor.getEditorInput();



if (editorInput instanceof IFileEditorInput) {
ifile = ((IFileEditorInput) editorInput).getFile();
Expand Down
15 changes: 7 additions & 8 deletions com.eco.bio7/src/com/eco/bio7/actions/Interpret.java
Expand Up @@ -15,34 +15,34 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;

import com.eco.bio7.discrete.Quad2d;
import com.eco.bio7.editors.BeanshellEditor;
import com.eco.bio7.rcp.StartBio7Utils;

public class Interpret extends Action {

private IFile file;
public Interpret(String text){

public Interpret(String text) {
super(text);
setId("com.eco.bio7.interpretgroovybeanshell");
setActionDefinitionId("com.eco.bio7.interpretgroovybeanshellaction");

}


public void run() {
StartBio7Utils utils = StartBio7Utils.getConsoleInstance();
if (utils != null) {
utils.cons.clear();
}
IEditorPart editor = (IEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor == null || editor instanceof BeanshellEditor == false) {
return;
}
IDocument doc = ((ITextEditor) editor).getDocumentProvider().getDocument(editor.getEditorInput());
if (editor.getEditorInput() instanceof IFileEditorInput) {

Expand All @@ -62,7 +62,6 @@ public void run() {
} else if (file.getFileExtension().equals("js")) {

String a = doc.get();


}

Expand Down
67 changes: 24 additions & 43 deletions com.eco.bio7/src/com/eco/bio7/actions/InterpretPython.java
Expand Up @@ -24,6 +24,7 @@
import com.eco.bio7.batch.Bio7Dialog;
import com.eco.bio7.compile.PythonInterpreter;
import com.eco.bio7.console.ConsolePageParticipant;
import com.eco.bio7.editors.python.PythonEditor;
import com.eco.bio7.rcp.StartBio7Utils;

public class InterpretPython extends Action {
Expand All @@ -46,10 +47,11 @@ public void run() {
utils.cons.clear();
}

IEditorPart editor = (IEditorPart) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IDocument doc = ((ITextEditor) editor).getDocumentProvider()
.getDocument(editor.getEditorInput());
IEditorPart editor = (IEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor == null || editor instanceof PythonEditor == false) {
return;
}
IDocument doc = ((ITextEditor) editor).getDocumentProvider().getDocument(editor.getEditorInput());
if (editor.getEditorInput() instanceof IFileEditorInput) {

file = ((IFileEditorInput) editor.getEditorInput()).getFile();
Expand All @@ -58,15 +60,13 @@ public void run() {
if (file.getFileExtension().equals("py")) {

String a = doc.get();
IPreferenceStore store = Bio7Plugin.getDefault()
.getPreferenceStore();
IPreferenceStore store = Bio7Plugin.getDefault().getPreferenceStore();
boolean cPython = store.getBoolean("python_pipe");
String sel = store.getString("python_select");
String blenderSel = store.getString("blender_options");

if (cPython == true) {
String selectionConsole = ConsolePageParticipant
.getInterpreterSelection();
String selectionConsole = ConsolePageParticipant.getInterpreterSelection();

if (editor.isDirty()) {
editor.doSave(new NullProgressMonitor());
Expand All @@ -82,20 +82,17 @@ public void run() {
if (sel.equals("Python")) {
if (selectionConsole.equals("Python")) {
boolean python3x = store.getBoolean("python_3x");
if(python3x==false){
ConsolePageParticipant.pipeInputToConsole("execfile('"
+ loc + "')", true, true);
ConsolePageParticipant.pipeInputToConsole("", true, true);
}
else{

ConsolePageParticipant.pipeInputToConsole(
if (python3x == false) {
ConsolePageParticipant.pipeInputToConsole("execfile('" + loc + "')", true, true);
ConsolePageParticipant.pipeInputToConsole("", true, true);
} else {

ConsolePageParticipant.pipeInputToConsole(

"exec(compile(open('" + loc + "').read(),'"+ loc + "', 'exec'))", true, true);
"exec(compile(open('" + loc + "').read(),'" + loc + "', 'exec'))", true, true);
}
} else {
Bio7Dialog
.message("Please start the \"Native Python\" Shell in the Bio7 console!");
Bio7Dialog.message("Please start the \"Native Python\" Shell in the Bio7 console!");
}
}

Expand All @@ -105,37 +102,21 @@ else if (sel.equals("Blender")) {
String blenderArgs = store.getString("blender_args");
if (blenderSel.equals("pscript")) {

ConsolePageParticipant.pipeInputToConsole("\""
+ path + "/blender\"" + " " + blenderArgs
+ " -P " + loc, true, true);
ConsolePageParticipant.pipeInputToConsole("\"" + path + "/blender\"" + " " + blenderArgs + " -P " + loc, true, true);
} else if (blenderSel.equals("interactive")) {
if (isBlender == false) {
ConsolePageParticipant.pipeInputToConsole("\""
+ path + "/blender\"" + " "
+ blenderArgs + " --python-console",
true, true);
ConsolePageParticipant.pipeInputToConsole("\"" + path + "/blender\"" + " " + blenderArgs + " --python-console", true, true);
isBlender = true;
}
ConsolePageParticipant.pipeInputToConsole(
store.getString("before_script_blender"),
true, true);
ConsolePageParticipant.pipeInputToConsole(
"exec(compile(open('" + loc + "').read(),'"
+ loc + "', 'exec'))", true, true);
ConsolePageParticipant.pipeInputToConsole(
store.getString("after_script_blender"),
true, true);
System.out
.println("Please restart the Bio7 native console for a new interactive session if you have closed Blender!");
ConsolePageParticipant.pipeInputToConsole(store.getString("before_script_blender"), true, true);
ConsolePageParticipant.pipeInputToConsole("exec(compile(open('" + loc + "').read(),'" + loc + "', 'exec'))", true, true);
ConsolePageParticipant.pipeInputToConsole(store.getString("after_script_blender"), true, true);
System.out.println("Please restart the Bio7 native console for a new interactive session if you have closed Blender!");
} else {
ConsolePageParticipant.pipeInputToConsole("\""
+ path + "/blender\"" + " " + blenderArgs,
true, true);
ConsolePageParticipant.pipeInputToConsole("\"" + path + "/blender\"" + " " + blenderArgs, true, true);
}
} else {
Bio7Dialog
.message("Please start the Shell in the Bio7 Console\n"
+ "to interpret the Python script in Blender!");
Bio7Dialog.message("Please start the Shell in the Bio7 Console\n" + "to interpret the Python script in Blender!");
}
}

Expand Down
Expand Up @@ -44,6 +44,9 @@ public void run() {
utils.cons.clear();
}
IEditorPart editor = (IEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor == null) {
return;
}
IDocument doc = ((ITextEditor) editor).getDocumentProvider().getDocument(editor.getEditorInput());
if (editor.getEditorInput() instanceof IFileEditorInput) {

Expand Down

0 comments on commit c70a4f9

Please sign in to comment.