Skip to content

Commit

Permalink
Initial contribution per Bug #261590
Browse files Browse the repository at this point in the history
  • Loading branch information
wbeaton committed Mar 13, 2009
0 parents commit 6c36944
Show file tree
Hide file tree
Showing 14 changed files with 773 additions and 0 deletions.
7 changes: 7 additions & 0 deletions org.eclipse.examples.slideshow.text/.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/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions org.eclipse.examples.slideshow.text/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.examples.slideshow.text</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 @@
#Wed Oct 01 22:00:36 EDT 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
13 changes: 13 additions & 0 deletions org.eclipse.examples.slideshow.text/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Slideshow Text Plug-in
Bundle-SymbolicName: org.eclipse.examples.slideshow.text
Bundle-Version: 0.2.0.qualifier
Bundle-Vendor: The Eclipse Foundation
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.examples.slideshow.core;bundle-version="0.1.0"
Import-Package: org.eclipse.core.runtime;version="[3.4.0,4.0.0)",
org.eclipse.mylyn.wikitext.core.parser,
org.eclipse.mylyn.wikitext.core.parser.markup,
org.eclipse.mylyn.wikitext.mediawiki.core
Export-Package: org.eclipse.examples.slideshow.text
28 changes: 28 additions & 0 deletions org.eclipse.examples.slideshow.text/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!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>January 19, 2009</p>
<h3>License</h3>

<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</a>.
For purposes of the EPL, &quot;Program&quot; 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 (&quot;Redistributor&quot;) 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>
4 changes: 4 additions & 0 deletions org.eclipse.examples.slideshow.text/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*******************************************************************************
* Copyright (c) 2009 The Eclipse Foundation.
* 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:
* The Eclipse Foundation - initial API and implementation
*******************************************************************************/
package org.eclipse.examples.slideshow.text;

import org.eclipse.mylyn.wikitext.core.parser.ImageAttributes;
import org.eclipse.mylyn.wikitext.core.parser.ImageAttributes.Align;
import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElement;
import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor;

public class CopyrightToken extends PatternBasedElement {
@Override
protected String getPattern(int groupOffset) {
return "(?:\\{Copyright:([^\\}]*)\\})";
}

@Override
protected int getPatternGroupCount() {
return 1;
}

@Override
protected PatternBasedElementProcessor newProcessor() {
return new PatternBasedElementProcessor() {
@Override
public void emit() {
String message = group(1);
if (builder instanceof SlideDeckDocumentBuilder) {
((SlideDeckDocumentBuilder)builder).copyright(message);
}
}
};
}

private static class ImageReplacementTokenProcessor extends PatternBasedElementProcessor {
@Override
public void emit() {
String imageUrl = group(1);
String optionsString = group(2);

ImageAttributes attributes = new ImageAttributes();
if (optionsString != null) {
String[] options = optionsString.split("\\s*\\|\\s*");
for (String option : options) {
if ("center".equals(option)) {
attributes.setAlign(Align.Middle);
} else if ("left".equals(option)) {
attributes.setAlign(Align.Left);
} else if ("right".equals(option)) {
attributes.setAlign(Align.Right);
} else if ("none".equals(option)) {
attributes.setAlign(null);
} else if ("thumb".equals(option) || "thumbnail".equals(option)) {
// ignore
} else if (option.matches("\\d+px")) {
try {
int size = Integer.parseInt(option.substring(0, option.length() - 2));
attributes.setWidth(size);
attributes.setHeight(size);
} catch (NumberFormatException e) {
// ignore
}
} else if ("frameless".equals(option)) {
attributes.setBorder(0);
} else if ("frame".equals(option)) {
attributes.setBorder(1);
} else {
attributes.setTitle(option);
}
}
}
builder.image(attributes, imageUrl);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright (c) 2009 The Eclipse Foundation.
* 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:
* The Eclipse Foundation - initial API and implementation
*******************************************************************************/
package org.eclipse.examples.slideshow.text;

public interface ISlideDeckDocumentListener {

void slideAdded(SlideAddedEvent event);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright (c) 2009 The Eclipse Foundation.
* 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:
* The Eclipse Foundation - initial API and implementation
*******************************************************************************/
package org.eclipse.examples.slideshow.text;

public interface ISlideParserListener {

void slideAdded(SlideAddedEvent event);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2009 The Eclipse Foundation.
* 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:
* The Eclipse Foundation - initial API and implementation
*******************************************************************************/
package org.eclipse.examples.slideshow.text;

import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElement;
import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor;

public class InsertCodeToken extends PatternBasedElement {

// TODO Add ability to turn on/off line numbers
// TODO Add flag to include Javadoc
// TODO Add flag to suppress all comments
// TODO Add flag to reformat
// TODO Add flag to preserve whitespace
@Override
protected String getPattern(int groupOffset) {
return "(?:\\{Code:([^\\}]*)\\})";
}

@Override
protected int getPatternGroupCount() {
return 1;
}

@Override
protected PatternBasedElementProcessor newProcessor() {
return new PatternBasedElementProcessor() {
@Override
public void emit() {
String url = group(1);
if (builder instanceof SlideDeckDocumentBuilder) {
((SlideDeckDocumentBuilder)builder).codeBlock(url);
}
}
};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2009 The Eclipse Foundation.
* 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:
* The Eclipse Foundation - initial API and implementation
*******************************************************************************/
package org.eclipse.examples.slideshow.text;

import org.eclipse.examples.slideshow.core.Slide;

public class SlideAddedEvent {

public final Slide slide;
public final int lineNumber;

public SlideAddedEvent(Slide slide, int lineNumber) {
this.slide = slide;
this.lineNumber = lineNumber;
}

}
Loading

0 comments on commit 6c36944

Please sign in to comment.