diff options
author | Alexander Kurtakov | 2017-03-17 14:16:02 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-03-17 19:04:44 +0000 |
commit | d9be918c6fdd1e87d60175df8551fb39cbf753d1 (patch) | |
tree | 454ed51cc7cedf036868cf2d72c2e9224ec8ff72 | |
parent | f9a75e19b526dbc976a962bb6f5395e0305754c1 (diff) | |
download | org.eclipse.linuxtools-d9be918c6fdd1e87d60175df8551fb39cbf753d1.tar.gz org.eclipse.linuxtools-d9be918c6fdd1e87d60175df8551fb39cbf753d1.tar.xz org.eclipse.linuxtools-d9be918c6fdd1e87d60175df8551fb39cbf753d1.zip |
systemtap: Remove ui.editor bundle.
Small theoretical functionality lost (ErrorTableDisplay) but it can be
regained easily if someone really uses the systemtap error view (which I
think should be gone and proper markers/annotations and Problems view is
used).
Change-Id: Ifa581dc61644307744af31ea91eca070cc63b2b2
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-on: https://git.eclipse.org/r/93296
Tested-by: Hudson CI
40 files changed, 136 insertions, 745 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap-feature/feature.xml b/systemtap/org.eclipse.linuxtools.systemtap-feature/feature.xml index f445dcc26f..6971fc8ceb 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap-feature/feature.xml +++ b/systemtap/org.eclipse.linuxtools.systemtap-feature/feature.xml @@ -32,13 +32,6 @@ unpack="false"/> <plugin - id="org.eclipse.linuxtools.systemtap.ui.editor" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin id="org.eclipse.linuxtools.systemtap.graphing.core" download-size="0" install-size="0" diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/META-INF/MANIFEST.MF index 473661e4da..e41dbd0ff8 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/META-INF/MANIFEST.MF +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/META-INF/MANIFEST.MF @@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.console, org.eclipse.ui.editors, - org.eclipse.linuxtools.systemtap.ui.editor, org.eclipse.linuxtools.systemtap.structures, com.jcraft.jsch;bundle-version="0.1.37", org.eclipse.debug.ui @@ -24,5 +23,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: org.eclipse.core.resources, org.eclipse.debug.ui, org.eclipse.linuxtools.systemtap.graphing.ui.widgets, - org.eclipse.linuxtools.systemtap.ui.editor, org.eclipse.linuxtools.tools.launch.core.factory diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ErrorTableDisplay.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ErrorTableDisplay.java index 969236ba7c..3b212515f4 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ErrorTableDisplay.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ErrorTableDisplay.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation. + * Copyright (c) 2006, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,20 +14,13 @@ package org.eclipse.linuxtools.systemtap.ui.consolelog.structures; import java.util.Arrays; import org.eclipse.linuxtools.systemtap.ui.consolelog.internal.ConsoleLogPlugin; -import org.eclipse.linuxtools.systemtap.ui.editor.SimpleEditor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -51,7 +44,6 @@ public class ErrorTableDisplay { table.setHeaderVisible(true); table.getVerticalBar().setVisible(true); table.setLinesVisible(true); - table.addMouseListener(mouseListener); TableColumn column; for(String title: titles) { @@ -114,7 +106,6 @@ public class ErrorTableDisplay { */ public void dispose() { if(null != table && !table.isDisposed()) { - table.removeMouseListener(mouseListener); table.dispose(); table = null; } @@ -132,36 +123,6 @@ public class ErrorTableDisplay { item = null; } - /** - * MouseListener that is used to detect when the user clicks on a row in the table. - * When clicked it will find the line number the error occured on and then set the - * cursor location to that location in the active editor. - */ - private final MouseListener mouseListener = new MouseAdapter() { - @Override - public void mouseDoubleClick(MouseEvent me) { - String location = table.getSelection()[0].getText(4); - - if(location.length() > 0) { - int line = 0; - if(location.indexOf(':') > 0) { - String[] pos = location.split(":"); //$NON-NLS-1$ - line = Integer.parseInt(pos[0]); - } else { - line = Integer.parseInt(location); - } - - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IEditorPart ed = page.getActiveEditor(); - - if(ed instanceof SimpleEditor) { - SimpleEditor editor = ((SimpleEditor)ed); - editor.selectLine(line); - editor.setFocus(); - } - } - } - }; private Table table; private String[] titles; diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.classpath b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.classpath deleted file mode 100644 index 43b986286a..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="target/classes"/> -</classpath> diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.gitignore b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.gitignore deleted file mode 100644 index 8d94ef8deb..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -bin -@dot -javaCompiler...args -build.xml -target diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.project b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.project deleted file mode 100644 index 06afb211cf..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.linuxtools.systemtap.ui.editor</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.settings/org.eclipse.jdt.core.prefs b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3d54e6918e..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,109 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=default -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=warning -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF deleted file mode 100644 index faa8a12c11..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF +++ /dev/null @@ -1,17 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %bundleName -Bundle-SymbolicName: org.eclipse.linuxtools.systemtap.ui.editor;singleton:=true -Bundle-Version: 4.0.0.qualifier -Bundle-Vendor: %bundleProvider -Bundle-Localization: plugin -Export-Package: org.eclipse.linuxtools.systemtap.ui.editor -Require-Bundle: org.eclipse.core.filesystem, - org.eclipse.core.runtime, - org.eclipse.jface.text, - org.eclipse.ui.editors, - org.eclipse.ui.workbench.texteditor, - org.eclipse.ui -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: org.eclipse.ui.ide diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/about.html b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/about.html deleted file mode 100644 index c258ef55d8..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 5, 2006</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> - -</body> -</html>
\ No newline at end of file diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/build.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/build.properties deleted file mode 100644 index 774b92c465..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -bin.includes = META-INF/,\ - icons/,\ - .,\ - about.html,\ - plugin.properties -src.includes = about.html diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/copy_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/copy_edit.gif Binary files differdeleted file mode 100644 index 71d7c95aa8..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/copy_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/cut_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/cut_edit.gif Binary files differdeleted file mode 100644 index d044e59777..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/cut_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/delete_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/delete_edit.gif Binary files differdeleted file mode 100644 index b6922ac11c..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/delete_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/paste_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/paste_edit.gif Binary files differdeleted file mode 100644 index 39dd4d9d38..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/paste_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/redo_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/redo_edit.gif Binary files differdeleted file mode 100644 index c84e5b1d84..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/redo_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/undo_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/undo_edit.gif Binary files differdeleted file mode 100644 index eae118ad16..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/edit/undo_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/close_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/close_edit.gif Binary files differdeleted file mode 100644 index 2cd9c54443..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/close_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/closeall_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/closeall_edit.gif Binary files differdeleted file mode 100644 index 28a3785aac..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/closeall_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/new_wiz.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/new_wiz.gif Binary files differdeleted file mode 100644 index 7aea894d0b..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/new_wiz.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/open_wiz.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/open_wiz.gif Binary files differdeleted file mode 100644 index 51e703b1b9..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/open_wiz.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/print_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/print_edit.gif Binary files differdeleted file mode 100644 index 04cb84bf4f..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/print_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/save_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/save_edit.gif Binary files differdeleted file mode 100644 index 499dd0ca60..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/save_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/saveall_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/saveall_edit.gif Binary files differdeleted file mode 100644 index ef0eab5ba3..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/saveall_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/saveas_edit.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/saveas_edit.gif Binary files differdeleted file mode 100644 index 466bfb1128..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/icons/actions/file/saveas_edit.gif +++ /dev/null diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties deleted file mode 100644 index 22ed30610a..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.properties +++ /dev/null @@ -1,2 +0,0 @@ -bundleName=SystemTap Script Editor -bundleProvider=Eclipse Linux Tools diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/pom.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/pom.xml deleted file mode 100644 index 5f653f147f..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (C) 2011, Red Hat, Inc. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html ---> -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <artifactId>linuxtools-systemtap-parent</artifactId> - <groupId>org.eclipse.linuxtools.systemtap</groupId> - <version>6.0.0-SNAPSHOT</version> - </parent> - - <artifactId>org.eclipse.linuxtools.systemtap.ui.editor</artifactId> - <version>4.0.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> - - <name>Linux Tools SystemTap Script Editor Plug-In</name> -</project> diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/EditorPlugin.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/EditorPlugin.java deleted file mode 100644 index 0833d6195f..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/EditorPlugin.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse - *******************************************************************************/ - -package org.eclipse.linuxtools.internal.systemtap.ui.editor; - -/** - * The constants definitions. - */ -public interface EditorPlugin { - - String ID = "org.eclipse.linuxtools.systemtap.ui.editor"; //$NON-NLS-1$ -} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/Localization.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/Localization.java deleted file mode 100644 index 04ab0bcc59..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/Localization.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.internal.systemtap.ui.editor; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Localization { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.systemtap.ui.editor.localization"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Localization() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties deleted file mode 100644 index c73828dfeb..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/localization.properties +++ /dev/null @@ -1,5 +0,0 @@ -PathEditorInput.Untitled=untitled -NewFileHandler.NewFile=New File - -SimpleDocumentProvider.errorCreatingFile=Error when saving file -SimpleDocumentProvider.incorrectURL=Incorrect URL diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleDocumentProvider.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleDocumentProvider.java deleted file mode 100644 index 68fbc175e0..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleDocumentProvider.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse - *******************************************************************************/ - -package org.eclipse.linuxtools.systemtap.ui.editor; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.Writer; -import java.net.MalformedURLException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.linuxtools.internal.systemtap.ui.editor.EditorPlugin; -import org.eclipse.linuxtools.internal.systemtap.ui.editor.Localization; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IPathEditorInput; -import org.eclipse.ui.ide.FileStoreEditorInput; -import org.eclipse.ui.texteditor.AbstractDocumentProvider; - -public class SimpleDocumentProvider extends AbstractDocumentProvider { - - @Override - protected IDocument createDocument(Object element) throws CoreException { - if (element instanceof IEditorInput) { - IDocument document= new Document(); - setDocumentContent(document, (IEditorInput) element); - return document; - } - - return null; - } - - /** - * Tries to read the file pointed at by <code>input</code> if it is an - * <code>IPathEditorInput</code>. If the file does not exist, <code>true</code> - * is returned. - * - * @param document the document to fill with the contents of <code>input</code> - * @param input the editor input - * @throws CoreException if reading the file fails - */ - private static void setDocumentContent(IDocument document, IEditorInput input) throws CoreException { - Reader reader = null; - try { - if (input instanceof FileStoreEditorInput){ - reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); - } else if (input instanceof IPathEditorInput){ - reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); - } else { - return; - } - } catch (FileNotFoundException e) { - // return empty document and save later - return; - } catch (MalformedURLException e) { - throw new CoreException(new Status(IStatus.ERROR, EditorPlugin.ID ,Localization.getString("SimpleDocumentProvider.incorrectURL"), e)); //$NON-NLS-1$ - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, EditorPlugin.ID, Localization.getString("SimpleDocumentProvider.errorCreatingFile"), e)); //$NON-NLS-1$ - } - - try { - setDocumentContent(document, reader); - return; - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, EditorPlugin.ID, IStatus.OK, Localization.getString("SimpleDocumentProvider.errorCreatingFile"), e)); //$NON-NLS-1$ - } - } - - /** - * Reads in document content from a reader and fills <code>document</code> - * - * @param document the document to fill - * @param reader the source - * @throws IOException if reading fails - */ - private static void setDocumentContent(IDocument document, Reader reader) throws IOException { - try (Reader in= new BufferedReader(reader)) { - - StringBuffer buffer= new StringBuffer(512); - char[] readBuffer= new char[512]; - int n= in.read(readBuffer); - while (n > 0) { - buffer.append(readBuffer, 0, n); - n= in.read(readBuffer); - } - - document.set(buffer.toString()); - } - } - - @Override - protected IAnnotationModel createAnnotationModel(Object element) { - return null; - } - - @Override - protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - if (element instanceof IPathEditorInput) { - IPathEditorInput pei= (IPathEditorInput) element; - IPath path= pei.getPath(); - File file= path.toFile(); - - try { - file.createNewFile(); - - if (file.exists()) { - if (file.canWrite()) { - Writer writer= new FileWriter(file); - writeDocumentContent(document, writer); - } else { - throw new CoreException(new Status(IStatus.ERROR, EditorPlugin.ID, IStatus.OK, "file is read-only", null)); //$NON-NLS-1$ - } - } else { - throw new CoreException(new Status(IStatus.ERROR, EditorPlugin.ID, IStatus.OK, "error creating file", null)); //$NON-NLS-1$ - } - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, EditorPlugin.ID, IStatus.OK, Localization.getString("errorCreatingFile"), e)); //$NON-NLS-1$ - } - } - } - - /** - * Saves the document contents to a stream. - * - * @param document the document to save - * @param writer the stream to save it to - * @throws IOException if writing fails - */ - private static void writeDocumentContent(IDocument document, Writer writer) throws IOException { - try (Writer out= new BufferedWriter(writer)) { - out.write(document.get()); - } - } - - @Override - protected IRunnableContext getOperationRunner(IProgressMonitor monitor) { - return null; - } - - @Override - public boolean isModifiable(Object element) { - if (element instanceof IPathEditorInput) { - IPathEditorInput pei= (IPathEditorInput) element; - File file= pei.getPath().toFile(); - return file.canWrite() || !file.exists(); // Allow to edit new files - } - return false; - } - - @Override - public boolean isReadOnly(Object element) { - return !isModifiable(element); - } - - @Override - public boolean isStateValidated(Object element) { - return true; - } -}
\ No newline at end of file diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleEditor.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleEditor.java deleted file mode 100644 index e630807c69..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleEditor.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse - *******************************************************************************/ - -package org.eclipse.linuxtools.systemtap.ui.editor; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.FindReplaceDocumentAdapter; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.linuxtools.internal.systemtap.ui.editor.Localization; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.editors.text.TextEditor; - -public class SimpleEditor extends TextEditor { - public SimpleEditor() { - super(); - // make sure we inherit all the text editing commands (delete line etc). - setKeyBindingScopes(new String[] { "org.eclipse.linuxtools.systemtap.ui.ide.context" }); //$NON-NLS-1$ - internalInit(); - } - - /** - * @since 3.0 - */ - protected void internalInit() { - configureInsertMode(SMART_INSERT, false); - setDocumentProvider(new SimpleDocumentProvider()); - } - - /** - * Searches the IDocument for the specified string. - * - * @param search string to find, case-sensitive - * @return the integer line number of the string - */ - public int find(String search) { - return findWithOptions(search, false); - } - - /** - * Searches the IDocument for the specified regex. - * @param regex string regex to find - * @return the integer line number of the string - * @since 3.0 - */ - public int findRegex(String regex) { - return findWithOptions(regex, true); - } - - private int findWithOptions(String search, boolean regExSearch) { - IDocument doc = getSourceViewer().getDocument(); - FindReplaceDocumentAdapter finder = new FindReplaceDocumentAdapter(doc); - - int line = 0; - - jumpToLocation(0, 0); - try { - IRegion reg = finder.find(0, search, true, !regExSearch, false, regExSearch); - int offset = reg.getOffset(); - line = doc.getLineOfOffset(offset); - } catch (BadLocationException ble) { - // Pass - } catch (NullPointerException npe) { - line = -1; - } - - return line; - } - - /** - * Jumps to the location in the IDocument. - * @param line The line you wish to jump to. - * @param character The character you wish to jump to. - */ - public void jumpToLocation(int line, int character) { - IDocument doc = getSourceViewer().getDocument(); - - try { - int offset = doc.getLineOffset(line-1) + character; - this.getSelectionProvider().setSelection(new TextSelection(doc, offset, 0)); - } catch (BadLocationException boe) { - // Pass - } - } - - /** - * Selects a line in the IDocument. - * @param line the line you wish to select - */ - public void selectLine(int line) { - IDocument doc = getSourceViewer().getDocument(); - - try { - this.getSelectionProvider().setSelection(new TextSelection(doc, doc.getLineOffset(line-1), doc.getLineLength(line-1)-1)); - } catch (BadLocationException boe) { - // Pass - } - } - - /** - * Performs a SaveAs on the IDocument. - */ - @Override - public void doSaveAs() { - File file = queryFile(); - if (file == null) { - return; - } - - IEditorInput inputFile = createEditorInput(file); - - IDocument doc = getSourceViewer().getDocument(); - String s = doc.get(); - - try (FileOutputStream fos = new FileOutputStream(file); - PrintStream ps = new PrintStream(fos)){ - ps.print(s); - ps.close(); - } catch (IOException fnfe) { - // Pass - } - - setInput(inputFile); - setPartName(inputFile.getName()); - } - - /** - * Sets up an editor input based on the specified file. - * @param file the location of the file you wish to set. - * @return input object created. - */ - private static IEditorInput createEditorInput(File file) { - IPath location= new Path(file.getAbsolutePath()); - return new PathEditorInput(location); - } - - /** - * Inserts text into the IDocument. - * @param text string to insert - */ - public void insertText(String text) { - IDocument doc = getSourceViewer().getDocument(); - String s = doc.get(); - int offset = s.length(); - s += text; - doc.set(s); - this.setHighlightRange(offset, 0, true); - } - - /** - * Inserts text at the current location. - * @param text string to insert - */ - public void insertTextAtCurrent(String text) { - ISelection selection = this.getSelectionProvider().getSelection(); - IDocument doc = getSourceViewer().getDocument(); - - if (selection instanceof ITextSelection) { - ITextSelection s = (ITextSelection) selection; - StringBuffer sb = new StringBuffer(doc.get().substring(0, s.getOffset())); - sb.append(text.trim()); - sb.append(doc.get().substring(s.getOffset() + s.getLength(), doc.get().length())); - doc.set(sb.toString()); - this.setHighlightRange(s.getOffset() + text.trim().length(), 0, true); - } - } - - private static File queryFile() { - FileDialog dialog= new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SAVE); - dialog.setText(Localization.getString("NewFileHandler.NewFile")); //$NON-NLS-1$ - String path= dialog.open(); - if (path != null && !path.isEmpty()) { - return new File(path); - } - return null; - } - - /** - * Determines whether saving is allowed currently. - * @return boolean value indicating whether or not saving is allowed - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - public static final String ID = "org.eclipse.linuxtools.systemtap.ui.editor.SimpleEditor"; //$NON-NLS-1$ -} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/META-INF/MANIFEST.MF index 6561e22b2c..0082c82258 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/META-INF/MANIFEST.MF +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/META-INF/MANIFEST.MF @@ -16,7 +16,6 @@ Require-Bundle: org.eclipse.linuxtools.profiling.launch;bundle-version="0.11.0", org.eclipse.linuxtools.systemtap.graphing.core, org.eclipse.linuxtools.systemtap.graphing.ui, - org.eclipse.linuxtools.systemtap.ui.editor, org.eclipse.linuxtools.systemtap.ui.consolelog, org.eclipse.linuxtools.systemtap.structures, org.eclipse.ui, diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/Messages.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/Messages.java index 9ebd3a1633..0725c6630b 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/Messages.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/Messages.java @@ -19,6 +19,9 @@ public class Messages extends NLS { public static String STPCompletionProcessor_probe; public static String STPCompletionProcessor_function; public static String STPMetadataSingleton_noCompletions; + public static String NewFileHandler_NewFile; + public static String SimpleDocumentProvider_errorCreatingFile; + public static String SimpleDocumentProvider_incorrectURL; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/PathEditorInput.java index f9654ae5ef..032583cfd9 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/PathEditorInput.java @@ -9,7 +9,7 @@ * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse *******************************************************************************/ -package org.eclipse.linuxtools.systemtap.ui.editor; +package org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.runtime.IPath; diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java index 9fe6ebfda6..04cc9548fb 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java @@ -12,13 +12,22 @@ package org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; import java.util.ArrayList; import java.util.HashMap; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.Position; +import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.IVerticalRuler; @@ -26,14 +35,17 @@ import org.eclipse.jface.text.source.projection.ProjectionAnnotation; import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; import org.eclipse.jface.text.source.projection.ProjectionSupport; import org.eclipse.jface.text.source.projection.ProjectionViewer; -import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput; -import org.eclipse.linuxtools.systemtap.ui.editor.SimpleEditor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.ide.FileStoreEditorInput; import org.eclipse.ui.texteditor.ITextEditorActionConstants; -public class STPEditor extends SimpleEditor { +public class STPEditor extends TextEditor { private Annotation[] stpOldAnnotations; private ProjectionAnnotationModel stpAnnotationModel; @@ -42,12 +54,9 @@ public class STPEditor extends SimpleEditor { public STPEditor() { super(); - setSourceViewerConfiguration(new STPConfiguration(this)); - } - - @Override - protected void internalInit() { + setKeyBindingScopes(new String[] { "org.eclipse.linuxtools.systemtap.ui.ide.context" }); //$NON-NLS-1$ configureInsertMode(SMART_INSERT, false); + setSourceViewerConfiguration(new STPConfiguration(this)); } @Override @@ -95,6 +104,114 @@ public class STPEditor extends SimpleEditor { public ISourceViewer getMySourceViewer() { return this.getSourceViewer(); } + + /** + * Inserts text into the IDocument. + * @param text string to insert + */ + public void insertText(String text) { + IDocument doc = getSourceViewer().getDocument(); + String s = doc.get(); + int offset = s.length(); + s += text; + doc.set(s); + this.setHighlightRange(offset, 0, true); + } + + /** + * Inserts text at the current location. + * @param text string to insert + */ + public void insertTextAtCurrent(String text) { + ISelection selection = this.getSelectionProvider().getSelection(); + IDocument doc = getSourceViewer().getDocument(); + + if (selection instanceof ITextSelection) { + ITextSelection s = (ITextSelection) selection; + StringBuffer sb = new StringBuffer(doc.get().substring(0, s.getOffset())); + sb.append(text.trim()); + sb.append(doc.get().substring(s.getOffset() + s.getLength(), doc.get().length())); + doc.set(sb.toString()); + this.setHighlightRange(s.getOffset() + text.trim().length(), 0, true); + } + } + + /** + * Jumps to the location in the IDocument. + * @param line The line you wish to jump to. + * @param character The character you wish to jump to. + */ + public void jumpToLocation(int line, int character) { + IDocument doc = getSourceViewer().getDocument(); + + try { + int offset = doc.getLineOffset(line-1) + character; + this.getSelectionProvider().setSelection(new TextSelection(doc, offset, 0)); + } catch (BadLocationException boe) { + // Pass + } + } + + /** + * Selects a line in the IDocument. + * @param line the line you wish to select + */ + public void selectLine(int line) { + IDocument doc = getSourceViewer().getDocument(); + + try { + this.getSelectionProvider().setSelection(new TextSelection(doc, doc.getLineOffset(line-1), doc.getLineLength(line-1)-1)); + } catch (BadLocationException boe) { + // Pass + } + } + + /** + * Performs a SaveAs on the IDocument. + */ + @Override + public void doSaveAs() { + File file = queryFile(); + if (file == null) { + return; + } + + IEditorInput inputFile = createEditorInput(file); + + IDocument doc = getSourceViewer().getDocument(); + String s = doc.get(); + + try (FileOutputStream fos = new FileOutputStream(file); + PrintStream ps = new PrintStream(fos)){ + ps.print(s); + ps.close(); + } catch (IOException fnfe) { + // Pass + } + + setInput(inputFile); + setPartName(inputFile.getName()); + } + + /** + * Sets up an editor input based on the specified file. + * @param file the location of the file you wish to set. + * @return input object created. + */ + private static IEditorInput createEditorInput(File file) { + IPath location= new Path(file.getAbsolutePath()); + return new PathEditorInput(location); + } + + private static File queryFile() { + FileDialog dialog= new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SAVE); + dialog.setText(Messages.NewFileHandler_NewFile); + String path= dialog.open(); + if (path != null && !path.isEmpty()) { + return new File(path); + } + return null; + } @Override protected void editorContextMenuAboutToShow(IMenuManager menu) { diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/messages.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/messages.properties index c8d90d07f5..210b03c847 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/messages.properties +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/messages.properties @@ -22,3 +22,6 @@ STPCompletionProcessor_function=Create a function which can be called from other \ \ \ \ printf("bar")\n\ \ \ } STPMetadataSingleton_noCompletions=No completion data found. +NewFileHandler_NewFile=New File +SimpleDocumentProvider_errorCreatingFile=Error when saving file +SimpleDocumentProvider_incorrectURL=Incorrect URL diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java index 7749d3f974..4189057752 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java @@ -36,6 +36,7 @@ import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.ProgressMonitorPart; import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPlugin; import org.eclipse.linuxtools.internal.systemtap.ui.ide.Localization; +import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.PathEditorInput; import org.eclipse.linuxtools.internal.systemtap.ui.ide.launcher.SystemTapScriptLaunch; import org.eclipse.linuxtools.internal.systemtap.ui.ide.preferences.EnvironmentVariablesPreferencePage; import org.eclipse.linuxtools.internal.systemtap.ui.ide.preferences.IDEPreferenceConstants; @@ -44,7 +45,6 @@ import org.eclipse.linuxtools.systemtap.graphing.ui.widgets.ExceptionErrorDialog import org.eclipse.linuxtools.systemtap.ui.consolelog.ScpClient; import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.RemoteScriptOptions; import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole; -import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java index 9f8a52975e..e5a00f7798 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java @@ -25,8 +25,8 @@ import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPlugin; +import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.PathEditorInput; import org.eclipse.linuxtools.systemtap.graphing.ui.widgets.ExceptionErrorDialog; -import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchShortcut.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchShortcut.java index 5bbd1745d7..7bd07b5841 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchShortcut.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchShortcut.java @@ -26,9 +26,9 @@ import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.ui.ILaunchShortcut2; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.PathEditorInput; import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut; import org.eclipse.linuxtools.systemtap.graphing.ui.widgets.ExceptionErrorDialog; -import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.ide.ResourceUtil; diff --git a/systemtap/pom.xml b/systemtap/pom.xml index f825431b3f..399f1274fa 100644 --- a/systemtap/pom.xml +++ b/systemtap/pom.xml @@ -50,7 +50,6 @@ <module>org.eclipse.linuxtools.systemtap.ui.consolelog</module> <module>org.eclipse.linuxtools.systemtap.ui.consolelog.tests</module> <module>org.eclipse.linuxtools.systemtap.ui.doc</module> - <module>org.eclipse.linuxtools.systemtap.ui.editor</module> <module>org.eclipse.linuxtools.systemtap.graphing.core</module> <module>org.eclipse.linuxtools.systemtap.graphing.core.tests</module> <module>org.eclipse.linuxtools.systemtap.graphing.ui</module> |