Skip to content

Commit

Permalink
initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Parsa Pourali committed Aug 24, 2020
0 parents commit 632f55c
Show file tree
Hide file tree
Showing 3,012 changed files with 306,059 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/.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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/target/
39 changes: 39 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>uw.cs.watform.forml.base.xtext.utils.jface</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>
<filteredResources>
<filter>
<id>0</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-target</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
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
58 changes: 58 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: YAKINDU Xtext JFace Integration (XJI)
Bundle-SymbolicName: uw.cs.watform.forml.base.xtext.utils.jface;singleton:=true
Bundle-Version: 2.6.0.qualifier
Bundle-Vendor: statecharts.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.expressions,
org.eclipse.ui.ide,
org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.emf.common,
org.eclipse.xtext.ui,
org.eclipse.help
Export-Package: uw.cs.watform.forml.base.utils.jface.help;
uses:="org.eclipse.jface.text,
org.eclipse.emf.ecore,
org.eclipse.xtext.ui.editor.hover,
org.eclipse.xtext.ui.editor.hover.html,
org.eclipse.xtext.documentation",
uw.cs.watform.forml.base.utils.jface.viewers;
uses:="org.eclipse.swt.events,
org.eclipse.swt.custom,
org.eclipse.jface.viewers,
org.eclipse.swt.widgets",
uw.cs.watform.forml.base.xtext.utils.jface.fieldassist;uses:="org.eclipse.jface.bindings.keys,org.eclipse.jface.text.contentassist,org.eclipse.swt.widgets",
uw.cs.watform.forml.base.xtext.utils.jface.viewers;
uses:="org.eclipse.jface.text,
org.eclipse.swt.custom,
org.eclipse.xtext.ui.editor.preferences,
org.eclipse.xtext.ui.editor.validation,
org.eclipse.jface.action,
org.yakindu.base.utils.jface.viewers,
org.eclipse.xtext.parser,
org.eclipse.emf.ecore,
org.eclipse.xtext.resource,
org.eclipse.ui.texteditor,
org.eclipse.jface.text.source,
org.eclipse.xtext.ui.editor,
org.eclipse.swt.events,
org.eclipse.jface.text.contentassist,
org.eclipse.xtext.ui.editor.syntaxcoloring,
org.eclipse.jface.preference,
org.eclipse.emf.common.notify.impl,
org.yakindu.base.xtext.utils.jface.viewers.context,
org.eclipse.xtext.ui.editor.model,
org.eclipse.jface.util,
org.eclipse.swt.widgets,
com.google.inject",
uw.cs.watform.forml.base.xtext.utils.jface.viewers.context;
uses:="org.eclipse.emf.ecore.resource,
org.eclipse.core.resources,
org.eclipse.xtext.resource,
com.google.inject",
uw.cs.watform.forml.base.xtext.utils.jface.viewers.util;uses:="org.eclipse.emf.ecore.resource,org.eclipse.ui,org.eclipse.core.resources"
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
6 changes: 6 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml

10 changes: 10 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.startup">
<startup
class="uw.cs.watform.forml.base.xtext.utils.jface.viewers.util.ActiveEditorTracker">
</startup>
</extension>
</plugin>
15 changes: 15 additions & 0 deletions uw.cs.watform.forml.base.xtext.utils.jface/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>org.yakindu.sct</groupId>
<artifactId>org.yakindu.sct.releng</artifactId>
<version>2.6.0-SNAPSHOT</version>
<relativePath>../../releng/org.yakindu.sct.releng/pom.xml</relativePath>
</parent>
<artifactId>org.yakindu.base.xtext.utils.jface</artifactId>
<groupId>org.yakindu.sct.plugins</groupId>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* Copyright (c) 2012 committers of YAKINDU 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
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package uw.cs.watform.forml.base.utils.jface.help;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Locale;
import java.util.Map;

import org.eclipse.core.runtime.Assert;
import org.eclipse.help.IContext;
import org.eclipse.help.IHelpResource;
import org.eclipse.help.internal.context.ContextFileProvider;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;

import com.google.common.collect.Maps;

/**
*
* @author andreas muelder - Initial contribution and API
*
*/
@SuppressWarnings("restriction")
public abstract class AbstractUserHelpDocumentationProvider implements
IEObjectDocumentationProvider {

public static final String EMPTY_DOCUMENTATION = "";

private Map<String, String> helpContentCache;

public AbstractUserHelpDocumentationProvider() {
helpContentCache = Maps.newHashMap();
}

protected String getHelp(String contextId) {
if (helpContentCache.get(contextId) != null) {
return helpContentCache.get(contextId);
}
try {
helpContentCache.put(contextId, parseHelp(contextId));
} catch (Exception e) {
e.printStackTrace();
helpContentCache.put(contextId, EMPTY_DOCUMENTATION);
}
return helpContentCache.get(contextId);
}

private String parseHelp(String contextId) throws Exception {
ContextFileProvider provider = new ContextFileProvider();
IContext context = provider.getContext(contextId, Locale.getDefault()
.toString());
IHelpResource[] relatedTopics = context.getRelatedTopics();
Assert.isTrue(relatedTopics != null);
// We assume that there is only one topic registered
IHelpResource helpResource = relatedTopics[0];
String href = helpResource.getHref().substring(1);
URL url = new URL("platform:/plugin/" + href);
return convertStreamToString(url.openConnection().getInputStream());
}

public String convertStreamToString(InputStream is) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder builder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
is.close();
return builder.toString();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright (c) 2012 committers of YAKINDU 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
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package uw.cs.watform.forml.base.utils.jface.help;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.xtext.resource.IGlobalServiceProvider;
import org.eclipse.xtext.ui.editor.hover.DispatchingEObjectTextHover;
import org.eclipse.xtext.ui.editor.hover.IEObjectHover;
import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider;
import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider.IInformationControlCreatorProvider;

import com.google.inject.Inject;

/**
* Initially copied from {@link DispatchingEObjectTextHover}. This
* implementation bypasses the {@link IGlobalServiceProvider} because there is a
* check to the resource file extensions for cross references.
*
* @author andreas muelder - Initial contribution and API
*
*/
public class CrossRefObjectTextHover extends DispatchingEObjectTextHover implements
IEObjectHover {

private IInformationControlCreatorProvider lastCreatorProvider;
@Inject
private IEObjectHoverProvider hoverProvider;


@Override
public Object getHoverInfo(EObject first, ITextViewer textViewer,
IRegion hoverRegion) {
IInformationControlCreatorProvider creatorProvider = hoverProvider
.getHoverInfo(first, textViewer, hoverRegion);
if (creatorProvider == null)
return null;
this.lastCreatorProvider = creatorProvider;
return lastCreatorProvider.getInfo();
}

@Override
public IInformationControlCreator getHoverControlCreator() {
return this.lastCreatorProvider == null ? null : lastCreatorProvider
.getHoverControlCreator();
}

@Override
@Deprecated
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
final Object hoverInfo2 = getHoverInfo2(textViewer, hoverRegion);
return hoverInfo2 != null ? hoverInfo2.toString() : null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2012 committers of YAKINDU 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
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package uw.cs.watform.forml.base.utils.jface.help;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider;

/**
* Removes the first line, since the documentation already contains a header.
* It also removes the open declaration action
*
* @author andreas muelder - Initial contribution and API
*
*/
public class HelpHoverProvider extends DefaultEObjectHoverProvider {


@Override
protected boolean hasHover(EObject o) {
if (o instanceof Keyword)
return true;
return super.hasHover(o);
}

protected String getHoverInfoAsHtml(EObject o) {
StringBuffer buffer = new StringBuffer();
String documentation = getDocumentation(o);
if (documentation != null && documentation.length() > 0) {
buffer.append(documentation);
}
String hover = buffer.toString();
if (hover == null
|| AbstractUserHelpDocumentationProvider.EMPTY_DOCUMENTATION
.equals(hover))
return null;
return hover;
}


}
Loading

0 comments on commit 632f55c

Please sign in to comment.