You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/03/06 23:33:58 UTC
[02/50] [abbrv] incubator-taverna-workbench git commit: Added ports
to constructor.
Added ports to constructor.
git-svn-id: https://taverna.googlecode.com/svn/taverna/utils/net.sf.taverna.t2.lang/trunk@15898 bf327186-88b3-11dd-a302-d386e5130c1c
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/commit/807910c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/tree/807910c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/diff/807910c1
Branch: refs/heads/master
Commit: 807910c15feac0681663a8185abfdd63ed1362db
Parents: 434e47f
Author: david@mygrid.org.uk <da...@bf327186-88b3-11dd-a302-d386e5130c1c>
Authored: Mon Jul 22 13:48:12 2013 +0000
Committer: david@mygrid.org.uk <da...@bf327186-88b3-11dd-a302-d386e5130c1c>
Committed: Mon Jul 22 13:48:12 2013 +0000
----------------------------------------------------------------------
.../sf/taverna/t2/lang/ui/KeywordDocument.java | 53 +++++++++-----------
1 file changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/807910c1/ui/src/main/java/net/sf/taverna/t2/lang/ui/KeywordDocument.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/net/sf/taverna/t2/lang/ui/KeywordDocument.java b/ui/src/main/java/net/sf/taverna/t2/lang/ui/KeywordDocument.java
index d417457..e8fae14 100644
--- a/ui/src/main/java/net/sf/taverna/t2/lang/ui/KeywordDocument.java
+++ b/ui/src/main/java/net/sf/taverna/t2/lang/ui/KeywordDocument.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Copyright (C) 2009 Ingo Wassink of University of Twente, Netherlands and
- * The University of Manchester
- *
+ * The University of Manchester
+ *
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate.
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,7 +28,6 @@
package net.sf.taverna.t2.lang.ui;
import java.awt.Color;
-import java.util.HashSet;
import java.util.Set;
import javax.swing.text.AttributeSet;
@@ -46,7 +45,7 @@ public class KeywordDocument extends DefaultStyledDocument {
private static Logger logger = Logger
.getLogger(KeywordDocument.class);
-
+
private DefaultStyledDocument doc;
private Element rootElement;
@@ -56,14 +55,14 @@ public class KeywordDocument extends DefaultStyledDocument {
private MutableAttributeSet comment;
private MutableAttributeSet quote;
private MutableAttributeSet port;
-
+
private Set<String> keywords;
-
+
private Set<String> ports;
-
-
- public KeywordDocument(Set<String> keywords) {
+
+
+ public KeywordDocument(Set<String> keywords, Set<String> ports) {
doc = this;
rootElement = doc.getDefaultRootElement();
putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
@@ -78,20 +77,18 @@ public class KeywordDocument extends DefaultStyledDocument {
keyword = new SimpleAttributeSet();
StyleConstants.setForeground(keyword, Color.blue);
StyleConstants.setBold(keyword, true);
-
-
+
+
port = new SimpleAttributeSet();
StyleConstants.setForeground(port, Color.magenta);
quote = new SimpleAttributeSet();
StyleConstants.setForeground(quote, Color.red);
-
+
this.keywords = keywords;
-
-
- ports = new HashSet<String>();
+ this.ports = ports;
}
-
+
/**
* Method for adding an port
* @param name the name of the port
@@ -100,7 +97,7 @@ public class KeywordDocument extends DefaultStyledDocument {
ports.add(name);
updateText();
}
-
+
/**
* Method for removing an port
* @param name the name of the port
@@ -108,8 +105,8 @@ public class KeywordDocument extends DefaultStyledDocument {
public void removePort(String name){
ports.remove(name);
updateText();
- }
-
+ }
+
/**
* Method for checking whether the name represents an input port
* @param name the name of the port
@@ -118,8 +115,8 @@ public class KeywordDocument extends DefaultStyledDocument {
private boolean isPort(String name){
return ports.contains(name);
}
-
-
+
+
/**
* Method for updating the whole text
*/
@@ -142,7 +139,7 @@ public class KeywordDocument extends DefaultStyledDocument {
super.insertString(offset, str, a);
processChangedLines(offset, str.length());
}
-
+
/*
* Override to apply syntax highlighting after the document has been updated
*/
@@ -384,7 +381,7 @@ public class KeywordDocument extends DefaultStyledDocument {
}
/*
- *
+ *
*/
private int getQuoteToken(String content, int startOffset, int endOffset) {
String quoteDelimiter = content.substring(startOffset, startOffset + 1);
@@ -418,7 +415,7 @@ public class KeywordDocument extends DefaultStyledDocument {
}
/*
- *
+ *
*/
private int getOtherToken(String content, int startOffset, int endOffset) {
int endOfToken = startOffset + 1;
@@ -548,7 +545,7 @@ public class KeywordDocument extends DefaultStyledDocument {
}
/*
- *
+ *
*/
protected String addMatchingBrace(int offset) throws BadLocationException {
StringBuffer whiteSpace = new StringBuffer();