Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Bio7/Bio7
Browse files Browse the repository at this point in the history
  • Loading branch information
bio7 authored and bio7 committed Dec 20, 2017
2 parents 4e4dea8 + 4d9dfbe commit 8db3b1b
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 29 deletions.
3 changes: 1 addition & 2 deletions com.eco.bio7.javaedit/build.properties
Expand Up @@ -11,10 +11,9 @@ bin.includes = plugin.xml,\
.classpath,\
com/,\
epl-v10.html,\
libs/,\
.,\
icons/,\
libs/commons-compiler-3.0.7.jar
libs/
src.includes = .classpath,\
META-INF/,\
about.html,\
Expand Down
4 changes: 1 addition & 3 deletions com.eco.bio7.markdownedit/build.properties
Expand Up @@ -9,6 +9,4 @@ bin.includes = plugin.xml,\
build.properties,\
.settings/,\
.classpath,\
libs/,\
libs/flexmark-all-0.28.6-lib.jar,\
libs/autolink-0.7.0.jar
libs/
2 changes: 1 addition & 1 deletion com.eco.bio7/plugin.xml
Expand Up @@ -531,7 +531,7 @@
<keyBinding
commandId="com.eco.bio7.save_r_workspace2"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="CTRL+ALT+SHIFT+O">
keySequence="CTRL+ALT+K">
</keyBinding>
<command
description="Open the R preferences"
Expand Down
3 changes: 3 additions & 0 deletions com.eco.bio7/src/com/eco/bio7/preferences/RServePrefs.java
Expand Up @@ -121,6 +121,9 @@ public void widgetSelected(final SelectionEvent e) {

addField(new StringFieldEditor("RSHELL_ACTIVATION_CHARS", "Activation chars (Restart to apply!)", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()));
addField(new StringFieldEditor("RSHELL_SEPERATOR_CHARS", "Seperator chars", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()));
addField(new RadioGroupFieldEditor("RSHELL_CODE_COMPLETION_ACTIVATOR_ALTERED", "Use a different key combination for code completion activation", 3, new String[][]{{"Strg+Space", "STRG"}, {"Alt+Space", "ALT"},{"Cmd+Space", "CMD"}}, getFieldEditorParent(), false));
//addField(new BooleanFieldEditor("RSHELL_CODE_COMPLETION_ACTIVATOR_ALTERED", "Use Key Combination 'ALT+SPACE' to trigger code completion (Restart to apply!)", getFieldEditorParent()));

{
LabelFieldEditor labelFieldEditor = new LabelFieldEditor("Close and reopen R-Shell view or restart necessary:", getFieldEditorParent());
labelFieldEditor.setLabelText("Code Completion Popup");
Expand Down
46 changes: 27 additions & 19 deletions com.eco.bio7/src/com/eco/bio7/rbridge/RShellView.java
Expand Up @@ -425,7 +425,7 @@ public void keyPressed(KeyEvent e) {

if (ApplicationWorkbenchWindowAdvisor.getOS().equals("Mac")) {

if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.ALT) == SWT.ALT && (e.keyCode == 'r')) {
if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.stateMask & SWT.ALT) == SWT.ALT && (e.keyCode == 'r')) {

/*
* Add code completion to textfield! At startup load the default R proposals and
Expand All @@ -434,7 +434,7 @@ public void keyPressed(KeyEvent e) {
*/
if (RServe.isAliveDialog()) {
shellCompletion.update();
System.out.println("Reloaded code completion!");
System.out.println("\nReloaded code completion!");

}

Expand All @@ -445,7 +445,6 @@ public void keyPressed(KeyEvent e) {
*/
IDocument doc = new Document();
new OpenFileCreateSourceTemplate(doc, 0, doc.getLength());
String t = text.getText();
// String a = t.substring(0, text.getCaretPosition());
// String b = t.substring(text.getCaretPosition(), t.length());
text.insert(doc.get());
Expand All @@ -456,20 +455,18 @@ else if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.SHIF
IDocument doc = new Document();
new SaveFileCreateSourceTemplate(doc, 0, doc.getLength());
text.insert(doc.get());
} else if (((e.stateMask & SWT.ALT) == SWT.ALT) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == '-')) {
String t = text.getText();
} else if ((((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.ALT) == SWT.ALT) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == 'b')) {
// String a = t.substring(0, text.getCaretPosition());
// String b = t.substring(text.getCaretPosition(), t.length());
// text.setText(a + "<-" + b);
text.insert("<");
text.insert("-");
} else if (((e.stateMask & SWT.ALT) == SWT.ALT) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == 'n')) {
String t = text.getText();
} else if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && ((e.stateMask & SWT.ALT) == SWT.ALT) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == 'n')) {
// String a = t.substring(0, text.getCaretPosition());
// String b = t.substring(text.getCaretPosition(), t.length());
// text.setText(a + "<-" + b);
text.insert(" %>% ");
} else if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == 'i')) {
} else if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.stateMask & SWT.ALT) == SWT.ALT && (e.keyCode == 'i')) {
setTextInREditor();
}

Expand All @@ -494,7 +491,6 @@ else if (((e.stateMask & SWT.COMMAND) == SWT.COMMAND) && (e.stateMask & SWT.SHIF
*/
IDocument doc = new Document();
new OpenFileCreateSourceTemplate(doc, 0, doc.getLength());
String t = text.getText();
// a = t.substring(0, text.getCaretPosition());
// String b = t.substring(text.getCaretPosition(), t.length());
text.insert(doc.get());
Expand All @@ -506,14 +502,12 @@ else if (((e.stateMask & SWT.CTRL) == SWT.CTRL) && (e.stateMask & SWT.SHIFT) ==
new SaveFileCreateSourceTemplate(doc, 0, doc.getLength());
text.insert(doc.get());
} else if (((e.stateMask & SWT.ALT) == SWT.ALT) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == '-')) {
String t = text.getText();
// String a = t.substring(0, text.getCaretPosition());
// String b = t.substring(text.getCaretPosition(), t.length());
// text.setText(a + "<-" + b);
text.insert("<-");

} else if (((e.stateMask & SWT.ALT) == SWT.ALT) && (e.stateMask & SWT.SHIFT) == SWT.SHIFT && (e.keyCode == 'n')) {
String t = text.getText();
// String a = t.substring(0, text.getCaretPosition());
// String b = t.substring(text.getCaretPosition(), t.length());
// text.setText(a + "<-" + b);
Expand Down Expand Up @@ -1231,17 +1225,31 @@ public void widgetSelected(final SelectionEvent e) {
public void widgetSelected(final SelectionEvent e) {
ToolTip infoTip = new ToolTip(new Shell(), SWT.BALLOON | SWT.ICON_INFORMATION);
infoTip.setText("Info!");

infoTip.setMessage("Expression textfield:" + "_________________________________\n" + "STRG + SPACE = Open code completion!\n"+ "ESC = Close code completion!\n"+ "UP ARROW = Open history!\n"
+ "STRG(CMD) + SHIFT + I = Transfer history to opened R editor!\n" + "STRG(CMD) + ALT + R = Refresh code completion!\n" + "STRG(CMD) + SHIFT + ALT + O = Open file and create load file template!\n"
+ "STRG(CMD) + SHIFT + ALT + S = Save file and create save file template!\n" + "SHIFT + ALT + - = Create assign operator ('<-')!\n"
+ "SHIFT + ALT + N = Create pipe operator ('%>%')!\n" + "Key + Mouse Click (before bracket) - select matching brackets!\n\n" + "Objects panel (left):"
+ "_________________________________\n" + "Selection + 'C' key = Concatenate selected variables in Expression textfield!\n"
+ "Selection + 'A' key = Comma seperate selected variables in Expression textfield!\n" + "Right-Click = Menu\n"
+ "Select variable(s) = To show, summarize, plot, transfer and convert data!\n\n" + "Tabs templates:" + "_________________________________\n"
if (ApplicationWorkbenchWindowAdvisor.getOS().equals("Mac")) {
infoTip.setMessage("Expression textfield:\n\n" + "STRG + SPACE (Change in pref.!) = Open code completion!\n" + "ESC = Close code completion!\n"
+ "UP ARROW = Open history!\n" + "CMD + ALT + SHIFT + I = Transfer history to opened R editor!\n" + "CMD + ALT + SHIFT + R = Refresh code completion!\n"
+ "CMD + ALT + SHIFT + O = Open file and create load file template!\n" + "CMD + ALT + SHIFT + S = Save file and create save file template!\n"
+ "CMD + ALT + SHIFT + B = Create assign operator ('<-')!\n" + "CMD + ALT + SHIFT + N = Create pipe operator ('%>%')!\n"
+ "Key + Mouse Click (before bracket) - select matching brackets!\n\n" + "Objects panel (left):\n\n"
+ "Selection + 'C' key = Concatenate selected variables in Expression textfield!\n" + "Selection + 'A' key = Comma seperate selected variables in Expression textfield!\n"
+ "Right-Click = Menu\n" + "Select variable(s) = To show, summarize, plot, transfer and convert data!\n\n" + "Tabs templates:\n\n"
+ "Double-Click = Add template to the R-Shell textfield!\n" + "Double-Right-Click = Add template to the R editor!\n"

);

}
else {
infoTip.setMessage("Expression textfield:\n\n" + "STRG + SPACE (Change in pref.!) = Open code completion!\n" + "ESC = Close code completion!\n"
+ "UP ARROW = Open history!\n" + "STRG + SHIFT + I = Transfer history to opened R editor!\n" + "STRG + ALT + R = Refresh code completion!\n"
+ "STRG + SHIFT + ALT + O = Open file and create load file template!\n" + "STRG + SHIFT + ALT + S = Save file and create save file template!\n"
+ "SHIFT + ALT + - = Create assign operator ('<-')!\n" + "SHIFT + ALT + N = Create pipe operator ('%>%')!\n"
+ "Key + Mouse Click (before bracket) - select matching brackets!\n\n" + "Objects panel (left):\n\n"
+ "Selection + 'C' key = Concatenate selected variables in Expression textfield!\n" + "Selection + 'A' key = Comma seperate selected variables in Expression textfield!\n"
+ "Right-Click = Menu\n" + "Select variable(s) = To show, summarize, plot, transfer and convert data!\n\n" + "Tabs templates:\n\n"
+ "Double-Click = Add template to the R-Shell textfield!\n" + "Double-Right-Click = Add template to the R editor!\n"

);
}
infoTip.setVisible(true);

}
Expand Down
Expand Up @@ -50,7 +50,7 @@ public IStatus runInWorkspace(IProgressMonitor monitor) {
/* If a location is given! */

// destdir = destdir.replace("\\", "\\\\");

/*Here we update the packages but exclude Rserve!*/
String out = null;
try {
out = c.eval(".pkgListToUpdate <- installed.packages(priority='NA')[,'Package'];" + ".pkgListToUpdate<-.pkgListToUpdate[-which(.pkgListToUpdate==\"Rserve\",arr.ind =TRUE)];"
Expand Down
Expand Up @@ -99,15 +99,28 @@ static char[] getAutoactivationChars() {
String allChars = LCL;
return allChars.toCharArray();
}


static KeyStroke getActivationKeystroke() {
KeyStroke instance = KeyStroke.getInstance(new Integer(SWT.CTRL).intValue(), new Integer(' ').intValue());
IPreferenceStore storeLocal = Bio7Plugin.getDefault().getPreferenceStore();
KeyStroke instance;
String useAlt = storeLocal.getString("RSHELL_CODE_COMPLETION_ACTIVATOR_ALTERED");
if (useAlt.equals("CMD")) {
instance = KeyStroke.getInstance(new Integer(SWT.COMMAND).intValue(), new Integer(' ').intValue());
}

else if (useAlt.equals("ALT")) {
instance = KeyStroke.getInstance(new Integer(SWT.ALT).intValue(), new Integer(' ').intValue());
}

else {
instance = KeyStroke.getInstance(new Integer(SWT.CTRL).intValue(), new Integer(' ').intValue());
}

return instance;
}

public ShellCompletion(RShellView view, Text control, final IControlContentAdapter controlContentAdapter) {
//IPreferenceStore store = Bio7Plugin.getDefault().getPreferenceStore();
// IPreferenceStore store = Bio7Plugin.getDefault().getPreferenceStore();
this.view = view;
this.control = control;
contentProposalProvider = new ContentProposalProvider();
Expand Down
Expand Up @@ -638,6 +638,7 @@ public void perspectiveSavedAs(IWorkbenchPage page, IPerspectiveDescriptor oldPe
store.setDefault("RSHELL_SEPERATOR_CHARS", ";(,[=-+ ");
store.setDefault("CODE_COMPLETION_POPUP_SIZE_X",600);
store.setDefault("CODE_COMPLETION_POPUP_SIZE_Y",400);
store.setDefault("RSHELL_CODE_COMPLETION_ACTIVATOR_ALTERED","STRG");

store.setDefault("LATEX_CLEAN_FILES", false);

Expand Down

0 comments on commit 8db3b1b

Please sign in to comment.