Navigation Menu

Skip to content

Commit

Permalink
Added contribuitions to Editor to allow debugger plugins to set/remov…
Browse files Browse the repository at this point in the history
…e breakpoints
  • Loading branch information
jasonsantos committed Aug 11, 2008
1 parent 72ad3a9 commit 8117d3f
Show file tree
Hide file tree
Showing 10 changed files with 712 additions and 42 deletions.
637 changes: 637 additions & 0 deletions org.keplerproject.ldt.ui/graphics/icons.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion org.keplerproject.ldt.ui/plugin.xml
Expand Up @@ -96,7 +96,7 @@
adaptable="true"
objectClass="org.eclipse.core.resources.IProject"
nameFilter="*"
id="org.keplerproject.ldt.core.contribution1">
id="lua.project.popupMenu">
<menu
id="org.keplerproject.ldt.ui.luaMenu"
label="Lua Actions"
Expand All @@ -120,6 +120,14 @@
menubarPath="org.keplerproject.ldt.ui.luaMenu/group1">
</action>
</objectContribution>
<viewerContribution
id="lua.editor.rulerActions"
targetID="lua.editor.rulerMenu">
</viewerContribution>
<viewerContribution
id="lua.editor.menuActions"
targetID="lua.editor.contextMenu">
</viewerContribution>
</extension>
<extension
id="org.keplerproject.ldt.core.LuaScriptSpecs"
Expand Down
@@ -1,24 +1,19 @@
/*
* Copyright (C) 2003-2007 Kepler Project.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* Copyright (C) 2003-2007 Kepler Project. Permission is hereby granted, free of
* charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to
* the following conditions: The above copyright notice and this permission
* notice shall be included in all copies or substantial portions of the
* Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
* EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package org.keplerproject.ldt.ui.editors;
Expand All @@ -37,7 +32,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.keplerproject.ldt.ui.LDTUIPlugin;
Expand All @@ -49,28 +44,29 @@
* @version $Id$
*/

public class LuaEditor extends TextEditor {
public class LuaEditor extends AbstractDecoratedTextEditor {

private LuaColorManager colorManager;
private final LuaColorManager colorManager;

private LuaSourceViewerConfiguration sourceViewer;
private LuaSourceViewerConfiguration sourceViewer;

private ProjectionSupport projectionSupport;
private ProjectionSupport projectionSupport;

private ProjectionAnnotationModel annotationModel;
private ProjectionAnnotationModel annotationModel;

private String finstanceId;
private String finstanceId;

public LuaEditor() {
super();
// initialize the color manager
colorManager = createColorManager();

setRulerContextMenuId("lua.editor.rulerMenu");
setEditorContextMenuId("lua.editor.editorMenu");
}

@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {


this.finstanceId = getConfigurationElement().getAttribute("id");

Expand Down Expand Up @@ -144,6 +140,7 @@ protected LuaColorManager createColorManager() {
return new LuaColorManager();
}

@Override
public void dispose() {
colorManager.dispose();
super.dispose();
Expand All @@ -152,6 +149,7 @@ public void dispose() {
/**
* Unusable for now.!
*/
@Override
protected void createActions() {
super.createActions();

Expand All @@ -168,8 +166,8 @@ protected void createActions() {

/**
* This method was re-implemented to create a code folding feature.
*
*/
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
Expand All @@ -196,8 +194,8 @@ public void createPartControl(Composite parent) {

/**
* This method was re-implemented to create a code folding feature.
*
*/
@Override
protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler, int styles) {
fAnnotationAccess = createAnnotationAccess();
Expand All @@ -212,17 +210,15 @@ protected ISourceViewer createSourceViewer(Composite parent,
return viewer;
}


/**
* Folding update Structure
*
* @param positions
*/
public void updateFoldingStructure(Map newAnnotations, Map deleteAnnotations)
{
public void updateFoldingStructure(Map newAnnotations, Map deleteAnnotations) {
Annotation[] old = new Annotation[deleteAnnotations.size()];
deleteAnnotations.keySet().toArray(old);

annotationModel.modifyAnnotations(old, newAnnotations, null);
}

Expand Down
@@ -1,5 +1,7 @@
package org.keplerproject.ldt.ui.editors;

import java.lang.reflect.Constructor;

import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.internal.text.html.HTMLTextPresenter;
import org.eclipse.jface.text.DefaultInformationControl;
Expand All @@ -20,6 +22,9 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.keplerproject.ldt.ui.text.lua.LuaWordFinder;

import sun.reflect.Reflection;
import sun.reflect.ReflectionFactory;

/**
* Lua Documentation Information Provider.
* @author jasonsantos
Expand Down Expand Up @@ -141,12 +146,20 @@ public String getInformation(ITextViewer textViewer, IRegion subject) {
*/
public IInformationControlCreator getInformationPresenterControlCreator() {
return new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) {
@SuppressWarnings("deprecation")
public IInformationControl createInformationControl(Shell parent) {
int shellStyle= SWT.RESIZE | SWT.TOOL;
int style= SWT.V_SCROLL | SWT.H_SCROLL;
if (fShowInBrowser && BrowserInformationControl.isAvailable(parent))
return new BrowserInformationControl(parent, shellStyle, style);
else
if (fShowInBrowser && BrowserInformationControl.isAvailable(parent)) {
try {
Class BI = Class.forName("BrowserInformationControl");
Class params[] = {Shell.class, Integer.class, Integer.class};
Constructor c = BI.getConstructor(params);
return (IInformationControl) c.newInstance(parent, shellStyle, style);
} catch(Exception e) {
return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
}
} else
return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
}
};
Expand Down
Expand Up @@ -23,6 +23,7 @@

package org.keplerproject.ldt.ui.editors;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
Expand Down Expand Up @@ -368,8 +369,14 @@ public IInformationControlCreator getInformationPresenterControlCreator() {
public IInformationControl createInformationControl(Shell parent) {
int shellStyle= SWT.RESIZE | SWT.TOOL;
int style= SWT.V_SCROLL | SWT.H_SCROLL;

return new BrowserInformationControl(parent, shellStyle, style);
try {
Class BI = Class.forName("BrowserInformationControl");
Class params[] = {Shell.class, Integer.class, Integer.class};
Constructor c = BI.getConstructor(params);
return (IInformationControl) c.newInstance(parent, shellStyle, style);
} catch(Exception e) {
return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
}

}
};
Expand Down
Expand Up @@ -22,6 +22,8 @@
*/
package org.keplerproject.ldt.ui.editors;

import java.lang.reflect.Constructor;

import org.eclipse.jface.internal.text.html.BrowserInformationControl;
import org.eclipse.jface.internal.text.html.HTMLTextPresenter;
import org.eclipse.jface.text.*;
Expand Down Expand Up @@ -96,7 +98,14 @@ public IInformationControl createInformationControl(Shell parent) {
int shellStyle= SWT.RESIZE | SWT.TOOL;
int style= SWT.V_SCROLL | SWT.H_SCROLL;
if (BrowserInformationControl.isAvailable(parent))
return new BrowserInformationControl(parent, shellStyle, style);
try {
Class BI = Class.forName("BrowserInformationControl");
Class params[] = {Shell.class, Integer.class, Integer.class};
Constructor c = BI.getConstructor(params);
return (IInformationControl) c.newInstance(parent, shellStyle, style);
} catch(Exception e) {
return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
}
else
return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
}
Expand Down

0 comments on commit 8117d3f

Please sign in to comment.