From 2c50460de1b1d6d5d9e6d6d79ed97d48abd4adf0 Mon Sep 17 00:00:00 2001 From: Amine Lajmi Date: Sun, 12 Feb 2017 02:06:27 +0100 Subject: [PATCH] quick fixes, adjusted action sets, logging level --- .../META-INF/MANIFEST.MF | 8 +- .../META-INF/MANIFEST.MF | 3 +- .../dslforge/styledtext/jface/TextViewer.java | 99 +++++++------------ .../META-INF/MANIFEST.MF | 2 + plugins/org.dslforge.texteditor/plugin.xml | 20 +--- plugins/org.dslforge.workspace.ui/plugin.xml | 80 +++++++++++---- .../workspace/ui/actions/NewFolderAction.java | 3 +- .../ui/actions/OpenResourceAction.java | 1 - .../dslforge/workspace/WorkspaceManager.java | 2 +- .../META-INF/MANIFEST.MF | 5 +- plugins/org.dslforge.xtext.common/plugin.xml | 3 +- .../XtextContentAssistEnabledEditor.java | 12 +-- 12 files changed, 124 insertions(+), 114 deletions(-) diff --git a/examples/org.codingpark.piraterobot.play.web/META-INF/MANIFEST.MF b/examples/org.codingpark.piraterobot.play.web/META-INF/MANIFEST.MF index deafa89..d776794 100644 --- a/examples/org.codingpark.piraterobot.play.web/META-INF/MANIFEST.MF +++ b/examples/org.codingpark.piraterobot.play.web/META-INF/MANIFEST.MF @@ -19,6 +19,12 @@ Require-Bundle: org.eclipse.rap.ui, org.dslforge.xtext.common, org.dslforge.texteditor, org.dslforge.styledtext, - org.codingpark.piraterobot.play + org.codingpark.piraterobot.play, + org.eclipse.rap.ui.forms, + org.codingpark.piraterobot.widget Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.codingpark.piraterobot.play.web.contentassist, + org.codingpark.piraterobot.play.web.editor, + org.codingpark.piraterobot.play.web.editor.widget, + org.codingpark.piraterobot.play.web.module diff --git a/plugins/org.dslforge.styledtext/META-INF/MANIFEST.MF b/plugins/org.dslforge.styledtext/META-INF/MANIFEST.MF index 4cb01bd..7051574 100644 --- a/plugins/org.dslforge.styledtext/META-INF/MANIFEST.MF +++ b/plugins/org.dslforge.styledtext/META-INF/MANIFEST.MF @@ -11,4 +11,5 @@ Bundle-ActivationPolicy: lazy Export-Package: org.dslforge.styledtext, org.dslforge.styledtext.jface Bundle-ClassPath: . -Import-Package: org.apache.log4j +Import-Package: org.apache.log4j, + org.eclipse.ui.forms.widgets diff --git a/plugins/org.dslforge.styledtext/src/org/dslforge/styledtext/jface/TextViewer.java b/plugins/org.dslforge.styledtext/src/org/dslforge/styledtext/jface/TextViewer.java index f744138..a2b6c56 100644 --- a/plugins/org.dslforge.styledtext/src/org/dslforge/styledtext/jface/TextViewer.java +++ b/plugins/org.dslforge.styledtext/src/org/dslforge/styledtext/jface/TextViewer.java @@ -17,52 +17,37 @@ public class TextViewer extends Viewer implements ITextViewer{ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = -5997421207828153511L; + private BasicText fTextWidget; private IDocument fDocument; private Control fDisposedControl; - - protected TextViewer() { - super(); - } - + /** - * Create a new text viewer with the given SWT style bits. - * - * @param parent the parent of the viewer's control - * @param styles the SWT style bits for the viewer's control + * Create a new text viewer with the given style bits. */ public TextViewer(Composite parent, int styles) { createControl(parent, styles); } /** - * Create a new text viewer based on the text widget given as input - * - * @param textWidget the available text widget + * Create a new text viewer with the given style bits. */ - public TextViewer(BasicText textWidget) { + public TextViewer(BasicText textWidget, Composite parent, int styles) { fTextWidget = textWidget; - configureTextWidget(textWidget.getParent()); + configure(); } /** - * Creates the viewer's SWT control. The viewer's text widget either is + * Creates the viewer's control. The viewer's text widget either is * the control or is a child of the control. - * - * @param parent the parent of the viewer's control - * @param styles the SWT style bits for the viewer's control */ protected void createControl(Composite parent, int styles) { - fTextWidget= createTextWidget(parent, styles); - configureTextWidget(parent); + fTextWidget = createTextWidget(parent, styles); + configure(); } - /** - * Configures the editor's text widget - */ - @SuppressWarnings("serial") - private void configureTextWidget(Composite parent) { + private void configure() { GridData textLayoutData = new GridData(); textLayoutData.horizontalAlignment = SWT.FILL; textLayoutData.verticalAlignment = SWT.FILL; @@ -70,23 +55,22 @@ private void configureTextWidget(Composite parent) { textLayoutData.grabExcessVerticalSpace = true; fTextWidget.setLayoutData(textLayoutData); - fTextWidget.addDisposeListener( - new DisposeListener() { - public void widgetDisposed(DisposeEvent e) { - fDisposedControl= getControl(); - handleDispose(); - } - } - ); - - fTextWidget.setFont(parent.getFont()); - fTextWidget.addTraverseListener(new TraverseListener() { + private static final long serialVersionUID = 1L; + public void keyTraversed(TraverseEvent e) { if ((SWT.SHIFT == e.stateMask) && ('\t' == e.character)) e.doit= !fTextWidget.getEditable(); } }); + fTextWidget.addDisposeListener(new DisposeListener() { + private static final long serialVersionUID = 1L; + + public void widgetDisposed(DisposeEvent e) { + fDisposedControl = getControl(); + handleDispose(); + } + }); } /** @@ -97,28 +81,16 @@ public void keyTraversed(TraverseEvent e) { * @return the text widget to be used */ protected BasicText createTextWidget(Composite parent, int styles) { - BasicText textWidget= new BasicText(parent, styles); - return textWidget; + BasicText styledText= new BasicText(parent, styles); + return styledText; } - - /** - * @see Viewer#getControl() - */ + + @Override public Control getControl() { return fTextWidget != null ? fTextWidget : fDisposedControl; } - - /** - * Frees all resources allocated by this viewer. Internally called when the viewer's - * control has been disposed. - */ - protected void handleDispose() { - fTextWidget= null; - } - /** - * @see Viewer#getInput() - */ + @Override public Object getInput() { return getDocument(); } @@ -168,25 +140,19 @@ public void setText(String text) { fDocument.set(text); } - /** - * @see ITextViewer#getDocument() - */ + @Override public IDocument getDocument() { return fDocument; } - /** - * @see ITextViewer#isEditable() - */ + @Override public boolean isEditable() { if (fTextWidget == null) return false; return fTextWidget.getEditable(); } - /** - * @see ITextViewer#setEditable(boolean) - */ + @Override public void setEditable(boolean editable) { if (fTextWidget != null) fTextWidget.setEditable(editable); @@ -202,4 +168,11 @@ public void setSelection(ISelection selection, boolean reveal) { if (reveal) setSelection(selection); } + + /** + * Frees all resources allocated by this viewer. + */ + protected void handleDispose() { + fTextWidget= null; + } } diff --git a/plugins/org.dslforge.texteditor/META-INF/MANIFEST.MF b/plugins/org.dslforge.texteditor/META-INF/MANIFEST.MF index 4fdecaf..901718a 100644 --- a/plugins/org.dslforge.texteditor/META-INF/MANIFEST.MF +++ b/plugins/org.dslforge.texteditor/META-INF/MANIFEST.MF @@ -6,6 +6,7 @@ Bundle-Version: 0.9.1.qualifier Bundle-Activator: org.dslforge.texteditor.internal.Activator Require-Bundle: org.eclipse.rap.ui, org.eclipse.rap.ui.views, + org.eclipse.rap.ui.forms, org.eclipse.emf.common, org.eclipse.emf.rap.common.ui, org.dslforge.styledtext @@ -13,6 +14,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: org.dslforge.texteditor, org.dslforge.texteditor.actions, + org.dslforge.texteditor.form, org.dslforge.texteditor.internal Bundle-Vendor: PlugBee Import-Package: org.apache.log4j diff --git a/plugins/org.dslforge.texteditor/plugin.xml b/plugins/org.dslforge.texteditor/plugin.xml index 4ed0c82..6b25a7a 100644 --- a/plugins/org.dslforge.texteditor/plugin.xml +++ b/plugins/org.dslforge.texteditor/plugin.xml @@ -18,7 +18,6 @@ parentId="org.eclipse.ui.textEditorScope"> - - diff --git a/plugins/org.dslforge.workspace.ui/plugin.xml b/plugins/org.dslforge.workspace.ui/plugin.xml index fd6cd28..517585f 100644 --- a/plugins/org.dslforge.workspace.ui/plugin.xml +++ b/plugins/org.dslforge.workspace.ui/plugin.xml @@ -61,6 +61,13 @@ id="org.dslforge.workspace.ui.commands.NewProject" name="CreateNewProject"> + + @@ -108,8 +115,8 @@ label="Folder" menubarPath="org.dslforge.workspace.menu.new/group1" style="push" - tooltip="Create a new folder"> - + tooltip="Open with default editor"> + - - + icon="icons/file.gif" + id="org.dslforge.workspace.menu.openwith.default" + label="Text Editor (default)" + menubarPath="org.dslforge.workspace.menu.openwith/additions" + style="push" + tooltip="Open with default editor"> + + + + + + + + + + + + @@ -194,7 +235,8 @@ definitionId="org.dslforge.workspace.ui.commands.newFile" icon="icons/file_obj.gif" id="org.dslforge.workspace.ui.actions.newFile" - label="New File" + label="File" + menubarPath="file/new/additions" retarget="false" style="push" toolbarPath="main" @@ -205,7 +247,8 @@ definitionId="org.dslforge.workspace.ui.commands.newFolder" icon="icons/fldr_obj.png" id="org.dslforge.workspace.ui.actions.newFolder" - label="New Folder" + label="Folder" + menubarPath="file/new/additions" retarget="false" style="push" toolbarPath="main" @@ -216,7 +259,8 @@ definitionId="org.dslforge.workspace.ui.commands.NewProject" icon="icons/prj_obj.png" id="org.dslforge.workspace.ui.actions.newProject" - label="New Project" + label="Project" + menubarPath="file/new/additions" retarget="false" style="push" toolbarPath="main" diff --git a/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/NewFolderAction.java b/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/NewFolderAction.java index b8a5a68..19ba281 100644 --- a/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/NewFolderAction.java +++ b/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/NewFolderAction.java @@ -36,5 +36,4 @@ public void run(IAction action) { wizardDialog.open(); } } - -} +} \ No newline at end of file diff --git a/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/OpenResourceAction.java b/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/OpenResourceAction.java index a5c5bd7..380a23e 100644 --- a/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/OpenResourceAction.java +++ b/plugins/org.dslforge.workspace.ui/src/org/dslforge/workspace/ui/actions/OpenResourceAction.java @@ -26,7 +26,6 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.rap.rwt.RWT; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PlatformUI; diff --git a/plugins/org.dslforge.workspace/src/org/dslforge/workspace/WorkspaceManager.java b/plugins/org.dslforge.workspace/src/org/dslforge/workspace/WorkspaceManager.java index eb0200d..d229ff9 100644 --- a/plugins/org.dslforge.workspace/src/org/dslforge/workspace/WorkspaceManager.java +++ b/plugins/org.dslforge.workspace/src/org/dslforge/workspace/WorkspaceManager.java @@ -327,7 +327,7 @@ public Integer call() throws Exception { notifyListeners(event); } if (!watchKey.reset()) { - logger.info("Watch key no longer valid: " + keys.get(watchKey).toString()); + logger.warn("Watch key no longer valid: " + keys.get(watchKey).toString()); } } } catch (ClosedWatchServiceException ex) { diff --git a/plugins/org.dslforge.xtext.common/META-INF/MANIFEST.MF b/plugins/org.dslforge.xtext.common/META-INF/MANIFEST.MF index edd33a1..47fae41 100644 --- a/plugins/org.dslforge.xtext.common/META-INF/MANIFEST.MF +++ b/plugins/org.dslforge.xtext.common/META-INF/MANIFEST.MF @@ -12,11 +12,14 @@ Require-Bundle: org.eclipse.rap.ui, org.dslforge.workspace.ui, org.dslforge.workspace, org.dslforge.styledtext, - org.dslforge.texteditor + org.dslforge.texteditor, + org.eclipse.rap.ui.forms Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: org.dslforge.xtext.common, org.dslforge.xtext.common.actions, + org.dslforge.xtext.common.commands, + org.dslforge.xtext.common.forms, org.dslforge.xtext.common.guice, org.dslforge.xtext.common.internal, org.dslforge.xtext.common.registry, diff --git a/plugins/org.dslforge.xtext.common/plugin.xml b/plugins/org.dslforge.xtext.common/plugin.xml index ae16df0..9ce9192 100644 --- a/plugins/org.dslforge.xtext.common/plugin.xml +++ b/plugins/org.dslforge.xtext.common/plugin.xml @@ -66,7 +66,8 @@ definitionId="org.dslforge.workspace.ui.commands.newModel" icon="icons/model.png" id="org.dslforge.workspace.ui.actions.newModel" - label="New Model" + label="Model" + menubarPath="file/new/group1" retarget="false" style="push" toolbarPath="main" diff --git a/plugins/org.dslforge.xtext.common/src/org/dslforge/xtext/common/XtextContentAssistEnabledEditor.java b/plugins/org.dslforge.xtext.common/src/org/dslforge/xtext/common/XtextContentAssistEnabledEditor.java index 09750f6..cf9a696 100644 --- a/plugins/org.dslforge.xtext.common/src/org/dslforge/xtext/common/XtextContentAssistEnabledEditor.java +++ b/plugins/org.dslforge.xtext.common/src/org/dslforge/xtext/common/XtextContentAssistEnabledEditor.java @@ -38,6 +38,12 @@ public XtextContentAssistEnabledEditor() { super(); } + @Override + public void createPartControl(Composite parent) { + super.createPartControl(parent); + validateResource(); + } + @Override protected BasicText createTextWidget(Composite parent, int styles) { BasicText textWidget = new BasicText(parent, SWT.FILL); @@ -51,12 +57,6 @@ protected BasicText createTextWidget(Composite parent, int styles) { return textWidget; } - @Override - public void createPartControl(Composite parent) { - super.createPartControl(parent); - validateResource(); - } - @Override protected void handleTextChanged(JsonObject object) { int offset = object.get("offset") != null ? object.get("offset").asInt() : 0;