Skip to content

Commit

Permalink
PA 2014 version
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-santos-pt committed Apr 16, 2015
1 parent f9d4632 commit ea4dcab
Show file tree
Hide file tree
Showing 84 changed files with 3,932 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pt.iscte.pidesco.feature/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>pt.iscte.pidesco.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
1 change: 1 addition & 0 deletions pt.iscte.pidesco.feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin.includes = feature.xml
40 changes: 40 additions & 0 deletions pt.iscte.pidesco.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="pt.iscte.pidesco.feature"
label="Pidesco Core"
version="0.1">

<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>

<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>

<license url="http://www.example.com/license">
[Enter License Description here.]
</license>

<plugin
id="pt.iscte.pidesco.javaeditor"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="pt.iscte.pidesco"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="pt.iscte.pidesco.projectbrowser"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
7 changes: 7 additions & 0 deletions pt.iscte.pidesco.javaeditor/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions pt.iscte.pidesco.javaeditor/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>pt.iscte.pidesco.javaeditor</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>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
22 changes: 22 additions & 0 deletions pt.iscte.pidesco.javaeditor/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Simple Java Editor
Bundle-SymbolicName: pt.iscte.pidesco.javaeditor;singleton:=true
Bundle-Version: 1.1
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="0.0.0",
org.eclipse.core.resources;bundle-version="0.0.0",
org.eclipse.ui.console;bundle-version="0.0.0",
org.eclipse.jface.text;bundle-version="0.0.0",
org.eclipse.ui.editors;bundle-version="0.0.0",
org.eclipse.ui.ide;bundle-version="0.0.0",
org.eclipse.core.filesystem;bundle-version="0.0.0",
org.eclipse.jdt;bundle-version="3.10.0",
org.eclipse.jdt.core;bundle-version="3.10.0",
pt.iscte.pidesco.projectbrowser;bundle-version="0.1.0",
pt.iscte.pidesco;bundle-version="0.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: pt.iscte.dcti
Export-Package: pt.iscte.pidesco.javaeditor.service
Bundle-Activator: pt.iscte.pidesco.javaeditor.internal.JavaEditorActivator
Bundle-ActivationPolicy: lazy
7 changes: 7 additions & 0 deletions pt.iscte.pidesco.javaeditor/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
images/,\
about.ini
Binary file added pt.iscte.pidesco.javaeditor/images/blackboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/browser.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/iscte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/javafile.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/javaproject.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/newfile.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/newfolder.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/newproj.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/projects.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pt.iscte.pidesco.javaeditor/images/sync.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions pt.iscte.pidesco.javaeditor/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
class="pt.iscte.pidesco.javaeditor.internal.SimpleJavaEditor"
default="true"
extensions="java"
icon="images/javafile.gif"
id="pt.iscte.pidesco.javaeditor"
name="Simple Java editor">
<contentTypeBinding
contentTypeId="org.eclipse.jdt.core.javaSource">
</contentTypeBinding>
</editor>
</extension>

<extension
point="org.eclipse.ui.startup">
<startup
class="pt.iscte.pidesco.javaeditor.internal.Startup">
</startup>
</extension>

<extension
id="packagefocus"
name="Package filter"
point="pt.iscte.pidesco.projectbrowser.filter">
<filter
class="pt.iscte.pidesco.javaeditor.PackageFocusFilter">
</filter>
</extension>
<extension
id="packagefocus"
name="Package focus"
point="pt.iscte.pidesco.tool">
<tool
class="pt.iscte.pidesco.javaeditor.PackageFocusTool"
description="Focus on the package of the opened class"
hasState="true"
icon="package_filter.gif"
view="pt.iscte.pidesco.projectbrowser.tree">
</tool>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package pt.iscte.pidesco.javaeditor;

import java.io.File;

import pt.iscte.pidesco.javaeditor.internal.JavaEditorActivator;
import pt.iscte.pidesco.javaeditor.internal.JavaEditorServicesImpl;
import pt.iscte.pidesco.javaeditor.service.JavaEditorServices;
import pt.iscte.pidesco.projectbrowser.extensibility.ProjectBrowserFilter;
import pt.iscte.pidesco.projectbrowser.model.PackageElement;
import pt.iscte.pidesco.projectbrowser.model.SourceElement;

public class PackageFocusFilter implements ProjectBrowserFilter {

private JavaEditorServices services;

public PackageFocusFilter() {
services = JavaEditorActivator.getInstance().getServices();
}

@Override
public boolean include(SourceElement element, PackageElement parent) {
File f = services.getOpenedFile();
if(element.isPackage() && ((PackageElement) element).hasChild(f, true))
return true;
else if (element.isClass() && parent.hasChild(f, false))
return true;

return false;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package pt.iscte.pidesco.javaeditor;

import java.io.File;

import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;

import pt.iscte.pidesco.extensibility.PidescoServices;
import pt.iscte.pidesco.extensibility.PidescoTool;
import pt.iscte.pidesco.javaeditor.internal.JavaEditorActivator;
import pt.iscte.pidesco.javaeditor.service.JavaEditorListener;
import pt.iscte.pidesco.projectbrowser.service.ProjectBrowserServices;

public class PackageFocusTool implements PidescoTool {

private static final String FILTER_ID = "pt.iscte.pidesco.javaeditor.packagefocus";

@Override
public void run(boolean selected) {

BundleContext context = JavaEditorActivator.getInstance().getContext();

ServiceReference<PidescoServices> ref1 = context.getServiceReference(PidescoServices.class);
final PidescoServices services = context.getService(ref1);

ServiceReference<ProjectBrowserServices> ref2 = context.getServiceReference(ProjectBrowserServices.class);
ProjectBrowserServices browser = context.getService(ref2);


if(selected) {
browser.activateFilter(FILTER_ID);
JavaEditorActivator.getInstance().addListener(
new JavaEditorListener.Adapter() {
@Override
public void fileOpened(File file) {
services.runTool(ProjectBrowserServices.REFRESH_TOOL_ID, true);
}
});
}
else {
browser.deactivateFilter(FILTER_ID);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2014 Andre L. Santos.
* 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:
* Andre L Santos - developer
******************************************************************************/
package pt.iscte.pidesco.javaeditor.internal;

import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.swt.SWT;

public class Common {
public static IToken createToken(TokenColor color, boolean bold) {
if(bold)
return new Token(new TextAttribute(color.color, null, SWT.BOLD));
else
return new Token(new TextAttribute(color.color));

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*******************************************************************************
* Copyright (c) 2014 Andre L. Santos.
* 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:
* Andre L Santos - developer
******************************************************************************/
package pt.iscte.pidesco.javaeditor.internal;

import java.util.Iterator;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;


public class Configuration extends SourceViewerConfiguration {
// private JavaCodeScanner tagScanner;

public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] {
IDocument.DEFAULT_CONTENT_TYPE,
JavaCodePartitionScanner.JAVA_COMMENT};
// JavaCodePartitionScanner.JAVA_CODE };
}


// protected JavaCodeScanner getTagScanner() {
// if (tagScanner == null) {
// tagScanner = new JavaCodeScanner();