Codebase list eclipse-platform-text / b8a5023
New upstream version 4.9 Emmanuel Bourg 5 years ago
1377 changed file(s) with 14061 addition(s) and 7484 deletion(s). Raw diff Collapse all Expand all
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.core.filebuffers; singleton:=true
4 Bundle-Version: 3.6.200.qualifier
4 Bundle-Version: 3.6.300.qualifier
55 Bundle-Activator: org.eclipse.core.internal.filebuffers.FileBuffersPlugin
66 Bundle-ActivationPolicy: lazy
77 Bundle-Vendor: %providerName
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2006 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.core</groupId>
1919 <artifactId>org.eclipse.core.filebuffers</artifactId>
20 <version>3.6.200-SNAPSHOT</version>
20 <version>3.6.300-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
132132 </appInfo>
133133 <documentation>
134134 Copyright (c) 2001, 2004 IBM Corporation and others.&lt;br&gt;
135 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
135
136 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
137
138 SPDX-License-Identifier: EPL-2.0
136139 </documentation>
137140 </annotation>
138141
146146 </appInfo>
147147 <documentation>
148148 Copyright (c) 2001, 2006 IBM Corporation and others.&lt;br&gt;
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
138138 </appInfo>
139139 <documentation>
140140 Copyright (c) 2001, 2006 IBM Corporation and others.&lt;br&gt;
141 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
141
142 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
143
144 SPDX-License-Identifier: EPL-2.0
142145 </documentation>
143146 </annotation>
144147
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 Symbian Software Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrew Ferguson (Symbian) - Initial implementation - [api] enable document setup participants to customize behaviour based on resource being opened - https://bugs.eclipse.org/bugs/show_bug.cgi?id=208881
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2007 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2007, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1215 import java.util.ArrayList;
1316
1417 import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
18
1519 import org.eclipse.core.runtime.CoreException;
1620 import org.eclipse.core.runtime.IPath;
1721 import org.eclipse.core.runtime.IProgressMonitor;
104108 fThrowable= null;
105109 synchronized (fCompletionLock) {
106110
107 executeInContext(new Runnable() {
108 @Override
109 public void run() {
110 synchronized(fCompletionLock) {
111 try {
112 SafeRunner.run(new ISafeRunnable() {
113 @Override
114 public void handleException(Throwable throwable) {
115 fThrowable= throwable;
116 }
117 @Override
118 public void run() throws Exception {
119 performOperation(synchronizedFileBuffers, operation, subMonitor.split(50));
120 }
121 });
122 } finally {
123 fIsCompleted= true;
124 fCompletionLock.notifyAll();
125 }
111 executeInContext(() -> {
112 synchronized (fCompletionLock) {
113 try {
114 SafeRunner.run(new ISafeRunnable() {
115 @Override
116 public void handleException(Throwable throwable) {
117 fThrowable= throwable;
118 }
119
120 @Override
121 public void run() throws Exception {
122 performOperation(synchronizedFileBuffers, operation, subMonitor.split(50));
123 }
124 });
125 } finally {
126 fIsCompleted= true;
127 fCompletionLock.notifyAll();
126128 }
127129 }
128130 });
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Plugin.name
33 Bundle-SymbolicName: org.eclipse.core.filebuffers.tests;singleton:=true
4 Bundle-Version: 3.11.200.qualifier
4 Bundle-Version: 3.11.300.qualifier
55 Bundle-Activator: org.eclipse.core.filebuffers.tests.FileBuffersTestPlugin
66 Bundle-ActivationPolicy: lazy
77 Bundle-Vendor: %Plugin.providerName
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.core</groupId>
2020 <artifactId>org.eclipse.core.filebuffers.tests</artifactId>
21 <version>3.11.200-SNAPSHOT</version>
21 <version>3.11.300-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2008 Symbian Software Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrew Ferguson (Symbian) - Initial implementation - [api] enable document setup participants to customize behaviour based on resource being opened - https://bugs.eclipse.org/bugs/show_bug.cgi?id=208881
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2225
2326 import org.junit.After;
2427 import org.junit.Before;
28 import org.junit.Rule;
2529 import org.junit.Test;
30 import org.junit.rules.TestWatcher;
31 import org.junit.runner.Description;
2632
2733 import org.eclipse.core.filesystem.EFS;
2834 import org.eclipse.core.filesystem.IFileInfo;
2935 import org.eclipse.core.filesystem.IFileStore;
3036
37 import org.eclipse.core.runtime.ILog;
3138 import org.eclipse.core.runtime.IPath;
39 import org.eclipse.core.runtime.IStatus;
3240 import org.eclipse.core.runtime.Path;
41 import org.eclipse.core.runtime.Platform;
42 import org.eclipse.core.runtime.Status;
3343
3444 import org.eclipse.core.resources.IProject;
3545
90100
91101 protected IPath getPath() {
92102 return fPath;
103 }
104
105 @Rule
106 public TestFailReporter failReporter= new TestFailReporter();
107
108 public class TestFailReporter extends TestWatcher {
109
110 private static final String BUNDLE_ID= "org.eclipse.core.filebuffers.tests";
111
112 ILog log= Platform.getLog(Platform.getBundle(BUNDLE_ID));
113
114 @Override
115 protected void failed(Throwable e, Description description) {
116 IStatus status= new Status(IStatus.ERROR, BUNDLE_ID, "FAIL in " + description.toString(), e);
117 log.log(status);
118 }
119
120 @Override
121 protected void succeeded(Description description) {
122 IStatus status= new Status(IStatus.INFO, BUNDLE_ID, "PASS in " + description.toString());
123 log.log(status);
124 }
93125 }
94126
95127 /*
376408
377409 fManager.connect(fPath, LocationKind.NORMALIZE, null);
378410
379 assertTrue(listener.count == 1);
411 assertEquals(1, listener.count);
380412 assertNotNull(listener.buffer);
381413 IFileBuffer fileBuffer= fManager.getFileBuffer(fPath, LocationKind.NORMALIZE);
382 assertTrue(listener.buffer == fileBuffer);
383
384 fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
385 assertTrue(listener.count == 0);
386 assertTrue(listener.buffer == fileBuffer);
414 assertSame(fileBuffer, listener.buffer);
415
416 fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
417 assertEquals(0, listener.count);
418 assertSame(fileBuffer, listener.buffer);
387419
388420 } finally {
389421 try {
427459 IDocument document= fileBuffer.getDocument();
428460 document.replace(0, 0, "prefix");
429461
430 assertTrue(listener.count == 1);
431 assertTrue(listener.buffer == fileBuffer);
462 assertEquals(1, listener.count);
463 assertSame(fileBuffer, listener.buffer);
432464 assertTrue(listener.isDirty);
433465
434466 fileBuffer.commit(null, true);
435467
436 assertTrue(listener.count == 2);
437 assertTrue(listener.buffer == fileBuffer);
468 assertEquals(2, listener.count);
469 assertSame(fileBuffer, listener.buffer);
438470 assertFalse(listener.isDirty);
439471
440472 } finally {
478510 IDocument document= fileBuffer.getDocument();
479511 document.replace(0, 0, "prefix");
480512
481 assertTrue(listener.count == 1);
482 assertTrue(listener.buffer == fileBuffer);
513 assertEquals(1, listener.count);
514 assertSame(fileBuffer, listener.buffer);
483515 assertTrue(listener.isDirty);
484516
485517 fileBuffer.revert(null);
486518
487 assertTrue(listener.count == 2);
488 assertTrue(listener.buffer == fileBuffer);
519 assertEquals(2, listener.count);
520 assertSame(fileBuffer, listener.buffer);
489521 assertFalse(listener.isDirty);
490522
491523 } finally {
535567
536568 fileBuffer.revert(null);
537569
538 assertTrue(listener.preCount == 1);
539 assertTrue(listener.preBuffer == fileBuffer);
540 assertTrue(listener.postCount == 1);
541 assertTrue(listener.postBuffer == fileBuffer);
570 assertEquals(1, listener.preCount);
571 assertSame(fileBuffer, listener.preBuffer);
572 assertEquals(1, listener.postCount);
573 assertSame(fileBuffer, listener.postBuffer);
542574
543575 } finally {
544576 fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
584616 fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
585617
586618 if (modifyUnderlyingFile()) {
587 assertTrue(listener.preCount == 1);
588 assertTrue(listener.preBuffer == fileBuffer);
589 assertTrue(listener.postCount == 1);
590 assertTrue(listener.postBuffer == fileBuffer);
619 assertEquals(1, listener.preCount);
620 assertSame(fileBuffer, listener.preBuffer);
621 assertEquals(1, listener.postCount);
622 assertSame(fileBuffer, listener.postBuffer);
591623 }
592624
593625 } finally {
631663 fileBuffer.validateState(null, null);
632664
633665 if (isStateValidationSupported()) {
634 assertTrue(listener.count == 1);
635 assertTrue(listener.buffer == fileBuffer);
666 assertEquals(1, listener.count);
667 assertSame(fileBuffer, listener.buffer);
636668 assertTrue(listener.isStateValidated);
637669 }
638670
678710 fileBuffer.validateState(null, null);
679711
680712 if (isStateValidationSupported()) {
681 assertTrue(listener.count == 1);
682 assertTrue(listener.buffer == fileBuffer);
713 assertEquals(1, listener.count);
714 assertSame(fileBuffer, listener.buffer);
683715 assertTrue(listener.isStateValidated);
684716 }
685717
725757 fileBuffer.resetStateValidation();
726758
727759 if (isStateValidationSupported()) {
728 assertTrue(listener.count == 2);
729 assertTrue(listener.buffer == fileBuffer);
760 assertEquals(2, listener.count);
761 assertSame(fileBuffer, listener.buffer);
730762 assertFalse(listener.isStateValidated);
731763 }
732764
773805 fileBuffer.resetStateValidation();
774806
775807 if (isStateValidationSupported()) {
776 assertTrue(listener.count == 2);
777 assertTrue(listener.buffer == fileBuffer);
808 assertEquals(2, listener.count);
809 assertSame(fileBuffer, listener.buffer);
778810 assertFalse(listener.isStateValidated);
779811 }
780812
816848
817849 fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
818850 if (deleteUnderlyingFile()) {
819 assertTrue(listener.count == 1);
820 assertTrue(listener.buffer == fileBuffer);
851 assertEquals(1, listener.count);
852 assertSame(fileBuffer, listener.buffer);
821853 }
822854
823855 } finally {
953985
954986 fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
955987 if (deleteUnderlyingFile()) {
956 assertTrue(listener.count == 1);
957 assertTrue(listener.buffer == fileBuffer);
988 assertEquals(1, listener.count);
989 assertSame(fileBuffer, listener.buffer);
958990 }
959991
960992 } finally {
9941026
9951027 fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
9961028 if (moveUnderlyingFile() != null) {
997 assertTrue(listener.count == 1);
998 assertTrue(listener.buffer == fileBuffer);
1029 assertEquals(1, listener.count);
1030 assertSame(fileBuffer, listener.buffer);
9991031 }
10001032
10011033 } finally {
10371069 fileBuffer.validateState(null, null);
10381070
10391071 if (isStateValidationSupported()) {
1040 assertTrue(listener.count == 1);
1041 assertTrue(listener.buffer == fileBuffer);
1072 assertEquals(1, listener.count);
1073 assertSame(fileBuffer, listener.buffer);
10421074 }
10431075
10441076 } finally {
10801112 document.replace(0, 0, "prefix");
10811113 fileBuffer.revert(null);
10821114
1083 assertTrue(listener.count == 1);
1084 assertTrue(listener.buffer == fileBuffer);
1115 assertEquals(1, listener.count);
1116 assertSame(fileBuffer, listener.buffer);
10851117
10861118 } finally {
10871119 fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
11231155 document.replace(0, 0, "prefix");
11241156 fileBuffer.commit(null, true);
11251157
1126 assertTrue(listener.count == 1);
1127 assertTrue(listener.buffer == fileBuffer);
1158 assertEquals(1, listener.count);
1159 assertSame(fileBuffer, listener.buffer);
11281160
11291161 } finally {
11301162 fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
109112 protected boolean modifyUnderlyingFile() throws Exception {
110113 IFileStore fileStore= FileBuffers.getFileStoreAtLocation(getPath());
111114 assertTrue(fileStore.fetchInfo().exists());
112 OutputStream out= fileStore.openOutputStream(EFS.NONE, null);
113 try {
115 try (OutputStream out= fileStore.openOutputStream(EFS.NONE, null)) {
114116 out.write("Changed content of file in linked folder".getBytes());
115117 out.flush();
116118 } catch (IOException x) {
117119 fail();
118 } finally {
119 out.close();
120120 }
121121 IFileInfo fileInfo= fileStore.fetchInfo();
122122 fileInfo.setLastModified(1000);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
8891 protected boolean modifyUnderlyingFile() throws Exception {
8992 IFileStore fileStore= FileBuffers.getFileStoreAtLocation(getPath());
9093 assertTrue(fileStore.fetchInfo().exists());
91 OutputStream out= fileStore.openOutputStream(EFS.NONE, null);
92 try {
94 try (OutputStream out= fileStore.openOutputStream(EFS.NONE, null)) {
9395 out.write("Changed content of workspace file".getBytes());
9496 out.flush();
9597 } catch (IOException x) {
9698 fail();
97 } finally {
98 out.close();
9999 }
100100 IFileInfo fileInfo= fileStore.fetchInfo();
101101 fileInfo.setLastModified(1000);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2007, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
8891 protected boolean modifyUnderlyingFile() throws Exception {
8992 IFileStore fileStore= FileBuffers.getFileStoreAtLocation(getPath());
9093 assertTrue(fileStore.fetchInfo().exists());
91 OutputStream out= fileStore.openOutputStream(EFS.NONE, null);
92 try {
94 try (OutputStream out= fileStore.openOutputStream(EFS.NONE, null)) {
9395 out.write("Changed content of workspace file".getBytes());
9496 out.flush();
9597 } catch (IOException x) {
9698 fail();
97 } finally {
98 out.close();
9999 }
100100 IFileInfo fileInfo= fileStore.fetchInfo();
101101 fileInfo.setLastModified(1000);
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
101104 */
102105 public static void transferData(File source, File destination) throws IOException {
103106 destination.getParentFile().mkdirs();
104 InputStream is = null;
105 OutputStream os = null;
106 try {
107 is = new FileInputStream(source);
108 os = new FileOutputStream(destination);
107 try (InputStream is= new FileInputStream(source);
108 OutputStream os= new FileOutputStream(destination)) {
109109 transferData(is, os);
110 } finally {
111 if(os != null)
112 os.close();
113 if(is != null)
114 is.close();
115110 }
116111 }
117112
195190 }
196191
197192 public static void write(String fileName, StringBuffer content) throws IOException {
198 Writer writer= new FileWriter(fileName);
199 try {
193 try (Writer writer= new FileWriter(fileName)) {
200194 writer.write(content.toString());
201 } finally {
202 try {
203 writer.close();
204 } catch (IOException e) {
205 }
206195 }
207196 }
208197
00 /*******************************************************************************
11 * Copyright (c) 2008 Symbian Software Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrew Ferguson (Symbian) - Initial implementation - [api] enable document setup participants to customize behaviour based on resource being opened - https://bugs.eclipse.org/bugs/show_bug.cgi?id=208881
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 Symbian Software Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrew Ferguson (Symbian) - Initial implementation - [api] enable document setup participants to customize behaviour based on resource being opened - https://bugs.eclipse.org/bugs/show_bug.cgi?id=208881
00 /*******************************************************************************
11 * Copyright (c) 2008 Symbian Software Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrew Ferguson (Symbian) - Initial implementation - [api] enable document setup participants to customize behaviour based on resource being opened - https://bugs.eclipse.org/bugs/show_bug.cgi?id=208881
77 </message_arguments>
88 </filter>
99 </resource>
10 <resource path="src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java" type="org.eclipse.jface.text.templates.persistence.TemplatePersistenceData">
11 <filter comment="Extended to prevent API breakage" id="571473929">
12 <message_arguments>
13 <message_argument value="TemplatePersistenceData"/>
14 <message_argument value="TemplatePersistenceData"/>
15 </message_arguments>
16 </filter>
17 </resource>
18 <resource path="src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java" type="org.eclipse.jface.text.templates.persistence.TemplateReaderWriter">
19 <filter comment="Extended to prevent API breakage" id="571473929">
20 <message_arguments>
21 <message_argument value="TemplateReaderWriter"/>
22 <message_argument value="TemplateReaderWriter"/>
23 </message_arguments>
24 </filter>
25 </resource>
1026 </component>
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.jface.text
4 Bundle-Version: 3.13.0.qualifier
4 Bundle-Version: 3.14.0.qualifier
55 Bundle-Vendor: %providerName
66 Bundle-Localization: plugin
77 Export-Package:
99 org.eclipse.jface.contentassist.images,
1010 org.eclipse.jface.internal.text;x-internal:=true,
1111 org.eclipse.jface.internal.text.codemining;x-internal:=true,
12 org.eclipse.jface.internal.text.html;x-friends:="org.eclipse.ui.workbench.texteditor, org.eclipse.ui.editors, org.eclipse.jdt.debug.ui, org.eclipse.jdt.ui, org.eclipse.ant.ui, org.eclipse.ltk.ui.refactoring, org.eclipse.pde.ui, org.eclipse.xtext.ui",
12 org.eclipse.jface.internal.text.html;x-friends:="org.eclipse.ant.ui, org.eclipse.jdt.ui, org.eclipse.ltk.ui.refactoring, org.eclipse.pde.ui, org.eclipse.ui.editors, org.eclipse.xtext.ui",
1313 org.eclipse.jface.internal.text.link.contentassist;x-internal:=true,
1414 org.eclipse.jface.internal.text.revisions;x-internal:=true,
1515 org.eclipse.jface.internal.text.source;x-internal:=true,
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.jface</groupId>
1919 <artifactId>org.eclipse.jface.text</artifactId>
20 <version>3.13.0-SNAPSHOT</version>
20 <version>3.14.0-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
110113 // height: height of the box
111114 int height= ascent + descent;
112115
113 int width= metrics.getAverageCharWidth();
114 gc.drawRectangle(p.x, p.y + leading, width, height);
115 int third= width/3;
116 double width= metrics.getAverageCharacterWidth();
117 gc.drawRectangle(p.x, p.y + leading, (int) width, height);
118 int third= (int) (width / 3);
116119 int dotsVertical= p.y + baseline - 1;
117120 gc.drawPoint(p.x + third, dotsVertical);
118 gc.drawPoint(p.x + width - third, dotsVertical);
121 gc.drawPoint((int) (p.x + width - third), dotsVertical);
119122
120123 gc.setForeground(c);
121124
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
873876 if (widget != null) {
874877 Display display= widget.getDisplay();
875878 if (display != null) {
876 display.asyncExec(new Runnable() {
877 @Override
878 public void run() {
879 display.asyncExec(() -> {
880 try {
881 while (true) {
882 AnnotationModelEvent ame= null;
883 synchronized (fLock) {
884 if (fPendingRequests.size() == 0)
885 return;
886 ame= fPendingRequests.remove(0);
887 }
888 catchupWithProjectionAnnotationModel(ame);
889 }
890 } catch (BadLocationException x) {
879891 try {
880 while (true) {
881 AnnotationModelEvent ame= null;
882 synchronized (fLock) {
883 if (fPendingRequests.size() == 0)
884 return;
885 ame= fPendingRequests.remove(0);
886 }
887 catchupWithProjectionAnnotationModel(ame);
888 }
889 } catch (BadLocationException x) {
890 try {
891 catchupWithProjectionAnnotationModel(null);
892 } catch (BadLocationException x1) {
893 throw new IllegalArgumentException();
894 } finally {
895 synchronized (fLock) {
896 fPendingRequests.clear();
897 }
892 catchupWithProjectionAnnotationModel(null);
893 } catch (BadLocationException x1) {
894 throw new IllegalArgumentException();
895 } finally {
896 synchronized (fLock) {
897 fPendingRequests.clear();
898898 }
899899 }
900900 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
408411 public Point computeSizeConstraints(int widthInChars, int heightInChars) {
409412 GC gc= new GC(fText);
410413 gc.setFont(fTextFont);
411 int width= gc.getFontMetrics().getAverageCharWidth();
414 double width= gc.getFontMetrics().getAverageCharacterWidth();
412415 int height= fText.getLineHeight();
413416 gc.dispose();
414417
415 return new Point (widthInChars * width, heightInChars * height);
418 return new Point((int) (widthInChars * width), heightInChars * height);
416419 }
417420 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1619
1720 import org.eclipse.swt.SWT;
1821 import org.eclipse.swt.custom.VerifyKeyListener;
19 import org.eclipse.swt.events.DisposeEvent;
20 import org.eclipse.swt.events.DisposeListener;
2122 import org.eclipse.swt.events.KeyEvent;
2223 import org.eclipse.swt.events.KeyListener;
2324 import org.eclipse.swt.events.VerifyEvent;
326327 } else {
327328 if (fControlDecoration == null) {
328329 fControlDecoration= new ControlDecoration(getControl(), (SWT.TOP | SWT.LEFT));
329 getControl().addDisposeListener(new DisposeListener() {
330 @Override
331 public void widgetDisposed(DisposeEvent e) {
332 if (fCueLabelProvider != null) {
333 fCueLabelProvider.dispose();
334 fCueLabelProvider= null;
335 }
336 if (fControlDecoration != null) {
337 fControlDecoration.dispose();
338 fControlDecoration= null;
339 }
340 if (fCachedDefaultCueImage != null) {
341 fCachedDefaultCueImage.dispose();
342 fCachedDefaultCueImage= null;
343 }
330 getControl().addDisposeListener(e -> {
331 if (fCueLabelProvider != null) {
332 fCueLabelProvider.dispose();
333 fCueLabelProvider= null;
334 }
335 if (fControlDecoration != null) {
336 fControlDecoration.dispose();
337 fControlDecoration= null;
338 }
339 if (fCachedDefaultCueImage != null) {
340 fCachedDefaultCueImage.dispose();
341 fCachedDefaultCueImage= null;
344342 }
345343 });
346344 fControlDecoration.setShowHover(true);
347345 fControlDecoration.setShowOnlyOnFocus(true);
348346 }
349347
350 ILabelProviderListener listener= new ILabelProviderListener() {
351 @Override
352 public void labelProviderChanged(LabelProviderChangedEvent event) {
353 fControlDecoration.setDescriptionText(labelProvider.getText(getControl()));
354 Image image= labelProvider.getImage(getControl());
355 if (image == null)
356 image= getDefaultCueImage();
357 fControlDecoration.setImage(image);
358 }
348 ILabelProviderListener listener= event -> {
349 fControlDecoration.setDescriptionText(labelProvider.getText(getControl()));
350 Image image= labelProvider.getImage(getControl());
351 if (image == null)
352 image= getDefaultCueImage();
353 fControlDecoration.setImage(image);
359354 };
360355 labelProvider.addListener(listener);
361356 //initialize control decoration:
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009, 2012 Avaloq Evolution AG and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Tom Eicher (Avaloq Evolution AG) - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2007, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
192195 public void focusLost(FocusEvent e) {
193196 if (DEBUG) System.out.println("StickyHoverManager.Closer.focusLost(): " + e); //$NON-NLS-1$
194197 Display d= fSubjectControl.getDisplay();
195 d.asyncExec(new Runnable() {
196 // Without the asyncExec, mouse clicks to the workbench window are swallowed.
197 @Override
198 public void run() {
199 hideInformationControl();
200 }
201 });
198 // Without the asyncExec, mouse clicks to the workbench window are swallowed.
199 d.asyncExec(() -> hideInformationControl());
202200 }
203201
204202 @Override
00 /*******************************************************************************
11 * Copyright (c) 2008, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2018, Angelo ZERR and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] CodeMining should support line header/content annotation type both - Bug 529115
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1720 import org.eclipse.swt.SWTError;
1821 import org.eclipse.swt.browser.Browser;
1922 import org.eclipse.swt.browser.LocationListener;
20 import org.eclipse.swt.browser.OpenWindowListener;
2123 import org.eclipse.swt.browser.ProgressAdapter;
2224 import org.eclipse.swt.browser.ProgressEvent;
23 import org.eclipse.swt.browser.WindowEvent;
2425 import org.eclipse.swt.custom.StyleRange;
2526 import org.eclipse.swt.graphics.Color;
2627 import org.eclipse.swt.graphics.Font;
225226 fCompleted= true;
226227 }
227228 });
228
229 fBrowser.addOpenWindowListener(new OpenWindowListener() {
230 @Override
231 public void open(WindowEvent event) {
232 event.required= true; // Cancel opening of new windows
233 }
234 });
229 // Cancel opening of new windows
230 fBrowser.addOpenWindowListener(event -> event.required= true);
235231
236232 // Replace browser's built-in context menu with none
237233 fBrowser.setMenu(new Menu(getShell(), SWT.NONE));
343339 final Display display= shell.getDisplay();
344340
345341 // Make sure the display wakes from sleep after timeout:
346 display.timerExec(100, new Runnable() {
347 @Override
348 public void run() {
349 fCompleted= true;
350 }
351 });
342 display.timerExec(100, () -> fCompleted= true);
352343
353344 while (!fCompleted) {
354345 // Drive the event loop to process the events required to load the browser widget's contents:
591582 GC gc= new GC(fBrowser);
592583 Font font= JFaceResources.getFont(fSymbolicFontName);
593584 gc.setFont(font);
594 int width= gc.getFontMetrics().getAverageCharWidth();
585 double width= gc.getFontMetrics().getAverageCharacterWidth();
595586 int height= gc.getFontMetrics().getHeight();
596587 gc.dispose();
597588
598 return new Point(widthInChars * width, heightInChars * height);
589 return new Point((int) (widthInChars * width), heightInChars * height);
599590 }
600591
601592 }
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2006 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
4851 final Display display= Display.getDefault();
4952 if (display != null && !display.isDisposed()) {
5053 try {
51 display.asyncExec(new Runnable() {
52 @Override
53 public void run() {
54 cacheColors(display);
55 installColorUpdater(display);
56 }
54 display.asyncExec(() -> {
55 cacheColors(display);
56 installColorUpdater(display);
5757 });
5858 } catch (SWTError err) {
5959 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=45294
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
5356 protected void adaptTextPresentation(TextPresentation presentation, int offset, int insertLength) {
5457
5558 int yoursStart= offset;
56 int yoursEnd= offset + insertLength -1;
57 yoursEnd= Math.max(yoursStart, yoursEnd);
5859
5960 Iterator<StyleRange> e= presentation.getAllStyleRangeIterator();
6061 while (e.hasNext()) {
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
158161 }
159162
160163 if (fProposalTable != null && !fProposalTable.isDisposed()) {
161 fProposalTable.getDisplay().asyncExec(new Runnable() {
162 @Override
163 public void run() {
164 if (!fIsReset)
165 showInformation();
166 }
164 fProposalTable.getDisplay().asyncExec(() -> {
165 if (!fIsReset)
166 showInformation();
167167 });
168168 }
169169
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1821 import org.eclipse.swt.custom.StyledText;
1922 import org.eclipse.swt.events.ControlEvent;
2023 import org.eclipse.swt.events.ControlListener;
21 import org.eclipse.swt.events.DisposeEvent;
22 import org.eclipse.swt.events.DisposeListener;
2324 import org.eclipse.swt.events.KeyEvent;
2425 import org.eclipse.swt.events.KeyListener;
2526 import org.eclipse.swt.events.SelectionEvent;
341342 });
342343
343344 fPopupCloser.install(fContentAssistant, fProposalTable);
344
345 fProposalShell.addDisposeListener(new DisposeListener() {
346 @Override
347 public void widgetDisposed(DisposeEvent e) {
348 unregister(); // but don't dispose the shell, since we're being called from its disposal event!
349 }
350 });
345 // but don't dispose the shell, since we're being called from its disposal event!
346 fProposalShell.addDisposeListener(e -> unregister());
351347
352348 fProposalTable.setHeaderVisible(false);
353349 fContentAssistant.addToLayout(this, fProposalShell, ContentAssistant2.LayoutManager.LAYOUT_PROPOSAL_SELECTOR, fContentAssistant.getSelectionOffset());
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
4447 import org.eclipse.jface.text.BadLocationException;
4548 import org.eclipse.jface.text.DefaultInformationControl;
4649 import org.eclipse.jface.text.IEventConsumer;
47 import org.eclipse.jface.text.IInformationControl;
4850 import org.eclipse.jface.text.IInformationControlCreator;
4951 import org.eclipse.jface.text.ITextViewer;
5052 import org.eclipse.jface.text.ITextViewerExtension;
167169 if (control != null) {
168170 Display d= control.getDisplay();
169171 if (d != null) {
170 d.asyncExec(new Runnable() {
171 @Override
172 public void run() {
173 if (!hasFocus())
174 hide();
175 }
172 d.asyncExec(() -> {
173 if (!hasFocus())
174 hide();
176175 });
177176 }
178177 }
307306 Display d= control.getDisplay();
308307 if (d != null) {
309308 try {
310 d.syncExec(new Runnable() {
311 @Override
312 public void run() {
313 if (showStyle == SHOW_PROPOSALS)
314 fProposalPopup.showProposals(true);
315 else if (showStyle == SHOW_CONTEXT_INFO)
316 fContextInfoPopup.showContextProposals(true);
317 }
309 d.syncExec(() -> {
310 if (showStyle == SHOW_PROPOSALS)
311 fProposalPopup.showProposals(true);
312 else if (showStyle == SHOW_CONTEXT_INFO)
313 fContextInfoPopup.showContextProposals(true);
318314 });
319315 } catch (SWTError e) {
320316 }
727723 * @return an <code>IInformationControlCreator</code> to be used to display context information
728724 */
729725 private IInformationControlCreator getInformationControlCreator() {
730 return new IInformationControlCreator() {
731 @Override
732 public IInformationControl createInformationControl(Shell parent) {
733 return new DefaultInformationControl(parent, false);
734 }
735 };
726 return parent -> new DefaultInformationControl(parent, false);
736727 }
737728
738729 /**
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
105108 */
106109 public String showContextProposals(final boolean autoActivated) {
107110 final StyledText styledText= fViewer.getTextWidget();
108 BusyIndicator.showWhile(styledText.getDisplay(), new Runnable() {
109 @Override
110 public void run() {
111
112 int position= fViewer.getSelectedRange().x;
113
114 IContextInformation[] contexts= computeContextInformation(position);
115 int count = (contexts == null ? 0 : contexts.length);
116 if (count == 1) {
117
118 // Show context information directly
119 internalShowContextInfo(contexts[0], position);
120
121 } else if (count > 0) {
122 // Precise context must be selected
123
124 if (fLineDelimiter == null)
125 fLineDelimiter= styledText.getLineDelimiter();
126
127 createContextSelector();
128 setContexts(contexts);
129 displayContextSelector();
130 hideContextInfoPopup();
131 }
111 BusyIndicator.showWhile(styledText.getDisplay(), () -> {
112
113 int position= fViewer.getSelectedRange().x;
114
115 IContextInformation[] contexts= computeContextInformation(position);
116 int count= (contexts == null ? 0 : contexts.length);
117 if (count == 1) {
118
119 // Show context information directly
120 internalShowContextInfo(contexts[0], position);
121
122 } else if (count > 0) {
123 // Precise context must be selected
124
125 if (fLineDelimiter == null)
126 fLineDelimiter= styledText.getLineDelimiter();
127
128 createContextSelector();
129 setContexts(contexts);
130 displayContextSelector();
131 hideContextInfoPopup();
132132 }
133133 });
134134
144144 */
145145 public void showContextInformation(final IContextInformation info, final int position) {
146146 Control control= fViewer.getTextWidget();
147 BusyIndicator.showWhile(control.getDisplay(), new Runnable() {
148 @Override
149 public void run() {
150 internalShowContextInfo(info, position);
151 hideContextSelector();
152 }
147 BusyIndicator.showWhile(control.getDisplay(), () -> {
148 internalShowContextInfo(info, position);
149 hideContextSelector();
153150 });
154151 }
155152
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
9699 public void focusLost(final FocusEvent e) {
97100 fScrollbarClicked= false;
98101 Display d= fTable.getDisplay();
99 d.asyncExec(new Runnable() {
100 @Override
101 public void run() {
102 if (Helper2.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked && fContentAssistant != null)
103 fContentAssistant.popupFocusLost(e);
104 }
102 d.asyncExec(() -> {
103 if (Helper2.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked && fContentAssistant != null)
104 fContentAssistant.popupFocusLost(e);
105105 });
106106 }
107107
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2006, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2006, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2023
2124 import org.eclipse.swt.SWT;
2225 import org.eclipse.swt.custom.StyledText;
23 import org.eclipse.swt.events.DisposeEvent;
24 import org.eclipse.swt.events.DisposeListener;
2526 import org.eclipse.swt.events.MouseEvent;
2627 import org.eclipse.swt.events.MouseMoveListener;
2728 import org.eclipse.swt.events.MouseTrackListener;
739740 fControl.addMouseMoveListener(fMouseHandler);
740741 fControl.addListener(SWT.MouseUp, fMouseHandler);
741742 fControl.addListener(SWT.MouseDown, fMouseHandler);
742 fControl.addDisposeListener(new DisposeListener() {
743 @Override
744 public void widgetDisposed(DisposeEvent e) {
745 handleDispose();
746 }
747 });
743 fControl.addDisposeListener(e -> handleDispose());
748744
749745 fRevisionSelectionProvider.install(fViewer);
750746 }
13501346 if (isConnected() && !fControl.isDisposed()) {
13511347 Display d= fControl.getDisplay();
13521348 if (d != null) {
1353 d.asyncExec(new Runnable() {
1354 @Override
1355 public void run() {
1356 redraw();
1357 }
1358 });
1349 d.asyncExec(() -> redraw());
13591350 }
13601351 }
13611352 }
00 /*******************************************************************************
11 * Copyright (c) 2006, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2006, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2006, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1114
1215 import org.eclipse.swt.SWT;
1316 import org.eclipse.swt.custom.StyledText;
14 import org.eclipse.swt.events.DisposeEvent;
15 import org.eclipse.swt.events.DisposeListener;
1617 import org.eclipse.swt.graphics.Color;
1718 import org.eclipse.swt.graphics.GC;
1819 import org.eclipse.swt.graphics.RGB;
195196 if (fControl == null)
196197 return;
197198
198 fControl.addDisposeListener(new DisposeListener() {
199 @Override
200 public void widgetDisposed(DisposeEvent e) {
201 handleDispose();
202 }
203 });
199 fControl.addDisposeListener(e -> handleDispose());
204200 }
205201
206202 /**
380376 if (isConnected() && !fControl.isDisposed()) {
381377 Display d= fControl.getDisplay();
382378 if (d != null) {
383 d.asyncExec(new Runnable() {
384 @Override
385 public void run() {
386 redraw();
387 }
388 });
379 d.asyncExec(() -> redraw());
389380 }
390381 }
391382 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
285288 final IInputChangedListener inputChangeListener= new DelayedInputChangeListener(delayedICP, getInformationControlReplacer());
286289 delayedICP.setDelayedInputChangeListener(inputChangeListener);
287290 // cancel automatic input updating after a small timeout:
288 control.getShell().getDisplay().timerExec(1000, new Runnable() {
289 @Override
290 public void run() {
291 delayedICP.setDelayedInputChangeListener(null);
292 }
293 });
291 control.getShell().getDisplay().timerExec(1000, () -> delayedICP.setDelayedInputChangeListener(null));
294292 }
295293
296294 // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 :
297 control.getShell().getDisplay().asyncExec(new Runnable() {
298 @Override
299 public void run() {
300 replaceInformationControl(true);
301 }
302 });
295 control.getShell().getDisplay().asyncExec(() -> replaceInformationControl(true));
303296 } else {
304297 fWaitForMouseUp= true;
305298 }
854847 if (monitor.isCanceled() || display.isDisposed()) {
855848 return Status.CANCEL_STATUS;
856849 }
857 display.syncExec(new Runnable() {
858 @Override
859 public void run() {
860 fReplacingDelayJob= null;
861 if (monitor.isCanceled())
862 return;
863 if (! fWaitForMouseUp)
864 replaceInformationControl(false);
865 }
850 display.syncExec(() -> {
851 fReplacingDelayJob= null;
852 if (monitor.isCanceled())
853 return;
854 if (!fWaitForMouseUp)
855 replaceInformationControl(false);
866856 });
867857 return Status.OK_STATUS;
868858 }
00 /*******************************************************************************
1 * Copyright (c) 2008, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2008, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1013 package org.eclipse.jface.text;
1114
1215 import org.eclipse.swt.SWT;
13 import org.eclipse.swt.events.DisposeEvent;
1416 import org.eclipse.swt.events.DisposeListener;
1517 import org.eclipse.swt.events.FocusEvent;
1618 import org.eclipse.swt.events.FocusListener;
1719 import org.eclipse.swt.events.MouseAdapter;
1820 import org.eclipse.swt.events.MouseEvent;
1921 import org.eclipse.swt.events.MouseMoveListener;
20 import org.eclipse.swt.events.PaintEvent;
21 import org.eclipse.swt.events.PaintListener;
2222 import org.eclipse.swt.graphics.Color;
2323 import org.eclipse.swt.graphics.Font;
2424 import org.eclipse.swt.graphics.FontData;
3232 import org.eclipse.swt.widgets.Composite;
3333 import org.eclipse.swt.widgets.Control;
3434 import org.eclipse.swt.widgets.Display;
35 import org.eclipse.swt.widgets.Event;
3635 import org.eclipse.swt.widgets.Label;
3736 import org.eclipse.swt.widgets.Listener;
3837 import org.eclipse.swt.widgets.Shell;
199198
200199 createStatusComposite(statusFieldText, toolBarManager, foreground, background);
201200
202 addDisposeListener(new DisposeListener() {
203 @Override
204 public void widgetDisposed(DisposeEvent e) {
205 handleDispose();
206 }
207 });
201 addDisposeListener(e -> handleDispose());
208202
209203 }
210204
289283 data.widthHint= size;
290284 data.heightHint= size;
291285 resizer.setLayoutData(data);
292 resizer.addPaintListener(new PaintListener() {
293 @Override
294 public void paintControl(PaintEvent e) {
295 Point s= resizer.getSize();
296 int x= s.x - 2;
297 int y= s.y - 2;
298 int min= Math.min(x, y);
299 if (isWin) {
300 // draw dots
301 e.gc.setBackground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
302 int end= min - 1;
303 for (int i= 0; i <= 2; i++)
304 for (int j= 0; j <= 2 - i; j++)
305 e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2);
306 end--;
307 e.gc.setBackground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
308 for (int i= 0; i <= 2; i++)
309 for (int j= 0; j <= 2 - i; j++)
310 e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2);
311
312 } else {
313 // draw diagonal lines
314 e.gc.setForeground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
315 for (int i= 1; i < min; i+= 4) {
316 e.gc.drawLine(i, y, x, i);
317 }
318 e.gc.setForeground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
319 for (int i= 2; i < min; i+= 4) {
320 e.gc.drawLine(i, y, x, i);
321 }
286 resizer.addPaintListener(e -> {
287 Point s= resizer.getSize();
288 int x= s.x - 2;
289 int y= s.y - 2;
290 int min= Math.min(x, y);
291 if (isWin) {
292 // draw dots
293 e.gc.setBackground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
294 int end= min - 1;
295 for (int i1= 0; i1 <= 2; i1++)
296 for (int j1= 0; j1 <= 2 - i1; j1++)
297 e.gc.fillRectangle(end - 4 * i1, end - 4 * j1, 2, 2);
298 end--;
299 e.gc.setBackground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
300 for (int i2= 0; i2 <= 2; i2++)
301 for (int j2= 0; j2 <= 2 - i2; j2++)
302 e.gc.fillRectangle(end - 4 * i2, end - 4 * j2, 2, 2);
303
304 } else {
305 // draw diagonal lines
306 e.gc.setForeground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
307 for (int i3= 1; i3 < min; i3+= 4) {
308 e.gc.drawLine(i3, y, x, i3);
309 }
310 e.gc.setForeground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
311 for (int i4= 2; i4 < min; i4+= 4) {
312 e.gc.drawLine(i4, y, x, i4);
322313 }
323314 }
324315 });
338329 Point mouseLoc= resizer.toDisplay(e.x, e.y);
339330 final int mouseX= mouseLoc.x;
340331 final int mouseY= mouseLoc.y;
341 fResizeListener= new MouseMoveListener() {
342 @Override
343 public void mouseMove(MouseEvent e2) {
344 Point mouseLoc2= resizer.toDisplay(e2.x, e2.y);
345 int dx= mouseLoc2.x - mouseX;
346 int dy= mouseLoc2.y - mouseY;
347 if (isRTL) {
348 setLocation(new Point(shellX + dx, shellY));
349 setSize(shellWidth - dx, shellHeight + dy);
350 } else {
351 setSize(shellWidth + dx, shellHeight + dy);
352 }
332 fResizeListener= e2 -> {
333 Point mouseLoc2= resizer.toDisplay(e2.x, e2.y);
334 int dx= mouseLoc2.x - mouseX;
335 int dy= mouseLoc2.y - mouseY;
336 if (isRTL) {
337 setLocation(new Point(shellX + dx, shellY));
338 setSize(shellWidth - dx, shellHeight + dy);
339 } else {
340 setSize(shellWidth + dx, shellHeight + dy);
353341 }
354342 };
355343 resizer.addMouseMoveListener(fResizeListener);
395383 Point mouseLoc= control.toDisplay(e.x, e.y);
396384 final int mouseX= mouseLoc.x;
397385 final int mouseY= mouseLoc.y;
398 fMoveListener= new MouseMoveListener() {
399 @Override
400 public void mouseMove(MouseEvent e2) {
401 Point mouseLoc2= control.toDisplay(e2.x, e2.y);
402 int dx= mouseLoc2.x - mouseX;
403 int dy= mouseLoc2.y - mouseY;
404 fShell.setLocation(shellX + dx, shellY + dy);
405 }
386 fMoveListener= e2 -> {
387 Point mouseLoc2= control.toDisplay(e2.x, e2.y);
388 int dx= mouseLoc2.x - mouseX;
389 int dy= mouseLoc2.y - mouseY;
390 fShell.setLocation(shellX + dx, shellY + dy);
406391 };
407392 control.addMouseMoveListener(fMoveListener);
408393 }
686671 @Override
687672 public void addFocusListener(final FocusListener listener) {
688673 if (fFocusListeners.isEmpty()) {
689 fShellListener= new Listener() {
690
691 @Override
692 public void handleEvent(Event event) {
693 for (FocusListener focusListener : fFocusListeners) {
694 if (event.type == SWT.Activate) {
695 focusListener.focusGained(new FocusEvent(event));
696 } else {
697 focusListener.focusLost(new FocusEvent(event));
698 }
674 fShellListener= event -> {
675 for (FocusListener focusListener : fFocusListeners) {
676 if (event.type == SWT.Activate) {
677 focusListener.focusGained(new FocusEvent(event));
678 } else {
679 focusListener.focusLost(new FocusEvent(event));
699680 }
700681 }
701682 };
782763 public Point computeSizeConstraints(int widthInChars, int heightInChars) {
783764 GC gc= new GC(fContentComposite);
784765 gc.setFont(JFaceResources.getDialogFont());
785 int width= gc.getFontMetrics().getAverageCharWidth();
766 double width= gc.getFontMetrics().getAverageCharacterWidth();
786767 int height= gc.getFontMetrics().getHeight();
787768 gc.dispose();
788769
789 return new Point(widthInChars * width, heightInChars * height);
770 return new Point((int) (widthInChars * width), heightInChars * height);
790771 }
791772
792773 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1316
1417
1518 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.events.DisposeEvent;
1719 import org.eclipse.swt.events.DisposeListener;
1820 import org.eclipse.swt.graphics.GC;
1921 import org.eclipse.swt.graphics.Point;
675677 */
676678 private DisposeListener getSubjectControlDisposeListener() {
677679 if (fSubjectControlDisposeListener == null) {
678 fSubjectControlDisposeListener= new DisposeListener() {
679 @Override
680 public void widgetDisposed(DisposeEvent e) {
681 handleSubjectControlDisposed();
682 }
683 };
680 fSubjectControlDisposeListener= e -> handleSubjectControlDisposed();
684681 }
685682 return fSubjectControlDisposeListener;
686683 }
746743
747744 GC gc= new GC(subjectControl);
748745 gc.setFont(subjectControl.getFont());
749 int width= gc.getFontMetrics().getAverageCharWidth();
746 double width= gc.getFontMetrics().getAverageCharacterWidth();
750747 int height = gc.getFontMetrics().getHeight();
751748 gc.dispose();
752749
753 fSizeConstraints= new Point (fWidthConstraint * width, fHeightConstraint * height);
750 fSizeConstraints= new Point((int) (fWidthConstraint * width), fHeightConstraint * height);
754751 }
755752
756753 return new Point(fSizeConstraints.x, fSizeConstraints.y);
828825
829826 if (fInformationControl == null) {
830827 fInformationControl= creator.createInformationControl(fSubjectControl.getShell());
831 fInformationControl.addDisposeListener(new DisposeListener() {
832 @Override
833 public void widgetDisposed(DisposeEvent e) {
834 handleInformationControlDisposed();
835 }
836 });
828 fInformationControl.addDisposeListener(e -> handleInformationControlDisposed());
837829
838830 if (fInformationControlCloser != null)
839831 fInformationControlCloser.setInformationControl(fInformationControl);
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009 Avaloq Evolution AG and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Tom Eicher (Avaloq Evolution AG) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
718721 case OperationHistoryEvent.ABOUT_TO_REDO:
719722 // if this is one of our operations
720723 if (event.getOperation().hasContext(fUndoContext)) {
721 fTextViewer.getTextWidget().getDisplay().syncExec(new Runnable() {
722 @Override
723 public void run() {
724 fTextViewer.getTextWidget().getDisplay().syncExec(() -> {
724725 // if we are undoing/redoing a command we generated, then ignore
725726 // the document changes associated with this undo or redo.
726727 if (event.getOperation() instanceof TextCommand) {
727728 if (fTextViewer instanceof TextViewer)
728 ((TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
729 ((TextViewer) fTextViewer).ignoreAutoEditStrategies(true);
729730 listenToTextChanges(false);
730731
731732 // in the undo case only, make sure compounds are closed
732733 if (type == OperationHistoryEvent.ABOUT_TO_UNDO) {
733734 if (fFoldingIntoCompoundChange) {
734735 endCompoundChange();
735 }
736736 }
737 }
737738 } else {
738739 // the undo or redo has our context, but it is not one of
739740 // our commands. We will listen to the changes, but will
740741 // reset the state that tracks the undo/redo history.
741742 commit();
742743 fLastAddedCommand= null;
743 }
744744 }
745 });
745 });
746746 fOperation= event.getOperation();
747747 }
748748 break;
750750 case OperationHistoryEvent.REDONE:
751751 case OperationHistoryEvent.OPERATION_NOT_OK:
752752 if (event.getOperation() == fOperation) {
753 fTextViewer.getTextWidget().getDisplay().syncExec(new Runnable() {
754 @Override
755 public void run() {
753 fTextViewer.getTextWidget().getDisplay().syncExec(() -> {
756754 listenToTextChanges(true);
757755 fOperation= null;
758756 if (fTextViewer instanceof TextViewer)
759 ((TextViewer)fTextViewer).ignoreAutoEditStrategies(false);
760 }
761 });
757 ((TextViewer) fTextViewer).ignoreAutoEditStrategies(false);
758 });
762759 }
763760 break;
764761 }
11771174 display= finalShell.getDisplay();
11781175 else
11791176 display= Display.getDefault();
1180 display.syncExec(new Runnable() {
1181 @Override
1182 public void run() {
1183 MessageDialog.openError(finalShell, title, ex.getLocalizedMessage());
1184 }
1185 });
1177 display.syncExec(() -> MessageDialog.openError(finalShell, title, ex.getLocalizedMessage()));
11861178 }
11871179 }
11881180
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009 Avaloq Evolution AG and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Tom Eicher (Avaloq Evolution AG) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2010 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
377380 public static int getAverageCharWidth(Control control) {
378381 GC gc= new GC(control);
379382 gc.setFont(control.getFont());
380 int increment= gc.getFontMetrics().getAverageCharWidth();
383 double increment= gc.getFontMetrics().getAverageCharacterWidth();
381384 gc.dispose();
382 return increment;
385 return (int) increment;
383386 }
384387
385388 /**
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
6568 myEnd= Math.max(myStart, myEnd);
6669
6770 int yoursStart= fOffset;
68 int yoursEnd= fOffset + fReplaceLength;// - 1;
69 yoursEnd= Math.max(yoursStart, yoursEnd);
7071
7172 if (myEnd < yoursStart)
7273 return;
338339
339340 Control control= fTextViewer.getTextWidget();
340341 if (control != null) {
341 control.getDisplay().asyncExec(new Runnable() {
342 @Override
343 public void run() {
344 if (fTextViewer != null)
345 paint(IPainter.TEXT_CHANGE);
346 }
342 control.getDisplay().asyncExec(() -> {
343 if (fTextViewer != null)
344 paint(IPainter.TEXT_CHANGE);
347345 });
348346 }
349347 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2008 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
3841 import org.eclipse.swt.dnd.TextTransfer;
3942 import org.eclipse.swt.events.ControlEvent;
4043 import org.eclipse.swt.events.ControlListener;
41 import org.eclipse.swt.events.DisposeEvent;
42 import org.eclipse.swt.events.DisposeListener;
4344 import org.eclipse.swt.events.KeyEvent;
4445 import org.eclipse.swt.events.KeyListener;
4546 import org.eclipse.swt.events.MouseAdapter;
4748 import org.eclipse.swt.events.MouseListener;
4849 import org.eclipse.swt.events.SelectionEvent;
4950 import org.eclipse.swt.events.SelectionListener;
50 import org.eclipse.swt.events.TraverseEvent;
51 import org.eclipse.swt.events.TraverseListener;
5251 import org.eclipse.swt.events.VerifyEvent;
5352 import org.eclipse.swt.events.VerifyListener;
5453 import org.eclipse.swt.graphics.Color;
6160 import org.eclipse.swt.widgets.Composite;
6261 import org.eclipse.swt.widgets.Control;
6362 import org.eclipse.swt.widgets.Display;
64 import org.eclipse.swt.widgets.Event;
65 import org.eclipse.swt.widgets.Listener;
6663 import org.eclipse.swt.widgets.ScrollBar;
6764 import org.eclipse.swt.widgets.Shell;
6865
360357 myEnd= Math.max(myStart, myEnd);
361358
362359 int yoursStart= fOffset;
363 int yoursEnd= fOffset + fReplaceLength -1;
364 yoursEnd= Math.max(yoursStart, yoursEnd);
365360
366361 if (myEnd < yoursStart)
367362 return;
17031698 fTextWidget= createTextWidget(parent, styles);
17041699
17051700 // Support scroll page upon MOD1+MouseWheel
1706 fTextWidget.addListener(SWT.MouseVerticalWheel, new Listener() {
1707
1708 @Override
1709 public void handleEvent(Event event) {
1710 if (((event.stateMask & SWT.MOD1) == 0))
1711 return;
1712
1713 int topIndex= fTextWidget.getTopIndex();
1714 int bottomIndex= JFaceTextUtil.getBottomIndex(fTextWidget);
1715
1716 if (event.count > 0)
1717 fTextWidget.setTopIndex(2 * topIndex - bottomIndex);
1718 else
1719 fTextWidget.setTopIndex(bottomIndex);
1720
1721 updateViewportListeners(INTERNAL);
1722 }
1701 fTextWidget.addListener(SWT.MouseVerticalWheel, event -> {
1702 if (((event.stateMask & SWT.MOD1) == 0))
1703 return;
1704
1705 int topIndex= fTextWidget.getTopIndex();
1706 int bottomIndex= JFaceTextUtil.getBottomIndex(fTextWidget);
1707
1708 if (event.count > 0)
1709 fTextWidget.setTopIndex(2 * topIndex - bottomIndex);
1710 else
1711 fTextWidget.setTopIndex(bottomIndex);
1712
1713 updateViewportListeners(INTERNAL);
17231714 });
17241715
17251716 fTextWidget.addDisposeListener(
1726 new DisposeListener() {
1727 @Override
1728 public void widgetDisposed(DisposeEvent e) {
1717 e -> {
17291718 fDisposedControl= getControl();
17301719 handleDispose();
1731 }
17321720 }
17331721 );
17341722
17391727 * Disable SWT Shift+TAB traversal in this viewer
17401728 * 1GIYQ9K: ITPUI:WINNT - StyledText swallows Shift+TAB
17411729 */
1742 fTextWidget.addTraverseListener(new TraverseListener() {
1743 @Override
1744 public void keyTraversed(TraverseEvent e) {
1745 if ((SWT.SHIFT == e.stateMask) && ('\t' == e.character))
1746 e.doit= !fTextWidget.getEditable();
1747 }
1730 fTextWidget.addTraverseListener(e -> {
1731 if ((SWT.SHIFT == e.stateMask) && ('\t' == e.character))
1732 e.doit= !fTextWidget.getEditable();
17481733 });
17491734
17501735 // where does the first line start
37213706 boolean isFirst= e.time != fLastEventTime;
37223707 fLastEventTime= e.time;
37233708 if (isFirst) {
3724 wrapCompoundChange(new Runnable() {
3725 @Override
3726 public void run() {
3727 SelectionProcessor processor= new SelectionProcessor(TextViewer.this);
3728 try {
3729 /* Use the selection instead of the event's coordinates. Is this dangerous? */
3730 ISelection selection= getSelection();
3731 int length= e.text.length();
3732 if (length == 0 && e.character == '\0') {
3733 // backspace in StyledText block selection mode...
3734 TextEdit edit= processor.backspace(selection);
3735 edit.apply(fDocument, TextEdit.UPDATE_REGIONS);
3736 ISelection empty= processor.makeEmpty(selection, true);
3737 setSelection(empty);
3738 } else {
3739 int lines= processor.getCoveredLines(selection);
3740 String delim= fDocument.getLegalLineDelimiters()[0];
3741 StringBuilder text= new StringBuilder(lines * length + (lines - 1) * delim.length());
3709 wrapCompoundChange(() -> {
3710 SelectionProcessor processor= new SelectionProcessor(TextViewer.this);
3711 try {
3712 /* Use the selection instead of the event's coordinates. Is this dangerous? */
3713 ISelection selection= getSelection();
3714 int length= e.text.length();
3715 if (length == 0 && e.character == '\0') {
3716 // backspace in StyledText block selection mode...
3717 TextEdit edit= processor.backspace(selection);
3718 edit.apply(fDocument, TextEdit.UPDATE_REGIONS);
3719 ISelection empty= processor.makeEmpty(selection, true);
3720 setSelection(empty);
3721 } else {
3722 int lines= processor.getCoveredLines(selection);
3723 String delim= fDocument.getLegalLineDelimiters()[0];
3724 StringBuilder text= new StringBuilder(lines * length + (lines - 1) * delim.length());
3725 text.append(e.text);
3726 for (int i= 0; i < lines - 1; i++) {
3727 text.append(delim);
37423728 text.append(e.text);
3743 for (int i= 0; i < lines - 1; i++) {
3744 text.append(delim);
3745 text.append(e.text);
3746 }
3747 processor.doReplace(selection, text.toString());
37483729 }
3749 } catch (BadLocationException x) {
3750 if (TRACE_ERRORS)
3751 System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.verifyText")); //$NON-NLS-1$
3730 processor.doReplace(selection, text.toString());
37523731 }
3732 } catch (BadLocationException x) {
3733 if (TRACE_ERRORS)
3734 System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.verifyText")); //$NON-NLS-1$
37533735 }
37543736 });
37553737 }
38393821 if (!fTextWidget.isTextSelected())
38403822 copyMarkedRegion(true);
38413823 else
3842 wrapCompoundChange(new Runnable() {
3843 @Override
3844 public void run() {
3845 fTextWidget.cut();
3846 }
3847 });
3824 wrapCompoundChange(() -> fTextWidget.cut());
38483825
38493826 selection= fTextWidget.getSelectionRange();
38503827 fireSelectionChanged(selection.x, selection.y);
39103887 if (!fTextWidget.getBlockSelection()) {
39113888 fTextWidget.invokeAction(ST.DELETE_NEXT);
39123889 } else {
3913 wrapCompoundChange(new Runnable(){
3914 @Override
3915 public void run() {
3916 try {
3917 new SelectionProcessor(TextViewer.this).doDelete(getSelection());
3918 } catch (BadLocationException e) {
3919 if (TRACE_ERRORS)
3920 System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.delete")); //$NON-NLS-1$
3921 }
3890 wrapCompoundChange(() -> {
3891 try {
3892 new SelectionProcessor(TextViewer.this).doDelete(getSelection());
3893 } catch (BadLocationException e) {
3894 if (TRACE_ERRORS)
3895 System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.delete")); //$NON-NLS-1$
39223896 }
39233897 });
39243898 }
39313905 if (!fTextWidget.getBlockSelection()) {
39323906 fTextWidget.paste();
39333907 } else {
3934 wrapCompoundChange(new Runnable(){
3935 @Override
3936 public void run() {
3937 SelectionProcessor processor= new SelectionProcessor(TextViewer.this);
3938 Clipboard clipboard= new Clipboard(getDisplay());
3939 try {
3940 /*
3941 * Paste in block selection mode. If the pasted text is not a multi-line
3942 * text, pasting behaves like typing, i.e. the pasted text replaces
3943 * the selection on each line. If the pasted text is multi-line (e.g. from
3944 * copying a column selection), the selection is replaced, line-by-line, by
3945 * the corresponding contents of the pasted text. If the selection touches
3946 * more lines than the pasted text, the selection on the remaining lines
3947 * is deleted (assuming an empty text being pasted). If the pasted
3948 * text contains more lines than the selection, the selection is extended
3949 * to the succeeding lines, or more lines are added to accommodate the
3950 * paste operation.
3951 */
3952 ISelection selection= getSelection();
3953 TextTransfer plainTextTransfer = TextTransfer.getInstance();
3954 String contents= (String)clipboard.getContents(plainTextTransfer, DND.CLIPBOARD);
3955 String toInsert;
3956 if (TextUtilities.indexOf(fDocument.getLegalLineDelimiters(), contents, 0)[0] != -1) {
3957 // multi-line insertion
3958 toInsert= contents;
3959 } else {
3960 // single-line insertion
3961 int length= contents.length();
3962 int lines= processor.getCoveredLines(selection);
3963 String delim= fDocument.getLegalLineDelimiters()[0];
3964 StringBuilder text= new StringBuilder(lines * length + (lines - 1) * delim.length());
3908 wrapCompoundChange(() -> {
3909 SelectionProcessor processor= new SelectionProcessor(TextViewer.this);
3910 Clipboard clipboard= new Clipboard(getDisplay());
3911 try {
3912 /*
3913 * Paste in block selection mode. If the pasted text is not a multi-line
3914 * text, pasting behaves like typing, i.e. the pasted text replaces
3915 * the selection on each line. If the pasted text is multi-line (e.g. from
3916 * copying a column selection), the selection is replaced, line-by-line, by
3917 * the corresponding contents of the pasted text. If the selection touches
3918 * more lines than the pasted text, the selection on the remaining lines
3919 * is deleted (assuming an empty text being pasted). If the pasted
3920 * text contains more lines than the selection, the selection is extended
3921 * to the succeeding lines, or more lines are added to accommodate the
3922 * paste operation.
3923 */
3924 ISelection selection= getSelection();
3925 TextTransfer plainTextTransfer= TextTransfer.getInstance();
3926 String contents= (String) clipboard.getContents(plainTextTransfer, DND.CLIPBOARD);
3927 String toInsert;
3928 if (TextUtilities.indexOf(fDocument.getLegalLineDelimiters(), contents, 0)[0] != -1) {
3929 // multi-line insertion
3930 toInsert= contents;
3931 } else {
3932 // single-line insertion
3933 int length= contents.length();
3934 int lines= processor.getCoveredLines(selection);
3935 String delim= fDocument.getLegalLineDelimiters()[0];
3936 StringBuilder text= new StringBuilder(lines * length + (lines - 1) * delim.length());
3937 text.append(contents);
3938 for (int i= 0; i < lines - 1; i++) {
3939 text.append(delim);
39653940 text.append(contents);
3966 for (int i= 0; i < lines - 1; i++) {
3967 text.append(delim);
3968 text.append(contents);
3969 }
3970 toInsert= text.toString();
39713941 }
3972 processor.doReplace(selection, toInsert);
3973 } catch (BadLocationException x) {
3974 if (TRACE_ERRORS)
3975 System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.paste")); //$NON-NLS-1$
3976 } finally {
3977 clipboard.dispose();
3942 toInsert= text.toString();
39783943 }
3944 processor.doReplace(selection, toInsert);
3945 } catch (BadLocationException x) {
3946 if (TRACE_ERRORS)
3947 System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.paste")); //$NON-NLS-1$
3948 } finally {
3949 clipboard.dispose();
39793950 }
39803951 });
39813952 }
40704041 fTextWidget.setSelection(widgetMarkOffset, selection.x);
40714042
40724043 if (delete) {
4073 wrapCompoundChange(new Runnable() {
4074 @Override
4075 public void run() {
4076 fTextWidget.cut();
4077 }
4078 });
4044 wrapCompoundChange(() -> fTextWidget.cut());
40794045 } else {
40804046 fTextWidget.copy();
40814047 fTextWidget.setSelection(selection.x); // restore old cursor position
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2006, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
149152 if (extension != null)
150153 extension.setRedraw(false);
151154 }
152 fTextViewer.getTextWidget().getDisplay().syncExec(new Runnable() {
153 @Override
154 public void run() {
155 if (fTextViewer instanceof TextViewer)
156 ((TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
157 }
158 });
155 fTextViewer.getTextWidget().getDisplay().syncExec(() -> {
156 if (fTextViewer instanceof TextViewer)
157 ((TextViewer) fTextViewer).ignoreAutoEditStrategies(true);
158 });
159159
160160 } else if (((eventType & DocumentUndoEvent.UNDONE) != 0) || ((eventType & DocumentUndoEvent.REDONE) != 0)) {
161 fTextViewer.getTextWidget().getDisplay().syncExec(new Runnable() {
162 @Override
163 public void run() {
164 if (fTextViewer instanceof TextViewer)
165 ((TextViewer)fTextViewer).ignoreAutoEditStrategies(false);
166 }
167 });
161 fTextViewer.getTextWidget().getDisplay().syncExec(() -> {
162 if (fTextViewer instanceof TextViewer)
163 ((TextViewer) fTextViewer).ignoreAutoEditStrategies(false);
164 });
168165 if (event.isCompound()) {
169166 ITextViewerExtension extension= null;
170167 if (fTextViewer instanceof ITextViewerExtension)
299296 display= finalShell.getDisplay();
300297 else
301298 display= Display.getDefault();
302 display.syncExec(new Runnable() {
303 @Override
304 public void run() {
305 MessageDialog.openError(finalShell, title, ex.getLocalizedMessage());
306 }
307 });
299 display.syncExec(() -> MessageDialog.openError(finalShell, title, ex.getLocalizedMessage()));
308300 }
309301 }
310302
00 /*******************************************************************************
11 * Copyright (c) 2006, 2018 Wind River Systems, Inc., IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Anton Leherbauer (Wind River Systems) - initial API and implementation - https://bugs.eclipse.org/bugs/show_bug.cgi?id=22712
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide extension point for CodeMining - Bug 528419
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide extension point for CodeMining - Bug 528419
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
00 /**
11 * Copyright (c) 2018, Angelo ZERR and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] CodeMining should support line header/content annotation type both - Bug 529115
00 /**
11 * Copyright (c) 2018, Angelo ZERR and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] CodeMining should support line header/content annotation type both - Bug 529115
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
173176 public void run() {
174177 final ICompletionProposal proposal= getCurrentProposal();
175178 if (!fDisplay.isDisposed()) {
176 fDisplay.asyncExec(new Runnable() {
177 @Override
178 public void run() {
179 synchronized (Timer.this) {
180 if (proposal == getCurrentProposal()) {
181 Object info= proposal.getAdditionalProposalInfo();
182 showInformation(proposal, info);
183 }
179 fDisplay.asyncExec(() -> {
180 synchronized (Timer.this) {
181 if (proposal == getCurrentProposal()) {
182 Object info= proposal.getAdditionalProposalInfo();
183 showInformation(proposal, info);
184184 }
185185 }
186186 });
255255 long current= System.currentTimeMillis();
256256 schedule(IDLE, current);
257257
258 fThread= new Thread(new Runnable() {
259 @Override
260 public void run() {
261 try {
262 loop();
263 } catch (InterruptedException x) {
264 }
265 }
266 }, JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$
258 fThread= new Thread((Runnable) () -> {
259 try {
260 loop();
261 } catch (InterruptedException x) {
262 }
263 }, JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$
267264 fThread.start();
268265 }
269266
358355 private void triggerShowing() {
359356 final Object info= fCurrentInfo;
360357 if (!fDisplay.isDisposed()) {
361 fDisplay.asyncExec(new Runnable() {
362 @Override
363 public void run() {
364 synchronized (Timer.this) {
365 if (info == fCurrentInfo) {
366 showInformation(fCurrentProposal, info);
367 }
358 fDisplay.asyncExec(() -> {
359 synchronized (Timer.this) {
360 if (info == fCurrentInfo) {
361 showInformation(fCurrentProposal, info);
368362 }
369363 }
370364 });
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - [251156] async content assist
00 /*******************************************************************************
11 * Copyright (c) 2015, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
351354
352355 int offset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
353356 List<ICompletionProposal> proposals= null;
354 try {
357 try {
355358 if (offset > -1) {
356359 DocumentEvent event= TextUtilities.mergeProcessedDocumentEvents(fDocumentEvents);
357360 proposals= computeFilteredProposals(offset, event);
358361 }
359 } catch (BadLocationException x) {
360 } finally {
362 } catch (BadLocationException x) {
363 } finally {
361364 fDocumentEvents.clear();
362365 }
363366 fFilterOffset= offset;
479482 // when the user types fast.
480483 fContentAssistSubjectControlAdapter.addKeyListener(fKeyListener);
481484
482 BusyIndicator.showWhile(control.getDisplay(), new Runnable() {
483 @Override
484 public void run() {
485
486 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
487 fFilterOffset= fInvocationOffset;
488 fLastCompletionOffset= fFilterOffset;
489 fComputedProposals= computeProposals(fInvocationOffset);
490
491 int count= (fComputedProposals == null ? 0 : fComputedProposals.size());
492 if (count == 0 && hideWhenNoProposals(autoActivated))
493 return;
494
495 if (count == 1 && !autoActivated && canAutoInsert(fComputedProposals.get(0))) {
496 insertProposal(fComputedProposals.get(0), (char) 0, 0, fInvocationOffset);
497 hide();
498 } else {
499 createProposalSelector();
500 setProposals(fComputedProposals, false);
501 displayProposals();
502 }
485 BusyIndicator.showWhile(control.getDisplay(), () -> {
486
487 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
488 fFilterOffset= fInvocationOffset;
489 fLastCompletionOffset= fFilterOffset;
490 fComputedProposals= computeProposals(fInvocationOffset);
491
492 int count= (fComputedProposals == null ? 0 : fComputedProposals.size());
493 if (count == 0 && hideWhenNoProposals(autoActivated))
494 return;
495
496 if (count == 1 && !autoActivated && canAutoInsert(fComputedProposals.get(0))) {
497 insertProposal(fComputedProposals.get(0), (char) 0, 0, fInvocationOffset);
498 hide();
499 } else {
500 createProposalSelector();
501 setProposals(fComputedProposals, false);
502 displayProposals();
503503 }
504504 });
505505 } else {
748748 public void focusGained(FocusEvent e) {
749749 if (Helper.okToUse(control)) {
750750 if (fTraverseListener == null) {
751 fTraverseListener= new TraverseListener() {
752 @Override
751 fTraverseListener= new TraverseListener() {
752 @Override
753753 public void keyTraversed(TraverseEvent event) {
754 if (event.detail == SWT.TRAVERSE_TAB_NEXT) {
755 IInformationControl iControl= fAdditionalInfoController.getCurrentInformationControl2();
756 if (fAdditionalInfoController.getInternalAccessor().canReplace(iControl)) {
757 fAdditionalInfoController.getInternalAccessor().replaceInformationControl(true);
758 event.doit= false;
759 }
760 }
761 }
762 };
754 if (event.detail == SWT.TRAVERSE_TAB_NEXT) {
755 IInformationControl iControl= fAdditionalInfoController.getCurrentInformationControl2();
756 if (fAdditionalInfoController.getInternalAccessor().canReplace(iControl)) {
757 fAdditionalInfoController.getInternalAccessor().replaceInformationControl(true);
758 event.doit= false;
759 }
760 }
761 }
762 };
763763 fProposalTable.addTraverseListener(fTraverseListener);
764764 }
765765 }
16031603 if (!Helper.okToUse(fProposalShell) && !control.isDisposed())
16041604 fContentAssistSubjectControlAdapter.addKeyListener(fKeyListener);
16051605
1606 BusyIndicator.showWhile(control.getDisplay(), new Runnable() {
1607 @Override
1608 public void run() {
1609
1610 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
1611 fFilterOffset= fInvocationOffset;
1612 fLastCompletionOffset= fFilterOffset;
1613 fFilteredProposals= computeProposals(fInvocationOffset);
1614
1615 int count= (fFilteredProposals == null ? 0 : fFilteredProposals.size());
1616 if (count == 0 && hideWhenNoProposals(false))
1617 return;
1618
1619 if (count == 1 && canAutoInsert(fFilteredProposals.get(0))) {
1620 insertProposal(fFilteredProposals.get(0), (char) 0, 0, fInvocationOffset);
1621 hide();
1622 } else {
1623 ensureDocumentListenerInstalled();
1624 if (count > 0 && completeCommonPrefix())
1625 hide();
1626 else {
1627 fComputedProposals= fFilteredProposals;
1628 createProposalSelector();
1629 setProposals(fComputedProposals, false);
1630 displayProposals();
1631 }
1632 }
1606 BusyIndicator.showWhile(control.getDisplay(), () -> {
1607
1608 fInvocationOffset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
1609 fFilterOffset= fInvocationOffset;
1610 fLastCompletionOffset= fFilterOffset;
1611 fFilteredProposals= computeProposals(fInvocationOffset);
1612
1613 int count= (fFilteredProposals == null ? 0 : fFilteredProposals.size());
1614 if (count == 0 && hideWhenNoProposals(false))
1615 return;
1616
1617 if (count == 1 && canAutoInsert(fFilteredProposals.get(0))) {
1618 insertProposal(fFilteredProposals.get(0), (char) 0, 0, fInvocationOffset);
1619 hide();
1620 } else {
1621 ensureDocumentListenerInstalled();
1622 if (count > 0 && completeCommonPrefix())
1623 hide();
1624 else {
1625 fComputedProposals= fFilteredProposals;
1626 createProposalSelector();
1627 setProposals(fComputedProposals, false);
1628 displayProposals();
16331629 }
1630 }
16341631 });
16351632 }
16361633 return getErrorMessage();
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
3942 import org.eclipse.swt.events.KeyEvent;
4043 import org.eclipse.swt.events.MouseEvent;
4144 import org.eclipse.swt.events.MouseListener;
42 import org.eclipse.swt.events.TraverseEvent;
4345 import org.eclipse.swt.events.TraverseListener;
4446 import org.eclipse.swt.events.VerifyEvent;
4547 import org.eclipse.swt.graphics.Color;
210212 if (Helper.okToUse(control)) {
211213 Display d= control.getDisplay();
212214 if (d != null) {
213 d.asyncExec(new Runnable() {
214 @Override
215 public void run() {
216 if (!fProposalPopup.hasFocus() && (fContextInfoPopup == null || !fContextInfoPopup.hasFocus()))
217 hide();
218 }
215 d.asyncExec(() -> {
216 if (!fProposalPopup.hasFocus() && (fContextInfoPopup == null || !fContextInfoPopup.hasFocus()))
217 hide();
219218 });
220219 }
221220 }
367366 return;
368367
369368 try {
370 d.syncExec(new Runnable() {
371 @Override
372 public void run() {
373 if (isProposalPopupActive())
369 d.syncExec(() -> {
370 if (isProposalPopupActive())
371 return;
372
373 if (control.isDisposed() || !control.isFocusControl())
374 return;
375
376 if (showStyle == SHOW_PROPOSALS) {
377 if (!prepareToShowCompletions(true))
374378 return;
375
376 if (control.isDisposed() || !control.isFocusControl())
377 return;
378
379 if (showStyle == SHOW_PROPOSALS) {
380 if (!prepareToShowCompletions(true))
381 return;
382 fProposalPopup.showProposals(true);
383 fLastAutoActivation= System.currentTimeMillis();
384 } else if (showStyle == SHOW_CONTEXT_INFO && fContextInfoPopup != null) {
385 promoteKeyListener();
386 fContextInfoPopup.showContextProposals(true);
387 }
379 fProposalPopup.showProposals(true);
380 fLastAutoActivation= System.currentTimeMillis();
381 } else if (showStyle == SHOW_CONTEXT_INFO && fContextInfoPopup != null) {
382 promoteKeyListener();
383 fContextInfoPopup.showContextProposals(true);
388384 }
389385 });
390386 } catch (SWTError e) {
15431539
15441540 if (Helper.okToUse(fContentAssistSubjectControlAdapter.getControl())) {
15451541 fContentAssistSubjectControlShell= fContentAssistSubjectControlAdapter.getControl().getShell();
1546 fCASCSTraverseListener= new TraverseListener() {
1547 @Override
1548 public void keyTraversed(TraverseEvent e) {
1549 if (e.detail == SWT.TRAVERSE_ESCAPE && isProposalPopupActive())
1550 e.doit= false;
1551 }
1542 fCASCSTraverseListener= e -> {
1543 if (e.detail == SWT.TRAVERSE_ESCAPE && isProposalPopupActive())
1544 e.doit= false;
15521545 };
15531546 fContentAssistSubjectControlShell.addTraverseListener(fCASCSTraverseListener);
15541547 }
19801973 SafeRunner.run(new ExceptionLoggingSafeRunnable(COMPLETION_ERROR_MESSAGE_KEY) {
19811974 @Override
19821975 public void run() throws Exception {
1983 result.addAll(Arrays.asList( ((ISubjectControlContentAssistProcessor) p)
1984 .computeCompletionProposals(contentAssistSubjectControl, offset)));
1976 ICompletionProposal[] proposals= ((ISubjectControlContentAssistProcessor) p)
1977 .computeCompletionProposals(contentAssistSubjectControl, offset);
1978 if (proposals != null) {
1979 result.addAll(Arrays.asList(proposals));
1980 }
19851981 fLastErrorMessage= p.getErrorMessage();
19861982 }
19871983 });
20462042 @Override
20472043 public void run() throws Exception {
20482044 processors.forEach(p -> {
2049 result.addAll(Arrays.asList(p.computeContextInformation(viewer, offset)));
2045 IContextInformation[] contextInformation= p.computeContextInformation(viewer, offset);
2046 if (contextInformation != null) {
2047 result.addAll(Arrays.asList(contextInformation));
2048 }
20502049 fLastErrorMessage= p.getErrorMessage();
20512050 });
20522051 }
20802079 SafeRunner.run(new ExceptionLoggingSafeRunnable(CONTEXT_ERROR_MESSAGE_KEY) {
20812080 @Override
20822081 public void run() throws Exception {
2083 result.addAll(Arrays.asList( ((ISubjectControlContentAssistProcessor) p)
2084 .computeContextInformation(contentAssistSubjectControl, offset)));
2082 IContextInformation[] contextInformation= ((ISubjectControlContentAssistProcessor) p)
2083 .computeContextInformation(contentAssistSubjectControl, offset);
2084 if (contextInformation != null) {
2085 result.addAll(Arrays.asList(contextInformation));
2086 }
20852087 fLastErrorMessage= p.getErrorMessage();
20862088 }
20872089 });
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1821 import org.eclipse.swt.custom.VerifyKeyListener;
1922 import org.eclipse.swt.events.ControlEvent;
2023 import org.eclipse.swt.events.ControlListener;
21 import org.eclipse.swt.events.DisposeEvent;
22 import org.eclipse.swt.events.DisposeListener;
2324 import org.eclipse.swt.events.KeyEvent;
2425 import org.eclipse.swt.events.SelectionAdapter;
2526 import org.eclipse.swt.events.SelectionEvent;
179180 */
180181 public String showContextProposals(final boolean autoActivated) {
181182 final Control control= fContentAssistSubjectControlAdapter.getControl();
182 BusyIndicator.showWhile(control.getDisplay(), new Runnable() {
183 @Override
184 public void run() {
185
186 int offset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
187
188 IContextInformation[] contexts= computeContextInformation(offset);
189 int count = (contexts == null ? 0 : contexts.length);
190 if (count == 1) {
191
192 ContextFrame frame= createContextFrame(contexts[0], offset);
193 if (isDuplicate(frame))
183 BusyIndicator.showWhile(control.getDisplay(), () -> {
184
185 int offset= fContentAssistSubjectControlAdapter.getSelectedRange().x;
186
187 IContextInformation[] contexts= computeContextInformation(offset);
188 int count= (contexts == null ? 0 : contexts.length);
189 if (count == 1) {
190
191 ContextFrame frame1= createContextFrame(contexts[0], offset);
192 if (isDuplicate(frame1))
193 validateContextInformation();
194 else
195 // Show context information directly
196 internalShowContextInfo(frame1);
197
198 } else if (count > 0) {
199
200 // if any of the proposed context matches any of the contexts on the stack,
201 // assume that one (so, if context info is invoked repeatedly, the current
202 // info is kept)
203 int index= 0;
204 for (int i= 0; i < contexts.length; i++) {
205 IContextInformation info= contexts[i];
206 ContextFrame frame2= createContextFrame(info, offset);
207
208 // check top of stack and stored context
209 if (isDuplicate(frame2)) {
194210 validateContextInformation();
195 else
196 // Show context information directly
197 internalShowContextInfo(frame);
198
199 } else if (count > 0) {
200
201 // if any of the proposed context matches any of the contexts on the stack,
202 // assume that one (so, if context info is invoked repeatedly, the current
203 // info is kept)
204 int index= 0;
205 for (int i= 0; i < contexts.length; i++) {
206 IContextInformation info= contexts[i];
207 ContextFrame frame= createContextFrame(info, offset);
208
209 // check top of stack and stored context
210 if (isDuplicate(frame)) {
211 return;
212 }
213
214 if (isLastFrame(frame2)) {
215 index= i;
216 }
217
218 // also check all other contexts
219 for (ContextFrame stackFrame : fContextFrameStack) {
220 if (stackFrame.equals(frame2)) {
211221 validateContextInformation();
212222 return;
213223 }
214
215 if (isLastFrame(frame)) {
216 index= i;
217 }
218
219 // also check all other contexts
220 for (ContextFrame stackFrame : fContextFrameStack) {
221 if (stackFrame.equals(frame)) {
222 validateContextInformation();
223 return;
224 }
225 }
226224 }
227
228 // otherwise:
229 // Precise context must be selected
230
231 if (fLineDelimiter == null)
232 fLineDelimiter= fContentAssistSubjectControlAdapter.getLineDelimiter();
233
234 createContextSelector();
235 setContexts(contexts, index);
236 displayContextSelector();
237225 }
226
227 // otherwise:
228 // Precise context must be selected
229
230 if (fLineDelimiter == null)
231 fLineDelimiter= fContentAssistSubjectControlAdapter.getLineDelimiter();
232
233 createContextSelector();
234 setContexts(contexts, index);
235 displayContextSelector();
238236 }
239237 });
240238
250248 */
251249 public void showContextInformation(final IContextInformation info, final int offset) {
252250 Control control= fContentAssistSubjectControlAdapter.getControl();
253 BusyIndicator.showWhile(control.getDisplay(), new Runnable() {
254 @Override
255 public void run() {
256 if (info == null)
251 BusyIndicator.showWhile(control.getDisplay(), () -> {
252 if (info == null)
253 validateContextInformation();
254 else {
255 ContextFrame frame= createContextFrame(info, offset);
256 if (isDuplicate(frame))
257257 validateContextInformation();
258 else {
259 ContextFrame frame= createContextFrame(info, offset);
260 if (isDuplicate(frame))
261 validateContextInformation();
262 else
263 internalShowContextInfo(frame);
264 hideContextSelector();
265 }
258 else
259 internalShowContextInfo(frame);
260 hideContextSelector();
266261 }
267262 });
268263 }
541536 final ITextViewerExtension textViewerExtension= (ITextViewerExtension)fViewer;
542537 final StyledText textWidget= fViewer.getTextWidget();
543538
544 final VerifyKeyListener verifyListener= new VerifyKeyListener() {
545 @Override
546 public void verifyKey(VerifyEvent event) {
547 if (isActive() && event.keyCode == 13 && event.character == '\r' && event.widget == textWidget) {
548 event.doit= false;
549 insertSelectedContext();
550 hideContextSelector();
551 }
539 final VerifyKeyListener verifyListener= event -> {
540 if (isActive() && event.keyCode == 13 && event.character == '\r' && event.widget == textWidget) {
541 event.doit= false;
542 insertSelectedContext();
543 hideContextSelector();
552544 }
553545 };
554546
555547 textViewerExtension.prependVerifyKeyListener(verifyListener);
556548
557 fContextSelectorShell.addDisposeListener(new DisposeListener() {
558 @Override
559 public void widgetDisposed(DisposeEvent e) {
560 textViewerExtension.removeVerifyKeyListener(verifyListener);
561 }
562 });
549 fContextSelectorShell.addDisposeListener(e -> textViewerExtension.removeVerifyKeyListener(verifyListener));
563550 }
564551
565552 fContextSelectorTable= new Table(fContextSelectorShell, SWT.H_SCROLL | SWT.V_SCROLL);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2015, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /**
11 * Copyright (c) 2012 Darmstadt University of Technology and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Marcel Bruch, bruch@cs.tu-darmstadt.de - [content assist] Allow to re-sort proposals - https://bugs.eclipse.org/bugs/show_bug.cgi?id=350991
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2017 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
145148 public void focusLost(final FocusEvent e) {
146149 fScrollbarClicked= false;
147150 Display d= fTable.getDisplay();
148 d.asyncExec(new Runnable() {
149 @Override
150 public void run() {
151 if (Helper.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked && fContentAssistant != null)
152 fContentAssistant.popupFocusLost(e);
153 }
151 d.asyncExec(() -> {
152 if (Helper.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked && fContentAssistant != null)
153 fContentAssistant.popupFocusLost(e);
154154 });
155155 }
156156
157157 @Override
158158 public void shellDeactivated(ShellEvent e) {
159159 if (fContentAssistant != null && fDisplay != null) {
160 fDisplay.asyncExec(new Runnable() {
161 @Override
162 public void run() {
163 /*
164 * The asyncExec is a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=235556 :
165 * fContentAssistant.hasProposalPopupFocus() is still true during the shellDeactivated(..) event.
166 */
167 if (fContentAssistant != null && ! fContentAssistant.hasProposalPopupFocus())
168 fContentAssistant.hide();
169 }
160 fDisplay.asyncExec(() -> {
161 /*
162 * The asyncExec is a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=235556 :
163 * fContentAssistant.hasProposalPopupFocus() is still true during the shellDeactivated(..) event.
164 */
165 if (fContentAssistant != null && !fContentAssistant.hasProposalPopupFocus())
166 fContentAssistant.hide();
170167 });
171168 }
172169 }
220217 final IInputChangedListener inputChangeListener= new DelayedInputChangeListener(delayedICP, fAdditionalInfoController.getInternalAccessor().getInformationControlReplacer());
221218 delayedICP.setDelayedInputChangeListener(inputChangeListener);
222219 // cancel automatic input updating after a small timeout:
223 control.getShell().getDisplay().timerExec(1000, new Runnable() {
224 @Override
225 public void run() {
226 delayedICP.setDelayedInputChangeListener(null);
227 }
228 });
220 control.getShell().getDisplay().timerExec(1000, () -> delayedICP.setDelayedInputChangeListener(null));
229221 }
230222
231223 // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 :
232 control.getShell().getDisplay().asyncExec(new Runnable() {
233 @Override
234 public void run() {
235 fAdditionalInfoController.getInternalAccessor().replaceInformationControl(true);
236 }
237 });
224 control.getShell().getDisplay().asyncExec(() -> fAdditionalInfoController.getInternalAccessor().replaceInformationControl(true));
238225 }
239226 }
240227 }
250237 Control control= (Control) event.widget;
251238 IInformationControlExtension5 iControl5= (IInformationControlExtension5) iControl;
252239 if (iControl5.containsControl(control)) {
253 control.getDisplay().asyncExec(new Runnable() {
254 @Override
255 public void run() {
256 if (fContentAssistant != null && ! fContentAssistant.hasProposalPopupFocus())
257 fContentAssistant.hide();
258 }
240 control.getDisplay().asyncExec(() -> {
241 if (fContentAssistant != null && !fContentAssistant.hasProposalPopupFocus())
242 fContentAssistant.hide();
259243 });
260244 }
261245 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
296299
297300 StyledText widget= fTextViewer.getTextWidget();
298301 if (widget != null && !widget.isDisposed()) {
299 widget.getDisplay().asyncExec(new Runnable() {
300 @Override
301 public void run() {
302 hideHyperlinks();
303 }
304 });
302 widget.getDisplay().asyncExec(() -> hideHyperlinks());
305303 }
306304 }
307305 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2008 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
170173 @Override
171174 public void focusLost(FocusEvent e) {
172175 Display d= fSubjectControl.getDisplay();
173 d.asyncExec(new Runnable() {
174 // Without the asyncExec, mouse clicks to the workbench window are swallowed.
175 @Override
176 public void run() {
177 if (fInformationControlToClose == null || !fInformationControlToClose.isFocusControl())
178 hideInformationControl();
179 }
176 // Without the asyncExec, mouse clicks to the workbench window are swallowed.
177 d.asyncExec(() -> {
178 if (fInformationControlToClose == null || !fInformationControlToClose.isFocusControl())
179 hideInformationControl();
180180 });
181181 }
182182
00 /*******************************************************************************
1 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
3942 import org.eclipse.jface.text.BadPartitioningException;
4043 import org.eclipse.jface.text.BadPositionCategoryException;
4144 import org.eclipse.jface.text.DefaultPositionUpdater;
42 import org.eclipse.jface.text.DocumentCommand;
4345 import org.eclipse.jface.text.DocumentEvent;
4446 import org.eclipse.jface.text.IAutoEditStrategy;
4547 import org.eclipse.jface.text.IDocument;
332334 else
333335 {
334336 // Post in UI thread since the assistant popup will only get the focus after we lose it.
335 display.asyncExec(new Runnable() {
336 @Override
337 public void run() {
338 if (fIsActive && viewer instanceof IEditingSupportRegistry) {
339 IEditingSupport[] helpers= ((IEditingSupportRegistry) viewer).getRegisteredSupports();
340 for (IEditingSupport helper : helpers) {
341 if (helper.ownsFocusShell())
342 return;
343 }
337 display.asyncExec(() -> {
338 if (fIsActive && viewer instanceof IEditingSupportRegistry) {
339 IEditingSupport[] helpers= ((IEditingSupportRegistry) viewer).getRegisteredSupports();
340 for (IEditingSupport helper : helpers) {
341 if (helper.ownsFocusShell())
342 return;
344343 }
345
346 // else
347 leave(ILinkedModeListener.EXIT_ALL);
348
349344 }
345
346 // else
347 leave(ILinkedModeListener.EXIT_ALL);
348
350349 });
351350 }
352351 }
605604 private boolean fHasOpenCompoundChange= false;
606605 /** The position listener. */
607606 private ILinkedModeUIFocusListener fPositionListener= new EmtpyFocusListener();
608 private IAutoEditStrategy fAutoEditVetoer= new IAutoEditStrategy() {
609
610 @Override
611 public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
612 // invalidate the change to ensure that the change is performed on the document only.
613 if (fModel.anyPositionContains(command.offset)) {
614 command.doit= false;
615 command.caretOffset= command.offset + command.length;
616 }
617
618 }
607
608 private IAutoEditStrategy fAutoEditVetoer= (document, command) -> {
609 // invalidate the change to ensure that the change is performed on the document only.
610 if (fModel.anyPositionContains(command.offset)) {
611 command.doit= false;
612 command.caretOffset= command.offset + command.length;
613 }
614
619615 };
620616
621617
969965 return;
970966
971967 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=132263
972 widget.getDisplay().asyncExec(new Runnable() {
973 @Override
974 public void run() {
975 if (!widget.isDisposed())
976 try {
968 widget.getDisplay().asyncExec(() -> {
969 if (!widget.isDisposed())
970 try {
977971 widget.showSelection();
978 } catch (IllegalArgumentException e) {
979 /*
980 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66914
981 * if the StyledText is in setRedraw(false) mode, its
982 * selection may not be up2date and calling showSelection
983 * will throw an IAE.
984 * We don't have means to find out whether the selection is valid
985 * or whether the widget is redrawing or not therefore we try
986 * and ignore an IAE.
987 */
988 }
989 }
972 } catch (IllegalArgumentException e) {
973 /*
974 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66914
975 * if the StyledText is in setRedraw(false) mode, its
976 * selection may not be up2date and calling showSelection
977 * will throw an IAE.
978 * We don't have means to find out whether the selection is valid
979 * or whether the widget is redrawing or not therefore we try
980 * and ignore an IAE.
981 */
982 }
990983 });
991984 }
992985
11561149
11571150 fModel.stopForwarding(flags);
11581151
1159 Runnable runnable= new Runnable() {
1160 @Override
1161 public void run() {
1162 if (fExitPosition != null)
1163 fExitPosition.getDocument().removePosition(fExitPosition);
1164
1165 for (IDocument doc : docs) {
1166 doc.removePositionUpdater(fPositionUpdater);
1167 boolean uninstallCat= false;
1168 String[] cats= doc.getPositionCategories();
1169 for (String cat : cats) {
1170 if (getCategory().equals(cat)) {
1171 uninstallCat= true;
1172 break;
1173 }
1152 Runnable runnable= () -> {
1153 if (fExitPosition != null)
1154 fExitPosition.getDocument().removePosition(fExitPosition);
1155
1156 for (IDocument doc : docs) {
1157 doc.removePositionUpdater(fPositionUpdater);
1158 boolean uninstallCat= false;
1159 String[] cats= doc.getPositionCategories();
1160 for (String cat : cats) {
1161 if (getCategory().equals(cat)) {
1162 uninstallCat= true;
1163 break;
11741164 }
1175 if (uninstallCat)
1176 try {
1177 doc.removePositionCategory(getCategory());
1178 } catch (BadPositionCategoryException e) {
1179 // ignore
1180 }
11811165 }
1182 fModel.exit(flags);
1183 }
1166 if (uninstallCat)
1167 try {
1168 doc.removePositionCategory(getCategory());
1169 } catch (BadPositionCategoryException e) {
1170 // ignore
1171 }
1172 }
1173 fModel.exit(flags);
11841174 };
11851175
11861176 // remove positions (both exit positions AND linked positions in the
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
10661069 // changes any more. If the document gets modified between
10671070 // now and running the posted runnable, the position information
10681071 // is not accurate any longer.
1069 textWidgetDisplay.asyncExec(new Runnable() {
1070 @Override
1071 public void run() {
1072 if (fTextWidget != null && !fTextWidget.isDisposed())
1073 updatePainting(event);
1074 }
1072 textWidgetDisplay.asyncExec(() -> {
1073 if (fTextWidget != null && !fTextWidget.isDisposed())
1074 updatePainting(event);
10751075 });
10761076 }
10771077 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2528 import org.eclipse.swt.custom.StyledText;
2629 import org.eclipse.swt.events.ControlAdapter;
2730 import org.eclipse.swt.events.ControlEvent;
28 import org.eclipse.swt.events.DisposeEvent;
29 import org.eclipse.swt.events.DisposeListener;
3031 import org.eclipse.swt.events.MouseEvent;
3132 import org.eclipse.swt.events.MouseListener;
32 import org.eclipse.swt.events.MouseMoveListener;
33 import org.eclipse.swt.events.MouseWheelListener;
34 import org.eclipse.swt.events.PaintEvent;
35 import org.eclipse.swt.events.PaintListener;
3633 import org.eclipse.swt.graphics.Cursor;
3734 import org.eclipse.swt.graphics.Font;
3835 import org.eclipse.swt.graphics.GC;
263260
264261 fCanvas= createCanvas(parentControl);
265262
266 fCanvas.addPaintListener(new PaintListener() {
267 @Override
268 public void paintControl(PaintEvent event) {
269 if (fCachedTextViewer != null)
270 doubleBufferPaint(event.gc);
271 }
263 fCanvas.addPaintListener(event -> {
264 if (fCachedTextViewer != null)
265 doubleBufferPaint(event.gc);
272266 });
273267
274 fCanvas.addDisposeListener(new DisposeListener() {
275 @Override
276 public void widgetDisposed(DisposeEvent e) {
277 handleDispose();
278 fCachedTextViewer= null;
279 fCachedTextWidget= null;
280 }
268 fCanvas.addDisposeListener(e -> {
269 handleDispose();
270 fCachedTextViewer= null;
271 fCachedTextWidget= null;
281272 });
282273
283274 fMouseListener= new MouseListener() {
322313 };
323314 fCanvas.addMouseListener(fMouseListener);
324315
325 fCanvas.addMouseMoveListener(new MouseMoveListener() {
326 @Override
327 public void mouseMove(MouseEvent e) {
328 handleMouseMove(e);
329 }
330 });
331
332 fCanvas.addMouseWheelListener(new MouseWheelListener() {
333 @Override
334 public void mouseScrolled(MouseEvent e) {
335 handleMouseScrolled(e);
336 }
337 });
316 fCanvas.addMouseMoveListener(e -> handleMouseMove(e));
317
318 fCanvas.addMouseWheelListener(e -> handleMouseScrolled(e));
338319
339320 if (fCachedTextViewer != null) {
340321 VisibleLinesTracker.track(fCachedTextViewer, lineHeightChangeHandler);
844825 if (fCanvas != null && !fCanvas.isDisposed()) {
845826 Display d= fCanvas.getDisplay();
846827 if (d != null) {
847 d.asyncExec(new Runnable() {
848 @Override
849 public void run() {
850 redraw();
851 }
852 });
828 d.asyncExec(() -> redraw());
853829 }
854830 }
855831 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1114
1215 import org.eclipse.swt.SWT;
1316 import org.eclipse.swt.custom.StyledText;
14 import org.eclipse.swt.events.DisposeEvent;
15 import org.eclipse.swt.events.DisposeListener;
1617 import org.eclipse.swt.events.MouseEvent;
1718 import org.eclipse.swt.events.MouseListener;
1819 import org.eclipse.swt.events.MouseMoveListener;
19 import org.eclipse.swt.events.PaintEvent;
20 import org.eclipse.swt.events.PaintListener;
2120 import org.eclipse.swt.graphics.Color;
2221 import org.eclipse.swt.graphics.Font;
2322 import org.eclipse.swt.graphics.GC;
188187 fCanvas= new Canvas(parentControl, SWT.NONE);
189188 fCanvas.setBackground(getBackground());
190189
191 fCanvas.addPaintListener(new PaintListener() {
192 @Override
193 public void paintControl(PaintEvent event) {
194 if (fCachedTextViewer != null)
195 doubleBufferPaint(event.gc);
196 }
190 fCanvas.addPaintListener(event -> {
191 if (fCachedTextViewer != null)
192 doubleBufferPaint(event.gc);
197193 });
198194
199 fCanvas.addDisposeListener(new DisposeListener() {
200 @Override
201 public void widgetDisposed(DisposeEvent e) {
202 handleDispose();
203 fCachedTextViewer= null;
204 fCachedTextWidget= null;
205 }
195 fCanvas.addDisposeListener(e -> {
196 handleDispose();
197 fCachedTextViewer= null;
198 fCachedTextWidget= null;
206199 });
207200
208201 fCanvas.addMouseListener(fMouseHandler);
428421 if (fCanvas != null && !fCanvas.isDisposed()) {
429422 Display d= fCanvas.getDisplay();
430423 if (d != null) {
431 d.asyncExec(new Runnable() {
432 @Override
433 public void run() {
434 redraw();
435 }
436 });
424 d.asyncExec(() -> redraw());
437425 }
438426 }
439427 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2023 import org.eclipse.swt.SWT;
2124 import org.eclipse.swt.custom.StyledText;
2225 import org.eclipse.swt.events.ControlListener;
23 import org.eclipse.swt.events.DisposeEvent;
2426 import org.eclipse.swt.events.DisposeListener;
2527 import org.eclipse.swt.events.FocusListener;
2628 import org.eclipse.swt.events.GestureListener;
3840 import org.eclipse.swt.widgets.Composite;
3941 import org.eclipse.swt.widgets.Control;
4042 import org.eclipse.swt.widgets.Display;
41 import org.eclipse.swt.widgets.Event;
4243 import org.eclipse.swt.widgets.Layout;
4344 import org.eclipse.swt.widgets.Listener;
4445 import org.eclipse.swt.widgets.Menu;
141142 */
142143 public CompositeRulerCanvas(Composite parent, int style) {
143144 super(parent, style);
144 fMenuDetectListener= new Listener() {
145 @Override
146 public void handleEvent(Event event) {
147 if (event.type == SWT.MenuDetect) {
148 Menu menu= getMenu();
149 if (menu != null) {
150 menu.setLocation(event.x, event.y);
151 menu.setVisible(true);
152 }
145 fMenuDetectListener= event -> {
146 if (event.type == SWT.MenuDetect) {
147 Menu menu= getMenu();
148 if (menu != null) {
149 menu.setLocation(event.x, event.y);
150 menu.setVisible(true);
153151 }
154152 }
155153 };
156 super.addDisposeListener(new DisposeListener() {
157 @Override
158 public void widgetDisposed(DisposeEvent e) {
159 if (fCachedListeners != null) {
160 fCachedListeners.clear();
161 fCachedListeners= null;
162 }
154 super.addDisposeListener(e -> {
155 if (fCachedListeners != null) {
156 fCachedListeners.clear();
157 fCachedListeners= null;
163158 }
164159 });
165160 }
639634 if (fComposite != null && !fComposite.isDisposed()) {
640635 Display d= fComposite.getDisplay();
641636 if (d != null) {
642 d.asyncExec(new Runnable() {
643 @Override
644 public void run() {
645 immediateUpdate();
646 }
647 });
637 d.asyncExec(() -> immediateUpdate());
648638 }
649639 }
650640 }
727717 try {
728718 IRegion r= viewer.getVisibleRegion();
729719 IDocument d= viewer.getDocument();
730 return widgetLine += d.getLineOfOffset(r.getOffset());
720 return widgetLine + d.getLineOfOffset(r.getOffset());
731721 } catch (BadLocationException x) {
732722 }
733723 return widgetLine;
00 /*******************************************************************************
11 * Copyright (c) 2007, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Christian Plesner Hansen (plesner@quenta.org) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2017, 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2225 import org.eclipse.swt.custom.StyledText;
2326 import org.eclipse.swt.events.ControlAdapter;
2427 import org.eclipse.swt.events.ControlEvent;
25 import org.eclipse.swt.events.DisposeEvent;
26 import org.eclipse.swt.events.DisposeListener;
2728 import org.eclipse.swt.events.MouseEvent;
2829 import org.eclipse.swt.events.MouseListener;
2930 import org.eclipse.swt.events.MouseMoveListener;
3031 import org.eclipse.swt.events.MouseWheelListener;
31 import org.eclipse.swt.events.PaintEvent;
32 import org.eclipse.swt.events.PaintListener;
3332 import org.eclipse.swt.graphics.Color;
3433 import org.eclipse.swt.graphics.Font;
3534 import org.eclipse.swt.graphics.FontData;
412411 * Redraw runnable
413412 * @since 3.0
414413 */
415 private Runnable fRunnable= new Runnable() {
416 @Override
417 public void run() {
418 synchronized (fRunnableLock) {
419 fIsRunnablePosted= false;
420 }
421 redraw();
422 }
414 private Runnable fRunnable= () -> {
415 synchronized (fRunnableLock) {
416 fIsRunnablePosted= false;
417 }
418 redraw();
423419 };
424420 /* @since 3.2 */
425421 private MouseHandler fMouseHandler;
631627 fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
632628 fCanvas.setForeground(fForeground);
633629
634 fCanvas.addPaintListener(new PaintListener() {
635 @Override
636 public void paintControl(PaintEvent event) {
637 if (fCachedTextViewer != null)
638 doubleBufferPaint(event.gc);
639 }
630 fCanvas.addPaintListener(event -> {
631 if (fCachedTextViewer != null)
632 doubleBufferPaint(event.gc);
640633 });
641634
642 fCanvas.addDisposeListener(new DisposeListener() {
643 @Override
644 public void widgetDisposed(DisposeEvent e) {
645 handleDispose();
646 fCachedTextViewer= null;
647 fCachedTextWidget= null;
648 }
635 fCanvas.addDisposeListener(e -> {
636 handleDispose();
637 fCachedTextViewer= null;
638 fCachedTextWidget= null;
649639 });
650640
651641 fMouseHandler= new MouseHandler();
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2124 import org.eclipse.swt.custom.StyledText;
2225 import org.eclipse.swt.events.ControlAdapter;
2326 import org.eclipse.swt.events.ControlEvent;
24 import org.eclipse.swt.events.DisposeEvent;
25 import org.eclipse.swt.events.DisposeListener;
2627 import org.eclipse.swt.events.MouseAdapter;
2728 import org.eclipse.swt.events.MouseEvent;
28 import org.eclipse.swt.events.MouseMoveListener;
2929 import org.eclipse.swt.events.MouseTrackAdapter;
30 import org.eclipse.swt.events.MouseWheelListener;
3130 import org.eclipse.swt.events.PaintEvent;
3231 import org.eclipse.swt.events.PaintListener;
3332 import org.eclipse.swt.graphics.Color;
474473 * Redraw runnable
475474 * @since 3.3
476475 */
477 private Runnable fRunnable= new Runnable() {
478 @Override
479 public void run() {
480 synchronized (fRunnableLock) {
481 fIsRunnablePosted= false;
482 }
483 redraw();
484 updateHeader();
485 }
476 private Runnable fRunnable= () -> {
477 synchronized (fRunnableLock) {
478 fIsRunnablePosted= false;
479 }
480 redraw();
481 updateHeader();
486482 };
487483 /**
488484 * Tells whether temporary annotations are drawn with
583579
584580 fCanvas= new Canvas(parent, SWT.NO_BACKGROUND);
585581
586 fCanvas.addPaintListener(new PaintListener() {
587 @Override
588 public void paintControl(PaintEvent event) {
589 if (fTextViewer != null)
590 doubleBufferPaint(event.gc);
591 }
582 fCanvas.addPaintListener(event -> {
583 if (fTextViewer != null)
584 doubleBufferPaint(event.gc);
592585 });
593586
594 fCanvas.addDisposeListener(new DisposeListener() {
595 @Override
596 public void widgetDisposed(DisposeEvent event) {
597 handleDispose();
598 fTextViewer= null;
599 }
587 fCanvas.addDisposeListener(event -> {
588 handleDispose();
589 fTextViewer= null;
600590 });
601591
602592 fCanvas.addMouseListener(new MouseAdapter() {
606596 }
607597 });
608598
609 fCanvas.addMouseMoveListener(new MouseMoveListener() {
610 @Override
611 public void mouseMove(MouseEvent event) {
612 handleMouseMove(event);
613 }
614 });
615
616 fCanvas.addMouseWheelListener(new MouseWheelListener() {
617 @Override
618 public void mouseScrolled(MouseEvent e) {
619 handleMouseScrolled(e);
620 }
621 });
599 fCanvas.addMouseMoveListener(event -> handleMouseMove(event));
600
601 fCanvas.addMouseWheelListener(e -> handleMouseScrolled(e));
622602
623603 if (fTextViewer != null) {
624604 fTextViewer.addTextListener(fInternalListener);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1417
1518 import org.eclipse.swt.SWT;
1619 import org.eclipse.swt.custom.StyledText;
17 import org.eclipse.swt.events.DisposeEvent;
18 import org.eclipse.swt.events.DisposeListener;
1920 import org.eclipse.swt.events.MouseEvent;
2021 import org.eclipse.swt.events.MouseListener;
21 import org.eclipse.swt.events.PaintEvent;
22 import org.eclipse.swt.events.PaintListener;
2322 import org.eclipse.swt.graphics.Font;
2423 import org.eclipse.swt.graphics.GC;
2524 import org.eclipse.swt.graphics.Image;
149148
150149 fCanvas= new Canvas(parent, SWT.NO_BACKGROUND);
151150
152 fCanvas.addPaintListener(new PaintListener() {
153 @Override
154 public void paintControl(PaintEvent event) {
155 if (fTextViewer != null)
156 doubleBufferPaint(event.gc);
157 }
151 fCanvas.addPaintListener(event -> {
152 if (fTextViewer != null)
153 doubleBufferPaint(event.gc);
158154 });
159155
160 fCanvas.addDisposeListener(new DisposeListener() {
161 @Override
162 public void widgetDisposed(DisposeEvent e) {
163 handleDispose();
164 fTextViewer= null;
165 }
156 fCanvas.addDisposeListener(e -> {
157 handleDispose();
158 fTextViewer= null;
166159 });
167160
168161 fCanvas.addMouseListener(new MouseListener() {
456449 if (fCanvas != null && !fCanvas.isDisposed()) {
457450 Display d= fCanvas.getDisplay();
458451 if (d != null) {
459 d.asyncExec(new Runnable() {
460 @Override
461 public void run() {
462 redraw();
463 }
464 });
452 d.asyncExec(() -> redraw());
465453 }
466454 }
467455 }
550538 try {
551539 IRegion r= viewer.getVisibleRegion();
552540 IDocument d= viewer.getDocument();
553 return widgetLine += d.getLineOfOffset(r.getOffset());
541 return widgetLine + d.getLineOfOffset(r.getOffset());
554542 } catch (BadLocationException x) {
555543 }
556544 return widgetLine;
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /**
11 * Copyright (c) 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 527720 - [CodeMining] Line number in vertical ruler can be not synchronized with line header annotation
00 /**
11 * Copyright (c) 2017, 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
4548 * Draw the inlined annotation.
4649 *
4750 * @param annotation the annotation to be drawn
48 * @param gc the graphics context, <code>null</code> when in clearing mode
51 * @param gc the graphics context, <code>null</code> when in clearing mode
4952 * @param textWidget the text widget to draw on
50 * @param offset the offset of the line
51 * @param length the length of the line
52 * @param color the color of the line
53 * @param offset the offset of the line
54 * @param length the length of the line
55 * @param color the color of the line
5356 */
5457 public static void draw(AbstractInlinedAnnotation annotation, GC gc, StyledText textWidget, int offset, int length,
5558 Color color) {
6467 * Draw the line header annotation in the line spacing of the previous line.
6568 *
6669 * @param annotation the annotation to be drawn
67 * @param gc the graphics context, <code>null</code> when in clearing mode
70 * @param gc the graphics context, <code>null</code> when in clearing mode
6871 * @param textWidget the text widget to draw on
69 * @param offset the offset of the line
70 * @param length the length of the line
71 * @param color the color of the line
72 * @param offset the offset of the line
73 * @param length the length of the line
74 * @param color the color of the line
7275 */
7376 private static void draw(LineHeaderAnnotation annotation, GC gc, StyledText textWidget, int offset, int length,
7477 Color color) {
7881 } catch (Exception e) {
7982 return;
8083 }
81 if (annotation.isMarkedDeleted() || annotation.getPosition().isDeleted()) {
84 if (isDeleted(annotation)) {
8285 // When annotation is deleted, update metrics to null to remove extra spaces of the line header annotation.
83 if (style != null) {
86 if (style != null && style.metrics != null) {
8487 style.metrics= null;
8588 textWidget.setStyleRange(style);
8689 }
162165 * Returns the style to apply with GlyphMetrics ascent only if needed.
163166 *
164167 * @param annotation the line header annotation
165 * @param style the current style and null otherwise.
168 * @param style the current style and null otherwise.
166169 * @return the style to apply with GlyphMetrics ascent only if needed.
167170 */
168171 static StyleRange updateStyle(LineHeaderAnnotation annotation, StyleRange style) {
209212 * {@link GlyphMetrics}.
210213 *
211214 * @param annotation the annotation to be drawn
212 * @param gc the graphics context, <code>null</code> when in clearing mode
215 * @param gc the graphics context, <code>null</code> when in clearing mode
213216 * @param textWidget the text widget to draw on
214 * @param offset the offset of the line
215 * @param length the length of the line
216 * @param color the color of the line
217 * @param offset the offset of the line
218 * @param length the length of the line
219 * @param color the color of the line
217220 */
218221 private static void draw(LineContentAnnotation annotation, GC gc, StyledText textWidget, int offset, int length,
219222 Color color) {
223226 } catch (Exception e) {
224227 return;
225228 }
226 if (annotation.isMarkedDeleted() || annotation.getPosition().isDeleted()) {
229 if (isDeleted(annotation)) {
227230 // When annotation is deleted, update metrics to null to remove extra spaces of the line content annotation.
228 if (style != null) {
231 if (style != null && style.metrics != null) {
229232 style.metrics= null;
230233 textWidget.setStyleRange(style);
231234 }
241244 String s= textWidget.getText(offset, offset);
242245 Point charBounds= gc.stringExtent(s);
243246 int charWidth= charBounds.x;
244 int charHeight= charBounds.y;
245247
246248 // When line text has line header annotation, there is a space on the top, adjust the y by using char height
247 y+= bounds.height - charHeight;
249 y+= bounds.height - textWidget.getLineHeight();
248250
249251 // Draw the line content annotation
250252 annotation.setLocation(x, y);
301303 * Returns the style to apply with GlyphMetrics width only if needed.
302304 *
303305 * @param annotation the line content annotation
304 * @param style the current style and null otherwise.
306 * @param style the current style and null otherwise.
305307 * @return the style to apply with GlyphMetrics width only if needed.
306308 */
307309 static StyleRange updateStyle(LineContentAnnotation annotation, StyleRange style) {
337339 style.metrics= metrics;
338340 return style;
339341 }
342
343 /**
344 * Returns <code>true</code> if inlined annotation is deleted and <code>false</code> otherwise.
345 *
346 * @param annotation the inlined annotation to check
347 * @return <code>true</code> if inlined annotation is deleted and <code>false</code> otherwise.
348 */
349 private static boolean isDeleted(AbstractInlinedAnnotation annotation) {
350 return annotation.isMarkedDeleted() || annotation.getPosition().isDeleted() || annotation.getPosition().getLength() == 0;
351 }
340352 }
00 /**
11 * Copyright (c) 2017, 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
00 /**
1 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2017, 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
7780 protected int drawAndComputeWidth(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) {
7881 // Draw the text annotation and returns the width
7982 super.draw(gc, textWidget, offset, length, color, x, y);
80 return gc.stringExtent(getText()).x + 2 * gc.getFontMetrics().getAverageCharWidth();
83 return (int) (gc.stringExtent(getText()).x + 2 * gc.getFontMetrics().getAverageCharacterWidth());
8184 }
8285
8386 int getRedrawnCharacterWidth() {
00 /**
11 * Copyright (c) 2017, 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1013 package org.eclipse.jface.text.templates;
1114
1215 import java.util.Iterator;
13 import java.util.LinkedHashMap;
14 import java.util.Map;
1516
1617 /**
1718 * A registry for context types. Editor implementors will usually instantiate a
2223 * </p>
2324 *
2425 * @since 3.0
26 * @deprecated See {@link ContextTypeRegistry} from org.eclipse.text
2527 */
26 public class ContextTypeRegistry {
28 @Deprecated
29 public class ContextTypeRegistry extends org.eclipse.text.templates.ContextTypeRegistry {
2730
28 /** all known context types */
29 private final Map<String, TemplateContextType> fContextTypes= new LinkedHashMap<>();
30
31 /**
32 * Adds a context type to the registry. If there already is a context type
33 * with the same ID registered, it is replaced.
34 *
35 * @param contextType the context type to add
36 */
31 @Override
3732 public void addContextType(TemplateContextType contextType) {
38 fContextTypes.put(contextType.getId(), contextType);
33 super.addContextType(contextType);
3934 }
4035
41 /**
42 * Returns the context type if the id is valid, <code>null</code> otherwise.
43 *
44 * @param id the id of the context type to retrieve
45 * @return the context type if <code>name</code> is valid, <code>null</code> otherwise
46 */
36 @Override
4737 public TemplateContextType getContextType(String id) {
48 return fContextTypes.get(id);
38 return super.getContextType(id);
4939 }
5040
51 /**
52 * Returns an iterator over all registered context types.
53 *
54 * @return an iterator over all registered context types
55 */
41 @Override
5642 public Iterator<TemplateContextType> contextTypes() {
57 return fContextTypes.values().iterator();
43 return super.contextTypes();
5844 }
5945 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
912 *******************************************************************************/
1013 package org.eclipse.jface.text.templates.persistence;
11
12 import org.eclipse.core.runtime.Assert;
1314
1415 import org.eclipse.jface.text.templates.Template;
1516
2627 *
2728 * @since 3.0
2829 * @noextend This class is not intended to be subclassed by clients.
30 * @deprecated See {@link org.eclipse.text.templates.TemplatePersistenceData}
2931 */
30 public class TemplatePersistenceData {
31 private final Template fOriginalTemplate;
32 private final String fId;
33 private final boolean fOriginalIsEnabled;
32 @Deprecated
33 public class TemplatePersistenceData extends org.eclipse.text.templates.TemplatePersistenceData {
3434
35 private Template fCustomTemplate= null;
36 private boolean fIsDeleted= false;
37 private boolean fCustomIsEnabled= true;
35 org.eclipse.text.templates.TemplatePersistenceData ref;
3836
3937 /**
40 * Creates a new, user-added instance that is not linked to a contributed
41 * template.
38 * In some cases, we must continue to respect the deprecated TemplatePresistenceData
39 * even though we are given {@link org.eclipse.text.templates.TemplatePersistenceData}.
4240 *
43 * @param template the template which is stored by the new instance
44 * @param enabled whether the template is enabled
41 * @param data The {@link org.eclipse.text.templates.TemplatePersistenceData} that will
42 * underlie this object.
43 * @since 3.14
4544 */
46 public TemplatePersistenceData(Template template, boolean enabled) {
47 this(template, enabled, null);
45 public TemplatePersistenceData(org.eclipse.text.templates.TemplatePersistenceData data) {
46 super(data.getTemplate(), data.isEnabled(), data.getId()); // these are ignored
47 this.ref= data;
4848 }
4949
50 /**
51 * Creates a new instance. If <code>id</code> is not <code>null</code>,
52 * the instance is represents a template that is contributed and can be
53 * identified via its id.
54 *
55 * @param template the template which is stored by the new instance
56 * @param enabled whether the template is enabled
57 * @param id the id of the template, or <code>null</code> if a user-added
58 * instance should be created
59 */
60 public TemplatePersistenceData(Template template, boolean enabled, String id) {
61 Assert.isNotNull(template);
62 fOriginalTemplate= template;
63 fCustomTemplate= template;
64 fOriginalIsEnabled= enabled;
65 fCustomIsEnabled= enabled;
66 fId= id;
50 public TemplatePersistenceData(Template template, boolean enabled) {
51 super(template, enabled);
6752 }
6853
69 /**
70 * Returns the id of this template store, or <code>null</code> if there is none.
71 *
72 * @return the id of this template store
73 */
74 public String getId() {
75 return fId;
54 public TemplatePersistenceData(Template template, boolean enabled, String id) {
55 super(template, enabled, id);
7656 }
7757
78 /**
79 * Returns the deletion state of the stored template. This is only relevant
80 * of contributed templates.
81 *
82 * @return the deletion state of the stored template
83 */
84 public boolean isDeleted() {
85 return fIsDeleted;
58 @Override
59 public String getId() {
60 return (ref != null) ? ref.getId() : super.getId();
8661 }
8762
88 /**
89 * Sets the deletion state of the stored template.
90 *
91 * @param isDeleted the deletion state of the stored template
92 */
93 public void setDeleted(boolean isDeleted) {
94 fIsDeleted= isDeleted;
63 @Override
64 public boolean isDeleted() {
65 return (ref != null) ? ref.isDeleted() : super.isDeleted();
9566 }
9667
97 /**
98 * Returns the template encapsulated by the receiver.
99 *
100 * @return the template encapsulated by the receiver
101 */
102 public Template getTemplate() {
103 return fCustomTemplate;
68 @Override
69 public void setDeleted(boolean isDeleted) {
70 if (ref != null) {
71 ref.setDeleted(isDeleted);
72 } else {
73 super.setDeleted(isDeleted);
74 }
10475 }
10576
106
107 /**
108 * Sets the template encapsulated by the receiver.
109 *
110 * @param template the new template
111 */
112 public void setTemplate(Template template) {
113 fCustomTemplate= template;
77 @Override
78 public Template getTemplate() {
79 return (ref != null) ? ref.getTemplate() : super.getTemplate();
11480 }
11581
116 /**
117 * Returns whether the receiver represents a custom template, i.e. is either
118 * a user-added template or a contributed template that has been modified.
119 *
120 * @return <code>true</code> if the contained template is a custom
121 * template and cannot be reconstructed from the contributed
122 * templates
123 */
124 public boolean isCustom() {
125 return fId == null
126 || fIsDeleted
127 || fOriginalIsEnabled != fCustomIsEnabled
128 || !fOriginalTemplate.equals(fCustomTemplate);
82 @Override
83 public void setTemplate(Template template) {
84 if (ref != null) {
85 ref.setTemplate(template);
86 } else {
87 super.setTemplate(template);
88 }
12989 }
13090
131 /**
132 * Returns whether the receiver represents a modified template, i.e. a
133 * contributed template that has been changed.
134 *
135 * @return <code>true</code> if the contained template is contributed but has been modified, <code>false</code> otherwise
136 */
137 public boolean isModified() {
138 return isCustom() && !isUserAdded();
91 @Override
92 public boolean isCustom() {
93 return (ref != null) ? ref.isCustom() : super.isCustom();
13994 }
14095
141 /**
142 * Returns <code>true</code> if the contained template was added by a
143 * user, i.e. does not reference a contributed template.
144 *
145 * @return <code>true</code> if the contained template was added by a user, <code>false</code> otherwise
146 */
147 public boolean isUserAdded() {
148 return fId == null;
96 @Override
97 public boolean isModified() {
98 return (ref != null) ? ref.isModified() : super.isModified();
14999 }
150100
151
152 /**
153 * Reverts the template to its original setting.
154 */
155 public void revert() {
156 fCustomTemplate= fOriginalTemplate;
157 fCustomIsEnabled= fOriginalIsEnabled;
158 fIsDeleted= false;
101 @Override
102 public boolean isUserAdded() {
103 return (ref != null) ? ref.isUserAdded() : super.isUserAdded();
159104 }
160105
161
162 /**
163 * Returns the enablement state of the contained template.
164 *
165 * @return the enablement state of the contained template
166 */
167 public boolean isEnabled() {
168 return fCustomIsEnabled;
106 @Override
107 public void revert() {
108 if (ref != null) {
109 ref.revert();
110 } else {
111 super.revert();
112 }
169113 }
170114
171 /**
172 * Sets the enablement state of the contained template.
173 *
174 * @param isEnabled the new enablement state of the contained template
175 */
115 @Override
116 public boolean isEnabled() {
117 return (ref != null) ? ref.isEnabled() : super.isEnabled();
118 }
119
120 @Override
176121 public void setEnabled(boolean isEnabled) {
177 fCustomIsEnabled= isEnabled;
122 if (ref != null) {
123 ref.setEnabled(isEnabled);
124 } else {
125 super.setEnabled(isEnabled);
126 }
178127 }
128
129 @Override
130 public boolean equals(Object other) {
131 return (ref != null) ? ref.equals(other) : super.equals(other);
132 }
133
134 @Override
135 public int hashCode() {
136 return (ref != null) ? ref.hashCode() : super.hashCode();
137 }
138
179139 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
+0
-14
org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.properties less more
0 ###############################################################################
1 # Copyright (c) 2000, 2016 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
4 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 #
7 # Contributors:
8 # IBM Corporation - initial API and implementation
9 ###############################################################################
10
11 TemplateReaderWriter.duplicate.id= Duplicate template id: ''{0}''
12 TemplateReaderWriter.error.missing_attribute= Missing required attribute
13 TemplateReaderWriter.error.illegal_boolean_attribute= Illegal boolean attribute, must be "true" or "false".
00 /*******************************************************************************
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1417 import java.io.OutputStream;
1518 import java.io.Reader;
1619 import java.io.Writer;
17 import java.util.ArrayList;
18 import java.util.Collection;
19 import java.util.HashSet;
20 import java.util.MissingResourceException;
2120 import java.util.ResourceBundle;
22 import java.util.Set;
23
24 import javax.xml.parsers.DocumentBuilder;
25 import javax.xml.parsers.DocumentBuilderFactory;
26 import javax.xml.parsers.ParserConfigurationException;
27 import javax.xml.transform.OutputKeys;
28 import javax.xml.transform.Transformer;
29 import javax.xml.transform.TransformerException;
30 import javax.xml.transform.TransformerFactory;
31 import javax.xml.transform.dom.DOMSource;
32 import javax.xml.transform.stream.StreamResult;
33
34 import org.xml.sax.InputSource;
35 import org.xml.sax.SAXException;
36 import org.xml.sax.helpers.DefaultHandler;
37
38 import org.w3c.dom.Attr;
39 import org.w3c.dom.Document;
40 import org.w3c.dom.NamedNodeMap;
41 import org.w3c.dom.Node;
42 import org.w3c.dom.NodeList;
43 import org.w3c.dom.Text;
44
45 import org.eclipse.osgi.util.NLS;
46
47 import org.eclipse.core.runtime.Assert;
48 import org.eclipse.core.runtime.ILog;
49 import org.eclipse.core.runtime.IStatus;
50 import org.eclipse.core.runtime.Platform;
51 import org.eclipse.core.runtime.Status;
52
53 import org.eclipse.jface.text.templates.Template;
5421
5522
5623 /**
6229 *
6330 * @since 3.0
6431 * @noextend This class is not intended to be subclassed by clients.
32 * @deprecated See {@link org.eclipse.text.templates.TemplateReaderWriter}
6533 */
66 public class TemplateReaderWriter {
34 @Deprecated
35 public class TemplateReaderWriter extends org.eclipse.text.templates.TemplateReaderWriter {
6736
68 private static final String TEMPLATE_ROOT = "templates"; //$NON-NLS-1$
69 private static final String TEMPLATE_ELEMENT = "template"; //$NON-NLS-1$
70 private static final String NAME_ATTRIBUTE= "name"; //$NON-NLS-1$
71 private static final String ID_ATTRIBUTE= "id"; //$NON-NLS-1$
72 private static final String DESCRIPTION_ATTRIBUTE= "description"; //$NON-NLS-1$
73 private static final String CONTEXT_ATTRIBUTE= "context"; //$NON-NLS-1$
74 private static final String ENABLED_ATTRIBUTE= "enabled"; //$NON-NLS-1$
75 private static final String DELETED_ATTRIBUTE= "deleted"; //$NON-NLS-1$
76 /**
77 * @since 3.1
78 */
79 private static final String AUTO_INSERTABLE_ATTRIBUTE= "autoinsert"; //$NON-NLS-1$
80
81 /**
82 * Create a new instance.
83 */
8437 public TemplateReaderWriter() {
8538 }
8639
87 /**
88 * Reads templates from a reader and returns them. The reader must present
89 * a serialized form as produced by the <code>save</code> method.
90 *
91 * @param reader the reader to read templates from
92 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
93 * @throws IOException if reading from the stream fails
94 */
40 @Override
9541 public TemplatePersistenceData[] read(Reader reader) throws IOException {
96 return read(reader, null);
42 org.eclipse.text.templates.TemplatePersistenceData[] list= super.read(reader);
43 TemplatePersistenceData[] result= new TemplatePersistenceData[list.length];
44 for (int i= 0; i < list.length; i++) {
45 result[i]= new TemplatePersistenceData(list[i]);
46 }
47 return result;
9748 }
9849
99 /**
100 * Reads the template with identifier <code>id</code> from a reader and
101 * returns it. The reader must present a serialized form as produced by the
102 * <code>save</code> method.
103 *
104 * @param reader the reader to read templates from
105 * @param id the id of the template to return
106 * @return the read template, encapsulated in an instances of
107 * <code>TemplatePersistenceData</code>
108 * @throws IOException if reading from the stream fails
109 * @since 3.1
110 */
50 @Override
11151 public TemplatePersistenceData readSingle(Reader reader, String id) throws IOException {
112 TemplatePersistenceData[] datas= read(new InputSource(reader), null, id);
113 if (datas.length > 0)
114 return datas[0];
115 return null;
52 return new org.eclipse.jface.text.templates.persistence.TemplatePersistenceData(super.readSingle(reader, id));
11653 }
11754
118 /**
119 * Reads templates from a stream and adds them to the templates.
120 *
121 * @param reader the reader to read templates from
122 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
123 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
124 * @throws IOException if reading from the stream fails
125 */
55 @Override
12656 public TemplatePersistenceData[] read(Reader reader, ResourceBundle bundle) throws IOException {
127 return read(new InputSource(reader), bundle, null);
57 org.eclipse.text.templates.TemplatePersistenceData[] list= super.read(reader, bundle);
58 TemplatePersistenceData[] result= new TemplatePersistenceData[list.length];
59 for (int i= 0; i < list.length; i++) {
60 result[i]= new TemplatePersistenceData(list[i]);
61 }
62 return result;
12863 }
12964
130 /**
131 * Reads templates from a stream and adds them to the templates.
132 *
133 * @param stream the byte stream to read templates from
134 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
135 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
136 * @throws IOException if reading from the stream fails
137 */
65 @Override
13866 public TemplatePersistenceData[] read(InputStream stream, ResourceBundle bundle) throws IOException {
139 return read(new InputSource(stream), bundle, null);
67 org.eclipse.text.templates.TemplatePersistenceData[] list= super.read(stream, bundle);
68 TemplatePersistenceData[] result= new TemplatePersistenceData[list.length];
69 for (int i= 0; i < list.length; i++) {
70 result[i]= new TemplatePersistenceData(list[i]);
71 }
72 return result;
14073 }
14174
142 /**
143 * Reads templates from an <code>InputSource</code> and adds them to the templates.
144 *
145 * @param source the input source
146 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
147 * @param singleId the template id to extract, or <code>null</code> to read in all templates
148 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
149 * @throws IOException if reading from the stream fails
150 */
151 private TemplatePersistenceData[] read(InputSource source, ResourceBundle bundle, String singleId) throws IOException {
152 try {
153 Collection<TemplatePersistenceData> templates= new ArrayList<>();
154 Set<String> ids= new HashSet<>();
155
156 DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
157 DocumentBuilder parser= factory.newDocumentBuilder();
158 parser.setErrorHandler(new DefaultHandler());
159 Document document= parser.parse(source);
160
161 NodeList elements= document.getElementsByTagName(TEMPLATE_ELEMENT);
162
163 int count= elements.getLength();
164 for (int i= 0; i != count; i++) {
165 Node node= elements.item(i);
166 NamedNodeMap attributes= node.getAttributes();
167
168 if (attributes == null)
169 continue;
170
171 String id= getStringValue(attributes, ID_ATTRIBUTE, null);
172 if (id != null && ids.contains(id)) {
173 String PLUGIN_ID= "org.eclipse.jface.text"; //$NON-NLS-1$
174 ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID));
175 String message= NLS.bind(TemplatePersistenceMessages.getString("TemplateReaderWriter.duplicate.id"), id); //$NON-NLS-1$
176 log.log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null));
177 } else {
178 ids.add(id);
179 }
180
181 if (singleId != null && !singleId.equals(id))
182 continue;
183
184 boolean deleted = getBooleanValue(attributes, DELETED_ATTRIBUTE, false);
185
186 String name= getStringValue(attributes, NAME_ATTRIBUTE);
187 name= translateString(name, bundle);
188
189 String description= getStringValue(attributes, DESCRIPTION_ATTRIBUTE, ""); //$NON-NLS-1$
190 description= translateString(description, bundle);
191
192 String context= getStringValue(attributes, CONTEXT_ATTRIBUTE);
193
194 if (name == null || context == null)
195 throw new IOException(TemplatePersistenceMessages.getString("TemplateReaderWriter.error.missing_attribute")); //$NON-NLS-1$
196
197 boolean enabled = getBooleanValue(attributes, ENABLED_ATTRIBUTE, true);
198 boolean autoInsertable= getBooleanValue(attributes, AUTO_INSERTABLE_ATTRIBUTE, true);
199
200 StringBuilder buffer= new StringBuilder();
201 NodeList children= node.getChildNodes();
202 for (int j= 0; j != children.getLength(); j++) {
203 String value= children.item(j).getNodeValue();
204 if (value != null)
205 buffer.append(value);
206 }
207 String pattern= buffer.toString();
208 pattern= translateString(pattern, bundle);
209
210 Template template= new Template(name, description, context, pattern, autoInsertable);
211 TemplatePersistenceData data= new TemplatePersistenceData(template, enabled, id);
212 data.setDeleted(deleted);
213
214 templates.add(data);
215
216 if (singleId != null && singleId.equals(id))
217 break;
218 }
219
220 return templates.toArray(new TemplatePersistenceData[templates.size()]);
221
222 } catch (ParserConfigurationException e) {
223 Assert.isTrue(false);
224 } catch (SAXException e) {
225 throw (IOException)new IOException("Could not read template file").initCause(e); //$NON-NLS-1$
226 }
227
228 return null; // dummy
75 public void save(TemplatePersistenceData[] templates, OutputStream stream) throws IOException {
76 super.save(templates, stream);
22977 }
23078
231 /**
232 * Saves the templates as XML, encoded as UTF-8 onto the given byte stream.
233 *
234 * @param templates the templates to save
235 * @param stream the byte output to write the templates to in XML
236 * @throws IOException if writing the templates fails
237 */
238 public void save(TemplatePersistenceData[] templates, OutputStream stream) throws IOException {
239 save(templates, new StreamResult(stream));
79 public void save(TemplatePersistenceData[] templates, Writer writer) throws IOException {
80 super.save(templates, writer);
24081 }
24182
242 /**
243 * Saves the templates as XML.
244 *
245 * @param templates the templates to save
246 * @param writer the writer to write the templates to in XML
247 * @throws IOException if writing the templates fails
248 */
249 public void save(TemplatePersistenceData[] templates, Writer writer) throws IOException {
250 save(templates, new StreamResult(writer));
251 }
252
253 /**
254 * Saves the templates as XML.
255 *
256 * @param templates the templates to save
257 * @param result the stream result to write to
258 * @throws IOException if writing the templates fails
259 */
260 private void save(TemplatePersistenceData[] templates, StreamResult result) throws IOException {
261 try {
262 DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
263 DocumentBuilder builder= factory.newDocumentBuilder();
264 Document document= builder.newDocument();
265
266 Node root= document.createElement(TEMPLATE_ROOT);
267 document.appendChild(root);
268
269 for (TemplatePersistenceData data : templates) {
270 Template template= data.getTemplate();
271
272 Node node= document.createElement(TEMPLATE_ELEMENT);
273 root.appendChild(node);
274
275 NamedNodeMap attributes= node.getAttributes();
276
277 String id= data.getId();
278 if (id != null) {
279 Attr idAttr= document.createAttribute(ID_ATTRIBUTE);
280 idAttr.setValue(id);
281 attributes.setNamedItem(idAttr);
282 }
283
284 if (template != null) {
285 Attr name= document.createAttribute(NAME_ATTRIBUTE);
286 name.setValue(validateXML(template.getName()));
287 attributes.setNamedItem(name);
288 }
289
290 if (template != null) {
291 Attr description= document.createAttribute(DESCRIPTION_ATTRIBUTE);
292 description.setValue(validateXML(template.getDescription()));
293 attributes.setNamedItem(description);
294 }
295
296 if (template != null) {
297 Attr context= document.createAttribute(CONTEXT_ATTRIBUTE);
298 context.setValue(validateXML(template.getContextTypeId()));
299 attributes.setNamedItem(context);
300 }
301
302 Attr enabled= document.createAttribute(ENABLED_ATTRIBUTE);
303 enabled.setValue(data.isEnabled() ? Boolean.toString(true) : Boolean.toString(false));
304 attributes.setNamedItem(enabled);
305
306 Attr deleted= document.createAttribute(DELETED_ATTRIBUTE);
307 deleted.setValue(data.isDeleted() ? Boolean.toString(true) : Boolean.toString(false));
308 attributes.setNamedItem(deleted);
309
310 if (template != null) {
311 Attr autoInsertable= document.createAttribute(AUTO_INSERTABLE_ATTRIBUTE);
312 autoInsertable.setValue(template.isAutoInsertable() ? Boolean.toString(true) : Boolean.toString(false));
313 attributes.setNamedItem(autoInsertable);
314 }
315
316 if (template != null) {
317 Text pattern= document.createTextNode(validateXML(template.getPattern()));
318 node.appendChild(pattern);
319 }
320 }
321
322
323 Transformer transformer=TransformerFactory.newInstance().newTransformer();
324 transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
325 transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
326 DOMSource source = new DOMSource(document);
327
328 transformer.transform(source, result);
329
330 } catch (ParserConfigurationException e) {
331 Assert.isTrue(false);
332 } catch (TransformerException e) {
333 if (e.getException() instanceof IOException)
334 throw (IOException) e.getException();
335 Assert.isTrue(false);
336 }
337 }
338
339 /**
340 * Validates whether the given string only contains valid XML characters.
341 *
342 * @param string the string to validate
343 * @return the input string
344 * @throws IOException when the first invalid character is detected
345 * @since 3.6
346 */
347 private static String validateXML(String string) throws IOException {
348 for (int i= 0; i < string.length(); i++) {
349 char ch= string.charAt(i);
350 if (!(ch == 9 || ch == 10 || ch == 13 || ch >= 32))
351 throw new IOException("Character reference \"&#" + Integer.toString(ch) + "\" is an invalid XML character."); //$NON-NLS-1$ //$NON-NLS-2$
352 }
353 return string;
354 }
355
356 private boolean getBooleanValue(NamedNodeMap attributes, String attribute, boolean defaultValue) throws SAXException {
357 Node enabledNode= attributes.getNamedItem(attribute);
358 if (enabledNode == null)
359 return defaultValue;
360 else if (enabledNode.getNodeValue().equals(Boolean.toString(true)))
361 return true;
362 else if (enabledNode.getNodeValue().equals(Boolean.toString(false)))
363 return false;
364 else
365 throw new SAXException(TemplatePersistenceMessages.getString("TemplateReaderWriter.error.illegal_boolean_attribute")); //$NON-NLS-1$
366 }
367
368 private String getStringValue(NamedNodeMap attributes, String name) throws SAXException {
369 String val= getStringValue(attributes, name, null);
370 if (val == null)
371 throw new SAXException(TemplatePersistenceMessages.getString("TemplateReaderWriter.error.missing_attribute")); //$NON-NLS-1$
372 return val;
373 }
374
375 private String getStringValue(NamedNodeMap attributes, String name, String defaultValue) {
376 Node node= attributes.getNamedItem(name);
377 return node == null ? defaultValue : node.getNodeValue();
378 }
379
380 private String translateString(String str, ResourceBundle bundle) {
381 if (bundle == null)
382 return str;
383
384 int idx= str.indexOf('%');
385 if (idx == -1) {
386 return str;
387 }
388 StringBuilder buf= new StringBuilder();
389 int k= 0;
390 while (idx != -1) {
391 buf.append(str.substring(k, idx));
392 for (k= idx + 1; k < str.length() && !Character.isWhitespace(str.charAt(k)); k++) {
393 // loop
394 }
395 String key= str.substring(idx + 1, k);
396 buf.append(getBundleString(key, bundle));
397 idx= str.indexOf('%', k);
398 }
399 buf.append(str.substring(k));
400 return buf.toString();
401 }
402
403 private String getBundleString(String key, ResourceBundle bundle) {
404 if (bundle != null) {
405 try {
406 return bundle.getString(key);
407 } catch (MissingResourceException e) {
408 return '!' + key + '!';
409 }
410 }
411 return TemplatePersistenceMessages.getString(key); // default messages
412 }
41383 }
41484
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1417 import java.io.StringReader;
1518 import java.io.StringWriter;
1619 import java.util.ArrayList;
17 import java.util.List;
1820
1921 import org.eclipse.core.runtime.Assert;
22
23 import org.eclipse.text.templates.ContextTypeRegistry;
24 import org.eclipse.text.templates.TemplatePersistenceData;
25 import org.eclipse.text.templates.TemplateReaderWriter;
26 import org.eclipse.text.templates.TemplateStoreCore;
2027
2128 import org.eclipse.jface.preference.IPersistentPreferenceStore;
2229 import org.eclipse.jface.preference.IPreferenceStore;
2330 import org.eclipse.jface.util.IPropertyChangeListener;
2431 import org.eclipse.jface.util.PropertyChangeEvent;
2532
26 import org.eclipse.jface.text.templates.ContextTypeRegistry;
27 import org.eclipse.jface.text.templates.Template;
28 import org.eclipse.jface.text.templates.TemplateException;
29
3033 /**
3134 * A collection of templates. Clients may instantiate this class. In order to
3235 * load templates contributed using the <code>org.eclipse.ui.editors.templates</code>
3437 *
3538 * @since 3.0
3639 */
37 public class TemplateStore {
38 /** The stored templates. */
39 private final List<TemplatePersistenceData> fTemplates= new ArrayList<>();
40 public class TemplateStore extends TemplateStoreCore {
4041 /** The preference store. */
4142 private IPreferenceStore fPreferenceStore;
42 /**
43 * The key into <code>fPreferenceStore</code> the value of which holds custom templates
44 * encoded as XML.
45 */
46 private String fKey;
47 /**
48 * The context type registry, or <code>null</code> if all templates regardless
49 * of context type should be loaded.
50 */
51 private ContextTypeRegistry fRegistry;
43
44 /**
45 * The property listener, if any is registered, <code>null</code> otherwise.
46 *
47 * @since 3.2
48 */
49 private IPropertyChangeListener fPropertyListener;
5250 /**
5351 * Set to <code>true</code> if property change events should be ignored (e.g. during writing
5452 * to the preference store).
5654 * @since 3.2
5755 */
5856 private boolean fIgnorePreferenceStoreChanges= false;
59 /**
60 * The property listener, if any is registered, <code>null</code> otherwise.
61 *
62 * @since 3.2
63 */
64 private IPropertyChangeListener fPropertyListener;
65
6657
6758 /**
6859 * Creates a new template store.
7364 * templates
7465 */
7566 public TemplateStore(IPreferenceStore store, String key) {
67 super(null, key);
7668 Assert.isNotNull(store);
7769 Assert.isNotNull(key);
7870 fPreferenceStore= store;
79 fKey= key;
8071 }
8172
8273 /**
9182 * @param key the key into <code>store</code> where to store custom
9283 * templates
9384 */
94 public TemplateStore(ContextTypeRegistry registry, IPreferenceStore store, String key) {
95 this(store, key);
96 fRegistry= registry;
85 public TemplateStore(org.eclipse.jface.text.templates.ContextTypeRegistry registry, IPreferenceStore store, String key) {
86 super(registry, null, key);
87 fPreferenceStore= store;
9788 }
9889
9990 /**
10192 *
10293 * @throws IOException if loading fails.
10394 */
95 @Override
10496 public void load() throws IOException {
105 fTemplates.clear();
97 internalGetTemplates().clear();
10698 loadContributedTemplates();
10799 loadCustomTemplates();
108100 }
115107 *
116108 * @since 3.2
117109 */
110 @Override
118111 public final void startListeningForPreferenceChanges() {
119112 if (fPropertyListener == null) {
120113 fPropertyListener= new IPropertyChangeListener() {
125118 * save operation, and clients may trigger reloading by listening to preference store
126119 * updates.
127120 */
128 if (!fIgnorePreferenceStoreChanges && fKey.equals(event.getProperty()))
121 if (!fIgnorePreferenceStoreChanges && getKey().equals(event.getProperty()))
129122 try {
130123 load();
131124 } catch (IOException x) {
144137 *
145138 * @since 3.2
146139 */
140 @Override
147141 public final void stopListeningForPreferenceChanges() {
148142 if (fPropertyListener != null) {
149143 fPreferenceStore.removePropertyChangeListener(fPropertyListener);
152146 }
153147
154148 /**
155 * Handles an {@link IOException} thrown during reloading the preferences due to a preference
156 * store update. The default is to write to stderr.
157 *
158 * @param x the exception
159 * @since 3.2
160 */
161 protected void handleException(IOException x) {
162 x.printStackTrace();
163 }
164
165 /**
166 * Hook method to load contributed templates. Contributed templates are superseded
167 * by customized versions of user added templates stored in the preferences.
168 * <p>
169 * The default implementation does nothing.</p>
170 *
171 * @throws IOException if loading fails
172 */
173 protected void loadContributedTemplates() throws IOException {
174 }
175
176 /**
177 * Adds a template to the internal store. The added templates must have
178 * a unique id.
179 *
180 * @param data the template data to add
181 */
182 protected void internalAdd(TemplatePersistenceData data) {
183 if (!data.isCustom()) {
184 // check if the added template is not a duplicate id
185 String id= data.getId();
186 for (TemplatePersistenceData persistenceData : fTemplates) {
187 if (persistenceData.getId() != null && persistenceData.getId().equals(id))
188 return;
189 }
190 fTemplates.add(data);
191 }
192 }
193
194 /**
195149 * Saves the templates to the preferences.
196150 *
197151 * @throws IOException if the templates cannot be written
198152 */
153 @Override
199154 public void save() throws IOException {
200155 ArrayList<TemplatePersistenceData> custom= new ArrayList<>();
201 for (TemplatePersistenceData data : fTemplates) {
156 for (TemplatePersistenceData data : internalGetTemplates()) {
202157 if (data.isCustom() && !(data.isUserAdded() && data.isDeleted())) // don't save deleted user-added templates
203158 custom.add(data);
204159 }
209164
210165 fIgnorePreferenceStoreChanges= true;
211166 try {
212 fPreferenceStore.setValue(fKey, output.toString());
167 fPreferenceStore.setValue(getKey(), output.toString());
213168 if (fPreferenceStore instanceof IPersistentPreferenceStore)
214169 ((IPersistentPreferenceStore)fPreferenceStore).save();
215170 } finally {
218173 }
219174
220175 /**
221 * Adds a template encapsulated in its persistent form.
222 *
223 * @param data the template to add
224 */
225 public void add(TemplatePersistenceData data) {
226
227 if (!validateTemplate(data.getTemplate()))
228 return;
229
230 if (data.isUserAdded()) {
231 fTemplates.add(data);
232 } else {
233 for (TemplatePersistenceData persistenceData : fTemplates) {
234 if (persistenceData.getId() != null && persistenceData.getId().equals(data.getId())) {
235 persistenceData.setTemplate(data.getTemplate());
236 persistenceData.setDeleted(data.isDeleted());
237 persistenceData.setEnabled(data.isEnabled());
238 return;
239 }
240 }
241
242 // add an id which is not contributed as add-on
243 if (data.getTemplate() != null) {
244 TemplatePersistenceData newData= new TemplatePersistenceData(data.getTemplate(), data.isEnabled());
245 fTemplates.add(newData);
246 }
247 }
248 }
249
250 /**
251 * Removes a template from the store.
252 *
253 * @param data the template to remove
254 */
255 public void delete(TemplatePersistenceData data) {
256 if (data.isUserAdded())
257 fTemplates.remove(data);
258 else
259 data.setDeleted(true);
260 }
261
262 /**
263 * Restores all contributed templates that have been deleted.
264 */
265 public void restoreDeleted() {
266 for (TemplatePersistenceData data : fTemplates) {
267 if (data.isDeleted())
268 data.setDeleted(false);
269 }
270 }
271
272 /**
273176 * Deletes all user-added templates and reverts all contributed templates.
274177 *
275178 * @param doSave <code>true</code> if the store should be saved after restoring
276179 * @since 3.5
277180 */
181 @Override
278182 public void restoreDefaults(boolean doSave) {
279183 String oldValue= null;
280184 if (!doSave)
281 oldValue= fPreferenceStore.getString(fKey);
185 oldValue= fPreferenceStore.getString(getKey());
282186
283187 try {
284188 fIgnorePreferenceStoreChanges= true;
285 fPreferenceStore.setToDefault(fKey);
189 fPreferenceStore.setToDefault(getKey());
286190 } finally {
287191 fIgnorePreferenceStoreChanges= false;
288192 }
297201 if (oldValue != null) {
298202 try {
299203 fIgnorePreferenceStoreChanges= true;
300 fPreferenceStore.putValue(fKey, oldValue);
204 fPreferenceStore.putValue(getKey(), oldValue);
301205 } finally {
302206 fIgnorePreferenceStoreChanges= false;
303207 }
304208 }
305209 }
306210
307 /**
308 * Deletes all user-added templates and reverts all contributed templates.
309 * <p>
310 * <strong>Note:</strong> the store will be saved after restoring.
311 * </p>
312 */
313 public void restoreDefaults() {
314 restoreDefaults(true);
315 }
316
317 /**
318 * Returns all enabled templates.
319 *
320 * @return all enabled templates
321 */
322 public Template[] getTemplates() {
323 return getTemplates(null);
324 }
325
326 /**
327 * Returns all enabled templates for the given context type.
328 *
329 * @param contextTypeId the id of the context type of the requested templates, or <code>null</code> if all templates should be returned
330 * @return all enabled templates for the given context type
331 */
332 public Template[] getTemplates(String contextTypeId) {
333 List<Template> templates= new ArrayList<>();
334 for (TemplatePersistenceData data : fTemplates) {
335 if (data.isEnabled() && !data.isDeleted() && (contextTypeId == null || contextTypeId.equals(data.getTemplate().getContextTypeId())))
336 templates.add(data.getTemplate());
337 }
338
339 return templates.toArray(new Template[templates.size()]);
340 }
341
342 /**
343 * Returns the first enabled template that matches the name.
344 *
345 * @param name the name of the template searched for
346 * @return the first enabled template that matches both name and context type id, or <code>null</code> if none is found
347 */
348 public Template findTemplate(String name) {
349 return findTemplate(name, null);
350 }
351
352 /**
353 * Returns the first enabled template that matches both name and context type id.
354 *
355 * @param name the name of the template searched for
356 * @param contextTypeId the context type id to clip unwanted templates, or <code>null</code> if any context type is OK
357 * @return the first enabled template that matches both name and context type id, or <code>null</code> if none is found
358 */
359 public Template findTemplate(String name, String contextTypeId) {
360 Assert.isNotNull(name);
361
362 for (TemplatePersistenceData data : fTemplates) {
363 Template template= data.getTemplate();
364 if (data.isEnabled() && !data.isDeleted()
365 && (contextTypeId == null || contextTypeId.equals(template.getContextTypeId()))
366 && name.equals(template.getName()))
367 return template;
368 }
369
370 return null;
371 }
372
373 /**
374 * Returns the first enabled template that matches the given template id.
375 *
376 * @param id the id of the template searched for
377 * @return the first enabled template that matches id, or <code>null</code> if none is found
378 * @since 3.1
379 */
380 public Template findTemplateById(String id) {
381 TemplatePersistenceData data= getTemplateData(id);
382 if (data != null && !data.isDeleted())
383 return data.getTemplate();
384
385 return null;
386 }
387
388 /**
389 * Returns all template data.
390 *
391 * @param includeDeleted whether to include deleted data
392 * @return all template data, whether enabled or not
393 */
394 public TemplatePersistenceData[] getTemplateData(boolean includeDeleted) {
395 List<TemplatePersistenceData> datas= new ArrayList<>();
396 for (TemplatePersistenceData data : fTemplates) {
397 if (includeDeleted || !data.isDeleted())
398 datas.add(data);
399 }
400
401 return datas.toArray(new TemplatePersistenceData[datas.size()]);
402 }
403
404 /**
405 * Returns the template data of the template with id <code>id</code> or
406 * <code>null</code> if no such template can be found.
407 *
408 * @param id the id of the template data
409 * @return the template data of the template with id <code>id</code> or <code>null</code>
410 * @since 3.1
411 */
412 public TemplatePersistenceData getTemplateData(String id) {
413 Assert.isNotNull(id);
414 for (TemplatePersistenceData data : fTemplates) {
415 if (id.equals(data.getId()))
416 return data;
417 }
418
419 return null;
420 }
421
422211 private void loadCustomTemplates() throws IOException {
423 String pref= fPreferenceStore.getString(fKey);
212 String pref= fPreferenceStore.getString(getKey());
424213 if (pref != null && pref.trim().length() > 0) {
425214 Reader input= new StringReader(pref);
426215 TemplateReaderWriter reader= new TemplateReaderWriter();
431220 }
432221 }
433222
434 /**
435 * Validates a template against the context type registered in the context
436 * type registry. Returns always <code>true</code> if no registry is
437 * present.
438 *
439 * @param template the template to validate
440 * @return <code>true</code> if validation is successful or no context
441 * type registry is specified, <code>false</code> if validation
442 * fails
443 */
444 private boolean validateTemplate(Template template) {
445 String contextTypeId= template.getContextTypeId();
446 if (contextExists(contextTypeId)) {
447 if (fRegistry != null)
448 try {
449 fRegistry.getContextType(contextTypeId).validate(template.getPattern());
450 } catch (TemplateException e) {
451 return false;
452 }
453 return true;
454 }
455
456 return false;
457 }
458
459 /**
460 * Returns <code>true</code> if a context type id specifies a valid context type
461 * or if no context type registry is present.
462 *
463 * @param contextTypeId the context type id to look for
464 * @return <code>true</code> if the context type specified by the id
465 * is present in the context type registry, or if no registry is
466 * specified
467 */
468 private boolean contextExists(String contextTypeId) {
469 return contextTypeId != null && (fRegistry == null || fRegistry.getContextType(contextTypeId) != null);
470 }
471
472 /**
473 * Returns the registry.
474 *
475 * @return Returns the registry
476 */
477 protected final ContextTypeRegistry getRegistry() {
478 return fRegistry;
479 }
223 @Override
224 protected final org.eclipse.jface.text.templates.ContextTypeRegistry getRegistry() {
225 ContextTypeRegistry registry= super.getRegistry();
226 org.eclipse.jface.text.templates.ContextTypeRegistry res= new org.eclipse.jface.text.templates.ContextTypeRegistry();
227 registry.contextTypes().forEachRemaining(t -> res.addContextType(t));
228 return res;
229 }
230
231 public void add(org.eclipse.jface.text.templates.persistence.TemplatePersistenceData data) {
232 super.add(data);
233 }
234
235 public void delete(org.eclipse.jface.text.templates.persistence.TemplatePersistenceData data) {
236 super.delete(data);
237 }
238
239 @Override
240 public org.eclipse.jface.text.templates.persistence.TemplatePersistenceData[] getTemplateData(boolean includeDeleted) {
241 TemplatePersistenceData[] list= super.getTemplateData(includeDeleted);
242 org.eclipse.jface.text.templates.persistence.TemplatePersistenceData[] wraps= new org.eclipse.jface.text.templates.persistence.TemplatePersistenceData[list.length];
243 for (int i= 0; i < wraps.length; i++) {
244 wraps[i]= new org.eclipse.jface.text.templates.persistence.TemplatePersistenceData(list[i]);
245 }
246 return wraps;
247 }
248
249 @Override
250 public org.eclipse.jface.text.templates.persistence.TemplatePersistenceData getTemplateData(String id) {
251 TemplatePersistenceData data= super.getTemplateData(id);
252 org.eclipse.jface.text.templates.persistence.TemplatePersistenceData wrap= new org.eclipse.jface.text.templates.persistence.TemplatePersistenceData(data);
253 return wrap;
254 }
255
256 protected void internalAdd(org.eclipse.jface.text.templates.persistence.TemplatePersistenceData data) {
257 super.internalAdd(data);
258 }
259
480260 }
481261
11 Bundle-ManifestVersion: 2
22 Bundle-Name: CodeMinig Examples
33 Bundle-SymbolicName: org.eclipse.jface.text.examples
4 Bundle-Version: 1.0.0.qualifier
4 Bundle-Version: 1.0.100.qualifier
55 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
66 Require-Bundle: org.eclipse.jface.text,
77 org.eclipse.core.runtime,
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.core</groupId>
1919 <artifactId>org.eclipse.jface.text.examples</artifactId>
20 <version>1.0.0-SNAPSHOT</version>
20 <version>1.0.100-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Add CodeMining support in SourceViewer - Bug 527515
00 /**s
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide inline annotations support - Bug 527675
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Plugin.name
33 Bundle-SymbolicName: org.eclipse.jface.text.tests
4 Bundle-Version: 3.11.200.qualifier
4 Bundle-Version: 3.11.300.qualifier
55 Bundle-Vendor: %Plugin.providerName
66 Bundle-Localization: plugin
77 Export-Package:
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.jface</groupId>
2020 <artifactId>org.eclipse.jface.text.tests</artifactId>
21 <version>3.11.200-SNAPSHOT</version>
21 <version>3.11.300-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Christian Plesner Hansen (plesner@quenta.org) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
130133
131134 private void doChange(IDocument document, int count) {
132135 try {
133 String before= document.get();
134136
135137 if (DEBUG)
136 System.out.println(before);
138 System.out.println(document.get());
137139
138140 Position [] positions= new Position[count];
139141 String [] strings= new String[count];
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Christian Plesner Hansen (plesner@quenta.org) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2012, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2014 Google, Inc and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sergey Prigogin (Google) - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2006, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1013 package org.eclipse.jface.text.tests;
1114
1215 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertFalse;
17 import static org.junit.Assert.assertTrue;
1318 import static org.junit.Assert.fail;
1419
1520 import org.junit.Test;
2631
2732 import org.eclipse.text.undo.DocumentUndoEvent;
2833 import org.eclipse.text.undo.DocumentUndoManager;
29 import org.eclipse.text.undo.IDocumentUndoListener;
3034
3135 import org.eclipse.jface.text.Document;
3236 import org.eclipse.jface.text.IDocument;
7983 Object newContext= new Object();
8084 undoManager.connect(newContext);
8185
82 undoManager.addDocumentUndoListener(new IDocumentUndoListener() {
83 @Override
84 public void documentUndoNotification(DocumentUndoEvent event) {
85 fail();
86 }
87 });
86 undoManager.addDocumentUndoListener(event -> fail());
8887
8988 undoManager.transferUndoHistory(tempUndoManager);
9089 tempUndoManager.disconnect(context);
9190
9291 assertEquals(isUndoable, undoManager.undoable());
9392 undoManager.undo();
94 assertEquals(false, undoManager.undoable());
93 assertFalse(undoManager.undoable());
9594
9695 undoManager.disconnect(newContext);
9796 }
113112 Object context= new Object();
114113 undoManager.connect(context);
115114
116 undoManager.addDocumentUndoListener(new IDocumentUndoListener() {
117
118 @Override
119 public void documentUndoNotification(DocumentUndoEvent event) {
120 if (event.getEventType() == DocumentUndoEvent.ABOUT_TO_UNDO)
121 assertEquals(true, undoManager.undoable());
122 else if (event.getEventType() == DocumentUndoEvent.UNDONE)
123 assertEquals(false, undoManager.undoable());
124 }
115 undoManager.addDocumentUndoListener(event -> {
116 if (event.getEventType() == DocumentUndoEvent.ABOUT_TO_UNDO)
117 assertTrue(undoManager.undoable());
118 else if (event.getEventType() == DocumentUndoEvent.UNDONE)
119 assertFalse(undoManager.undoable());
125120 });
126121
127122 doc.set("foo");
128123
129 assertEquals(true, undoManager.undoable());
124 assertTrue(undoManager.undoable());
130125 undoManager.undo();
131 assertEquals(false, undoManager.undoable());
126 assertFalse(undoManager.undoable());
132127
133128 undoManager.disconnect(context);
134129 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2016 Rüdiger Herrmann and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Rüdiger Herrmann - Insufficient is-disposed check in LineNumberRulerColumn::redraw - https://bugs.eclipse.org/bugs/show_bug.cgi?id=506427
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.search; singleton:=true
4 Bundle-Version: 3.11.200.qualifier
4 Bundle-Version: 3.11.300.qualifier
55 Bundle-Activator: org.eclipse.search.internal.ui.SearchPlugin
66 Bundle-ActivationPolicy: lazy
77 Bundle-Vendor: %providerName
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
3538
3639 import org.eclipse.jface.action.Action;
3740 import org.eclipse.jface.action.IAction;
38 import org.eclipse.jface.action.IMenuListener;
3941 import org.eclipse.jface.action.IMenuManager;
4042 import org.eclipse.jface.action.IToolBarManager;
4143 import org.eclipse.jface.action.MenuManager;
297299 fBatchedUpdates = new HashSet<>();
298300 fBatchedClearAll= false;
299301
300 fListener = new ISearchResultListener() {
301 @Override
302 public void searchResultChanged(SearchResultEvent e) {
303 handleSearchResultChanged(e);
304 }
305 };
302 fListener = e -> handleSearchResultChanged(e);
306303 fFilterActions= null;
307304 fElementLimit= null;
308305 }
539536 fMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
540537 fMenu.setRemoveAllWhenShown(true);
541538 fMenu.setParent(getSite().getActionBars().getMenuManager());
542 fMenu.addMenuListener(new IMenuListener() {
543 @Override
544 public void menuAboutToShow(IMenuManager mgr) {
545 SearchView.createContextMenuGroups(mgr);
546 fillContextMenu(mgr);
547 fViewPart.fillContextMenu(mgr);
548 }
539 fMenu.addMenuListener(mgr -> {
540 SearchView.createContextMenuGroups(mgr);
541 fillContextMenu(mgr);
542 fViewPart.fillContextMenu(mgr);
549543 });
550544 fPagebook = new PageBook(parent, SWT.NULL);
551545 fPagebook.setLayoutData(new GridData(GridData.FILL_BOTH));
596590
597591 @Override
598592 public void queryStarting(final ISearchQuery query) {
599 final Runnable runnable1 = new Runnable() {
600 @Override
601 public void run() {
602 updateBusyLabel();
603 AbstractTextSearchResult result = getInput();
604
605 if (result == null || !result.getQuery().equals(query)) {
606 return;
607 }
608 turnOffDecoration();
609 scheduleUIUpdate();
593 final Runnable runnable1 = () -> {
594 updateBusyLabel();
595 AbstractTextSearchResult result = getInput();
596
597 if (result == null || !result.getQuery().equals(query)) {
598 return;
610599 }
611
612
600 turnOffDecoration();
601 scheduleUIUpdate();
613602 };
614603 asyncExec(runnable1);
615604 }
762751
763752 };
764753
765 fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
766 @Override
767 public void selectionChanged(SelectionChangedEvent event) {
768 fCurrentMatchIndex = -1;
769 fRemoveSelectedMatches.setEnabled(canRemoveMatchesWith(event.getSelection()));
770 }
754 fViewer.addSelectionChangedListener(event -> {
755 fCurrentMatchIndex = -1;
756 fRemoveSelectedMatches.setEnabled(canRemoveMatchesWith(event.getSelection()));
771757 });
772758
773759 fViewer.addSelectionChangedListener(fViewerAdapter);
12871273 if (currentDisplay == null || !currentDisplay.equals(control.getDisplay()))
12881274 // meaning we're not executing on the display thread of the
12891275 // control
1290 control.getDisplay().asyncExec(new Runnable() {
1291 @Override
1292 public void run() {
1293 if (!control.isDisposed())
1294 runnable.run();
1295 }
1276 control.getDisplay().asyncExec(() -> {
1277 if (!control.isDisposed())
1278 runnable.run();
12961279 });
12971280 else
12981281 runnable.run();
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2013 Wind River Systems and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2008 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2013 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
6366
6467 // IActionDelegate
6568 @Override
66 final public void run(IAction action) {
69 public final void run(IAction action) {
6770 run();
6871 }
6972
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2011 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2012 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.search</groupId>
1919 <artifactId>org.eclipse.search</artifactId>
20 <version>3.11.200-SNAPSHOT</version>
20 <version>3.11.300-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
229229 </appInfo>
230230 <documentation>
231231 Copyright (c) 2001, 2009 IBM Corporation and others.&lt;br&gt;
232 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
232
233 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
234
235 SPDX-License-Identifier: EPL-2.0
233236 </documentation>
234237 </annotation>
235238
179179 </appInfo>
180180 <documentation>
181181 Copyright (c) 2001, 2008 IBM Corporation and others.&lt;br&gt;
182 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
182
183 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
184
185 SPDX-License-Identifier: EPL-2.0
183186 </documentation>
184187 </annotation>
185188
143143 </appInfo>
144144 <documentation>
145145 Copyright (c) 2001, 2004 IBM Corporation and others.&lt;br&gt;
146 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
146
147 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
148
149 SPDX-License-Identifier: EPL-2.0
147150 </documentation>
148151 </annotation>
149152
124124 </appInfo>
125125 <documentation>
126126 Copyright (c) 2006 Wind River Systems and others.
127 All rights reserved. This program and the accompanying materials
128 are made available under the terms of the Eclipse Public License v1.0
129 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
127
128 This program and the accompanying materials
129 are made available under the terms of the Eclipse Public License 2.0
130 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
131
132 SPDX-License-Identifier: EPL-2.0
130133 </documentation>
131134 </annotation>
132135
121121 </appInfo>
122122 <documentation>
123123 Copyright (c) 2006, 2009 Wind River Systems and others.
124 All rights reserved. This program and the accompanying materials
125 are made available under the terms of the Eclipse Public License v1.0
126 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
124
125 This program and the accompanying materials
126 are made available under the terms of the Eclipse Public License 2.0
127 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
128
129 SPDX-License-Identifier: EPL-2.0
127130 </documentation>
128131 </annotation>
129132
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2009 Klaus Wenger, Wind River Systems, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Klaus Wenger - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2017 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 Wind River Systems, Inc., IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Markus Schorn - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2007, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
9 * Florian Ingerl <imelflorianingerl@gmail.com> - Bug 109481 - [find/replace] replace doesn't work when using a regex with a lookahead or boundary matchers
1012 *******************************************************************************/
1113 package org.eclipse.search.internal.ui.text;
1214
437439 continue;
438440 }
439441
440 String replacementString= PatternConstructor.interpretReplaceEscapes(fReplaceString, originalText,
441 lineDelimiter);
442 replacementString= computeReplacementString(pattern, document, offset, replacementString);
442 String replacementString= computeReplacementString(pattern, originalText, fReplaceString, lineDelimiter);
443443 if (replacementString == null) {
444444 resultingStatus.addError(Messages.format(SearchMessages.ReplaceRefactoring_error_match_content_changed, file.getName()));
445445 continue;
469469 return PatternConstructor.createPattern(query.getSearchString(), true, true, query.isCaseSensitive(), false);
470470 }
471471
472 private String computeReplacementString(Pattern pattern, IDocument document, int offset, String replacementText)
473 throws PatternSyntaxException {
472 private String computeReplacementString(Pattern pattern, String originalText, String replacementText, String lineDelimiter) throws PatternSyntaxException {
474473 if (pattern != null) {
475474 try {
476 Matcher matcher= pattern.matcher(document.get());
477 if (matcher.find(offset)) {
478 StringBuffer sb= new StringBuffer();
475 replacementText= PatternConstructor.interpretReplaceEscapes(replacementText, originalText, lineDelimiter);
476
477 Matcher matcher= pattern.matcher(originalText);
478 StringBuffer sb = new StringBuffer();
479 matcher.reset();
480 if (matcher.find()) {
479481 matcher.appendReplacement(sb, replacementText);
480 return sb.substring(offset);
481482 } else {
482483 return null;
483484 }
485 matcher.appendTail(sb);
486 return sb.toString();
484487 } catch (IndexOutOfBoundsException ex) {
485488 throw new PatternSyntaxException(ex.getLocalizedMessage(), replacementText, -1);
486489 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.search.tests
4 Bundle-Version: 3.9.100.qualifier
4 Bundle-Version: 3.9.200.qualifier
55 Bundle-Activator: org.eclipse.search.tests.SearchTestPlugin
66 Bundle-Vendor: %providerName
77 Bundle-Localization: plugin
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 5, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
2521
26 <h3>Third Party Content</h3>
27
28 <p>The Content includes items that have been sourced from third parties as set out below. If you
29 did not receive this Content directly from the Eclipse Foundation, the following is provided
30 for informational purposes only, and you should look to the Redistributor&rsquo;s license for
31 terms and conditions of use.</p>
32
33 <h4>JUnit 3.7</h4>
34 <p>The plug-in is based on software developed by JUnit.org. Your use of JUnit 3.7 in both source and binary code
35 form contained in the plug-in is subject to the terms and conditions of the IBM Public License 1.0 which is available at
36 <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>.
37 The source code is located in testresources/junit37-noUI-src.zip.</p>
38
39 <p>i) IBM effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;</p>
40 <p>ii) IBM effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;</p>
41 <p>iii) IBM states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party.</p>
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
4233
4334 </body>
4435 </html>
00 ###############################################################################
11 # Copyright (c) 2005, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2008 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.search</groupId>
2020 <artifactId>org.eclipse.search.tests</artifactId>
21 <version>3.9.100-SNAPSHOT</version>
21 <version>3.9.200-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
912 * Christian Walther (Indel AG) - Bug 399094, 402009: Add whole word option to file search
1013 * Terry Parker <tparker@google.com> (Google Inc.) - Bug 441016 - Speed up text search by parallelizing it using JobGroups
11 * Florian Ingerl <imelflorianingerl@gmail.com> - Bug 109481 - [find/replace] replace doesn't work when using a regex with a lookahead or boundary matchers
1214 *******************************************************************************/
1315 package org.eclipse.search.tests.filesearch;
1416
1517 import static org.junit.Assert.assertEquals;
1618
17 import java.io.IOException;
1819 import java.util.ArrayList;
1920 import java.util.List;
20 import java.util.Scanner;
2121 import java.util.regex.Pattern;
2222
2323 import org.junit.After;
2626 import org.junit.Test;
2727
2828 import org.eclipse.core.runtime.CoreException;
29 import org.eclipse.core.runtime.NullProgressMonitor;
30 import org.eclipse.core.runtime.OperationCanceledException;
3129
3230 import org.eclipse.core.resources.IFile;
3331 import org.eclipse.core.resources.IFolder;
4240 import org.eclipse.search.core.text.TextSearchScope;
4341 import org.eclipse.search.internal.core.text.PatternConstructor;
4442 import org.eclipse.search.internal.ui.SearchPlugin;
45 import org.eclipse.search.internal.ui.text.FileSearchQuery;
46 import org.eclipse.search.internal.ui.text.FileSearchResult;
47 import org.eclipse.search.internal.ui.text.ReplaceRefactoring;
4843 import org.eclipse.search.tests.ResourceHelper;
4944 import org.eclipse.search.tests.SearchTestPlugin;
5045 import org.eclipse.search.ui.text.FileTextSearchScope;
51
52 import org.eclipse.ltk.core.refactoring.Change;
5346
5447 public class FileSearchTests {
5548
532525 assertEquals("Number of results in file", expectedCount, k);
533526 }
534527
535 @Test
536 public void testReplaceWithLookarounds() throws CoreException, IOException {
537 IFolder folder= ResourceHelper.createFolder(fProject.getFolder("folder1"));
538 IFile file1= ResourceHelper.createFile(folder, "file1.txt", "1<2<3<4");
539 IFile file2= ResourceHelper.createFile(folder, "file2.txt", "4<5<6<7");
540
541 FileSearchResult searchResult= performSearch(new String[] { "*.txt" }, "(?<=(\\d)\\<)\\d(?=\\<(\\d))");
542 performReplace(searchResult, "$0=($1+$2)/2");
543
544 assertFileContent(file1, "1<2=(1+3)/2<3=(2+4)/2<4");
545 assertFileContent(file2, "4<5=(4+6)/2<6=(5+7)/2<7");
546 }
547
548 @Test
549 public void testReplaceRetainCase() throws CoreException, IOException {
550 IFolder folder= ResourceHelper.createFolder(fProject.getFolder("folder1"));
551 IFile file1= ResourceHelper.createFile(folder, "file1.txt", "FOO");
552
553 FileSearchResult searchResult= performSearch(new String[] { "*.txt" }, "FOO");
554 performReplace(searchResult, "xyz\\Cbar\\Cfar");
555
556 assertFileContent(file1, "xyzBARFAR");
557 }
558
559 private FileSearchResult performSearch(String[] fileNamePatterns, String pattern) {
560 FileTextSearchScope scope= FileTextSearchScope.newSearchScope(new IResource[] { fProject }, fileNamePatterns, false);
561 FileSearchQuery query= new FileSearchQuery(pattern, true, true, scope);
562 query.run(null);
563 return (FileSearchResult) query.getSearchResult();
564 }
565
566 private void performReplace(FileSearchResult searchResult, String replacementText) throws OperationCanceledException, CoreException {
567 ReplaceRefactoring refactoring= new ReplaceRefactoring(searchResult, null);
568 refactoring.setReplaceString(replacementText);
569 refactoring.checkInitialConditions(null);
570 refactoring.checkFinalConditions(null);
571 Change change= refactoring.createChange(null);
572 change.perform(new NullProgressMonitor());
573 }
574
575 private void assertFileContent(IFile file, String expected) throws CoreException {
576 try (Scanner scanner= new Scanner(file.getContents())) {
577 scanner.useDelimiter("\\A");
578 assertEquals(expected, scanner.next());
579 }
580 }
528
581529 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
+0
-41
org.eclipse.text/.settings/.api_filters less more
0 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1 <component id="org.eclipse.text" version="2">
2 <resource path="src/org/eclipse/jface/text/Assert.java" type="org.eclipse.jface.text.Assert">
3 <filter comment="Planned for deletion - Bug 528191 " id="338944126">
4 <message_arguments>
5 <message_argument value="org.eclipse.jface.text.Assert"/>
6 <message_argument value="isLegal(boolean)"/>
7 </message_arguments>
8 </filter>
9 <filter comment="Planned for deletion - Bug 528191 " id="338944126">
10 <message_arguments>
11 <message_argument value="org.eclipse.jface.text.Assert"/>
12 <message_argument value="isLegal(boolean, String)"/>
13 </message_arguments>
14 </filter>
15 <filter comment="Planned for deletion - Bug 528191 " id="338944126">
16 <message_arguments>
17 <message_argument value="org.eclipse.jface.text.Assert"/>
18 <message_argument value="isNotNull(Object)"/>
19 </message_arguments>
20 </filter>
21 <filter comment="Planned for deletion - Bug 528191 " id="338944126">
22 <message_arguments>
23 <message_argument value="org.eclipse.jface.text.Assert"/>
24 <message_argument value="isNotNull(Object, String)"/>
25 </message_arguments>
26 </filter>
27 <filter comment="Planned for deletion - Bug 528191 " id="338944126">
28 <message_arguments>
29 <message_argument value="org.eclipse.jface.text.Assert"/>
30 <message_argument value="isTrue(boolean)"/>
31 </message_arguments>
32 </filter>
33 <filter comment="Planned for deletion - Bug 528191 " id="338944126">
34 <message_arguments>
35 <message_argument value="org.eclipse.jface.text.Assert"/>
36 <message_argument value="isTrue(boolean, String)"/>
37 </message_arguments>
38 </filter>
39 </resource>
40 </component>
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.text
4 Bundle-Version: 3.6.300.qualifier
4 Bundle-Version: 3.7.0.qualifier
55 Bundle-Vendor: %providerName
66 Bundle-Localization: plugin
77 Export-Package:
1111 org.eclipse.jface.text.source; text="split"; mandatory:="text",
1212 org.eclipse.jface.text.templates; text="split"; mandatory:="text",
1313 org.eclipse.text.edits,
14 org.eclipse.text.templates,
1415 org.eclipse.text.undo
1516 Require-Bundle:
1617 org.eclipse.core.commands;bundle-version="[3.5.0,4.0.0)",
17 org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)"
18 org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)",
19 org.eclipse.equinox.preferences;bundle-version="[3.7.0,4.0.0)",
20 org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)"
1821 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
1922 Import-Package:
2023 com.ibm.icu.text,
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2006 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.text</groupId>
1919 <artifactId>org.eclipse.text</artifactId>
20 <version>3.6.300-SNAPSHOT</version>
20 <version>3.7.0-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
14961499
14971500 @Override
14981501 public void stopRewriteSession(DocumentRewriteSession session) {
1499 if (fDocumentRewriteSession == session) {
1502 if (fDocumentRewriteSession != null && fDocumentRewriteSession == session) {
15001503
15011504 if (DEBUG)
15021505 System.out.println("AbstractDocument: Stopping rewrite session: " + session); //$NON-NLS-1$
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Anton Leherbauer (anton.leherbauer@windriver.com) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
97100 myEnd= Math.max(myStart, myEnd);
98101
99102 int yoursStart= fOffset;
100 int yoursEnd= fOffset + fReplaceLength -1;
101 yoursEnd= Math.max(yoursStart, yoursEnd);
102103
103104 if (myEnd < yoursStart)
104105 return;
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
912 * Cagatay Calli <ccalli@gmail.com> - [find/replace] retain caps when replacing - https://bugs.eclipse.org/bugs/show_bug.cgi?id=28949
1013 * Cagatay Calli <ccalli@gmail.com> - [find/replace] define & fix behavior of retain caps with other escapes and text before \C - https://bugs.eclipse.org/bugs/show_bug.cgi?id=217061
11 * Florian Ingerl <imelflorianingerl@gmail.com> - [find/replace] replace doesn't work when using a regex with a lookahead or boundary matchers - https://bugs.eclipse.org/bugs/show_bug.cgi?id=109481
1214 *******************************************************************************/
1315 package org.eclipse.jface.text;
1416
194196 String prevMatch= fFindReplaceMatcher.group();
195197 try {
196198 replaceText= interpretReplaceEscapes(replaceText, prevMatch);
197 Matcher replaceTextMatcher= pattern.matcher(this);
198 replaceTextMatcher.find(fFindReplaceMatcher.start());
199 StringBuffer sb= new StringBuffer();
200 replaceTextMatcher.appendReplacement(sb, replaceText);
201 replaceText= sb.substring(fFindReplaceMatcher.start());
199 Matcher replaceTextMatcher= pattern.matcher(prevMatch);
200 replaceText= replaceTextMatcher.replaceFirst(replaceText);
202201 } catch (IndexOutOfBoundsException ex) {
203202 throw new PatternSyntaxException(ex.getLocalizedMessage(), replaceText, -1);
204203 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2008 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2016 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
0 /*******************************************************************************
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * IBM Corporation - initial API and implementation
12 *******************************************************************************/
13 package org.eclipse.text.templates;
14
15 import java.util.Iterator;
16 import java.util.LinkedHashMap;
17 import java.util.Map;
18
19 import org.eclipse.jface.text.templates.TemplateContextType;
20
21 /**
22 * A registry for context types. Editor implementors will usually instantiate a
23 * registry and configure the context types available in their editor.
24 * <p>
25 * In order to pick up templates contributed using the <code>org.eclipse.ui.editors.templates</code>
26 * extension point, use a <code>ContributionContextTypeRegistry</code>.
27 * </p>
28 *
29 * @since 3.7
30 */
31 public class ContextTypeRegistry {
32
33 /** all known context types */
34 private final Map<String, TemplateContextType> fContextTypes= new LinkedHashMap<>();
35
36 /**
37 * Adds a context type to the registry. If there already is a context type
38 * with the same ID registered, it is replaced.
39 *
40 * @param contextType the context type to add
41 */
42 public void addContextType(TemplateContextType contextType) {
43 fContextTypes.put(contextType.getId(), contextType);
44 }
45
46 /**
47 * Returns the context type if the id is valid, <code>null</code> otherwise.
48 *
49 * @param id the id of the context type to retrieve
50 * @return the context type if <code>name</code> is valid, <code>null</code> otherwise
51 */
52 public TemplateContextType getContextType(String id) {
53 return fContextTypes.get(id);
54 }
55
56 /**
57 * Returns an iterator over all registered context types.
58 *
59 * @return an iterator over all registered context types
60 */
61 public Iterator<TemplateContextType> contextTypes() {
62 return fContextTypes.values().iterator();
63 }
64 }
0 /*******************************************************************************
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * IBM Corporation - initial API and implementation
12 *******************************************************************************/
13 package org.eclipse.text.templates;
14
15 import org.eclipse.core.runtime.Assert;
16
17 import org.eclipse.jface.text.templates.Template;
18
19
20 /**
21 * TemplatePersistenceData stores information about a template. It uniquely
22 * references contributed templates via their id. Contributed templates may be
23 * deleted or modified. All template may be enabled or not.
24 * <p>
25 * Clients may use this class, although this is not usually needed except when
26 * implementing a custom template preference page or template store. This class
27 * is not intended to be subclassed.
28 * </p>
29 *
30 * @since 3.7
31 * @noextend This class is not intended to be subclassed by clients.
32 */
33 public class TemplatePersistenceData {
34 private final Template fOriginalTemplate;
35 private final String fId;
36 private final boolean fOriginalIsEnabled;
37
38 private Template fCustomTemplate= null;
39 private boolean fIsDeleted= false;
40 private boolean fCustomIsEnabled= true;
41
42 /**
43 * Creates a new, user-added instance that is not linked to a contributed
44 * template.
45 *
46 * @param template the template which is stored by the new instance
47 * @param enabled whether the template is enabled
48 */
49 public TemplatePersistenceData(Template template, boolean enabled) {
50 this(template, enabled, null);
51 }
52
53 /**
54 * Creates a new instance. If <code>id</code> is not <code>null</code>,
55 * the instance is represents a template that is contributed and can be
56 * identified via its id.
57 *
58 * @param template the template which is stored by the new instance
59 * @param enabled whether the template is enabled
60 * @param id the id of the template, or <code>null</code> if a user-added
61 * instance should be created
62 */
63 public TemplatePersistenceData(Template template, boolean enabled, String id) {
64 Assert.isNotNull(template);
65 fOriginalTemplate= template;
66 fCustomTemplate= template;
67 fOriginalIsEnabled= enabled;
68 fCustomIsEnabled= enabled;
69 fId= id;
70 }
71
72 /**
73 * Returns the id of this template store, or <code>null</code> if there is none.
74 *
75 * @return the id of this template store
76 */
77 public String getId() {
78 return fId;
79 }
80
81 /**
82 * Returns the deletion state of the stored template. This is only relevant
83 * of contributed templates.
84 *
85 * @return the deletion state of the stored template
86 */
87 public boolean isDeleted() {
88 return fIsDeleted;
89 }
90
91 /**
92 * Sets the deletion state of the stored template.
93 *
94 * @param isDeleted the deletion state of the stored template
95 */
96 public void setDeleted(boolean isDeleted) {
97 fIsDeleted= isDeleted;
98 }
99
100 /**
101 * Returns the template encapsulated by the receiver.
102 *
103 * @return the template encapsulated by the receiver
104 */
105 public Template getTemplate() {
106 return fCustomTemplate;
107 }
108
109
110 /**
111 * Sets the template encapsulated by the receiver.
112 *
113 * @param template the new template
114 */
115 public void setTemplate(Template template) {
116 fCustomTemplate= template;
117 }
118
119 /**
120 * Returns whether the receiver represents a custom template, i.e. is either
121 * a user-added template or a contributed template that has been modified.
122 *
123 * @return <code>true</code> if the contained template is a custom
124 * template and cannot be reconstructed from the contributed
125 * templates
126 */
127 public boolean isCustom() {
128 return fId == null
129 || fIsDeleted
130 || fOriginalIsEnabled != fCustomIsEnabled
131 || !fOriginalTemplate.equals(fCustomTemplate);
132 }
133
134 /**
135 * Returns whether the receiver represents a modified template, i.e. a
136 * contributed template that has been changed.
137 *
138 * @return <code>true</code> if the contained template is contributed but has been modified, <code>false</code> otherwise
139 */
140 public boolean isModified() {
141 return isCustom() && !isUserAdded();
142 }
143
144 /**
145 * Returns <code>true</code> if the contained template was added by a
146 * user, i.e. does not reference a contributed template.
147 *
148 * @return <code>true</code> if the contained template was added by a user, <code>false</code> otherwise
149 */
150 public boolean isUserAdded() {
151 return fId == null;
152 }
153
154
155 /**
156 * Reverts the template to its original setting.
157 */
158 public void revert() {
159 fCustomTemplate= fOriginalTemplate;
160 fCustomIsEnabled= fOriginalIsEnabled;
161 fIsDeleted= false;
162 }
163
164
165 /**
166 * Returns the enablement state of the contained template.
167 *
168 * @return the enablement state of the contained template
169 */
170 public boolean isEnabled() {
171 return fCustomIsEnabled;
172 }
173
174 /**
175 * Sets the enablement state of the contained template.
176 *
177 * @param isEnabled the new enablement state of the contained template
178 */
179 public void setEnabled(boolean isEnabled) {
180 fCustomIsEnabled= isEnabled;
181 }
182 }
0 /*******************************************************************************
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * IBM Corporation - initial API and implementation
12 *******************************************************************************/
13 package org.eclipse.text.templates;
14
15 import java.io.IOException;
16 import java.io.InputStream;
17 import java.io.OutputStream;
18 import java.io.Reader;
19 import java.io.Writer;
20 import java.util.ArrayList;
21 import java.util.Collection;
22 import java.util.HashSet;
23 import java.util.MissingResourceException;
24 import java.util.ResourceBundle;
25 import java.util.Set;
26
27 import javax.xml.parsers.DocumentBuilder;
28 import javax.xml.parsers.DocumentBuilderFactory;
29 import javax.xml.parsers.ParserConfigurationException;
30 import javax.xml.transform.OutputKeys;
31 import javax.xml.transform.Transformer;
32 import javax.xml.transform.TransformerException;
33 import javax.xml.transform.TransformerFactory;
34 import javax.xml.transform.dom.DOMSource;
35 import javax.xml.transform.stream.StreamResult;
36
37 import org.xml.sax.InputSource;
38 import org.xml.sax.SAXException;
39 import org.xml.sax.helpers.DefaultHandler;
40
41 import org.w3c.dom.Attr;
42 import org.w3c.dom.Document;
43 import org.w3c.dom.NamedNodeMap;
44 import org.w3c.dom.Node;
45 import org.w3c.dom.NodeList;
46 import org.w3c.dom.Text;
47
48 import org.eclipse.osgi.util.NLS;
49
50 import org.eclipse.core.runtime.Assert;
51 import org.eclipse.core.runtime.ILog;
52 import org.eclipse.core.runtime.IStatus;
53 import org.eclipse.core.runtime.Platform;
54 import org.eclipse.core.runtime.Status;
55
56 import org.eclipse.jface.text.templates.Template;
57
58 /**
59 * Serializes templates as character or byte stream and reads the same format
60 * back.
61 * <p>
62 * Clients may instantiate this class, it is not intended to be
63 * subclassed.</p>
64 *
65 * @since 3.7
66 * @noextend This class is not intended to be subclassed by clients.
67 */
68 public class TemplateReaderWriter {
69
70 private static final String TEMPLATE_ROOT = "templates"; //$NON-NLS-1$
71 private static final String TEMPLATE_ELEMENT = "template"; //$NON-NLS-1$
72 private static final String NAME_ATTRIBUTE= "name"; //$NON-NLS-1$
73 private static final String ID_ATTRIBUTE= "id"; //$NON-NLS-1$
74 private static final String DESCRIPTION_ATTRIBUTE= "description"; //$NON-NLS-1$
75 private static final String CONTEXT_ATTRIBUTE= "context"; //$NON-NLS-1$
76 private static final String ENABLED_ATTRIBUTE= "enabled"; //$NON-NLS-1$
77 private static final String DELETED_ATTRIBUTE= "deleted"; //$NON-NLS-1$
78 /**
79 * @since 3.1
80 */
81 private static final String AUTO_INSERTABLE_ATTRIBUTE= "autoinsert"; //$NON-NLS-1$
82
83 /**
84 * Create a new instance.
85 */
86 public TemplateReaderWriter() {
87 }
88
89 /**
90 * Reads templates from a reader and returns them. The reader must present
91 * a serialized form as produced by the <code>save</code> method.
92 *
93 * @param reader the reader to read templates from
94 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
95 * @throws IOException if reading from the stream fails
96 */
97 public TemplatePersistenceData[] read(Reader reader) throws IOException {
98 return read(reader, null);
99 }
100
101 /**
102 * Reads the template with identifier <code>id</code> from a reader and
103 * returns it. The reader must present a serialized form as produced by the
104 * <code>save</code> method.
105 *
106 * @param reader the reader to read templates from
107 * @param id the id of the template to return
108 * @return the read template, encapsulated in an instances of
109 * <code>TemplatePersistenceData</code>
110 * @throws IOException if reading from the stream fails
111 * @since 3.1
112 */
113 public TemplatePersistenceData readSingle(Reader reader, String id) throws IOException {
114 TemplatePersistenceData[] datas= read(new InputSource(reader), null, id);
115 if (datas.length > 0)
116 return datas[0];
117 return null;
118 }
119
120 /**
121 * Reads templates from a stream and adds them to the templates.
122 *
123 * @param reader the reader to read templates from
124 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
125 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
126 * @throws IOException if reading from the stream fails
127 */
128 public TemplatePersistenceData[] read(Reader reader, ResourceBundle bundle) throws IOException {
129 return read(new InputSource(reader), bundle, null);
130 }
131
132 /**
133 * Reads templates from a stream and adds them to the templates.
134 *
135 * @param stream the byte stream to read templates from
136 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
137 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
138 * @throws IOException if reading from the stream fails
139 */
140 public TemplatePersistenceData[] read(InputStream stream, ResourceBundle bundle) throws IOException {
141 return read(new InputSource(stream), bundle, null);
142 }
143
144 /**
145 * Reads templates from an <code>InputSource</code> and adds them to the templates.
146 *
147 * @param source the input source
148 * @param bundle a resource bundle to use for translating the read templates, or <code>null</code> if no translation should occur
149 * @param singleId the template id to extract, or <code>null</code> to read in all templates
150 * @return the read templates, encapsulated in instances of <code>TemplatePersistenceData</code>
151 * @throws IOException if reading from the stream fails
152 */
153 private TemplatePersistenceData[] read(InputSource source, ResourceBundle bundle, String singleId) throws IOException {
154 try {
155 Collection<TemplatePersistenceData> templates= new ArrayList<>();
156 Set<String> ids= new HashSet<>();
157
158 DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
159 DocumentBuilder parser= factory.newDocumentBuilder();
160 parser.setErrorHandler(new DefaultHandler());
161 Document document= parser.parse(source);
162
163 NodeList elements= document.getElementsByTagName(TEMPLATE_ELEMENT);
164
165 int count= elements.getLength();
166 for (int i= 0; i != count; i++) {
167 Node node= elements.item(i);
168 NamedNodeMap attributes= node.getAttributes();
169
170 if (attributes == null)
171 continue;
172
173 String id= getStringValue(attributes, ID_ATTRIBUTE, null);
174 if (id != null && ids.contains(id)) {
175 String PLUGIN_ID= "org.eclipse.jface.text"; //$NON-NLS-1$
176 ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID));
177 String message= NLS.bind(TextTemplateMessages.getString("TemplateReaderWriter.duplicate.id"), id); //$NON-NLS-1$
178 log.log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null));
179 } else {
180 ids.add(id);
181 }
182
183 if (singleId != null && !singleId.equals(id))
184 continue;
185
186 boolean deleted = getBooleanValue(attributes, DELETED_ATTRIBUTE, false);
187
188 String name= getStringValue(attributes, NAME_ATTRIBUTE);
189 name= translateString(name, bundle);
190
191 String description= getStringValue(attributes, DESCRIPTION_ATTRIBUTE, ""); //$NON-NLS-1$
192 description= translateString(description, bundle);
193
194 String context= getStringValue(attributes, CONTEXT_ATTRIBUTE);
195
196 if (name == null || context == null)
197 throw new IOException(TextTemplateMessages.getString("TemplateReaderWriter.error.missing_attribute")); //$NON-NLS-1$
198
199 boolean enabled = getBooleanValue(attributes, ENABLED_ATTRIBUTE, true);
200 boolean autoInsertable= getBooleanValue(attributes, AUTO_INSERTABLE_ATTRIBUTE, true);
201
202 StringBuilder buffer= new StringBuilder();
203 NodeList children= node.getChildNodes();
204 for (int j= 0; j != children.getLength(); j++) {
205 String value= children.item(j).getNodeValue();
206 if (value != null)
207 buffer.append(value);
208 }
209 String pattern= buffer.toString();
210 pattern= translateString(pattern, bundle);
211
212 Template template= new Template(name, description, context, pattern, autoInsertable);
213 TemplatePersistenceData data= new TemplatePersistenceData(template, enabled, id);
214 data.setDeleted(deleted);
215
216 templates.add(data);
217
218 if (singleId != null && singleId.equals(id))
219 break;
220 }
221
222 return templates.toArray(new TemplatePersistenceData[templates.size()]);
223
224 } catch (ParserConfigurationException e) {
225 Assert.isTrue(false);
226 } catch (SAXException e) {
227 throw (IOException)new IOException("Could not read template file").initCause(e); //$NON-NLS-1$
228 }
229
230 return null; // dummy
231 }
232
233 /**
234 * Saves the templates as XML, encoded as UTF-8 onto the given byte stream.
235 *
236 * @param templates the templates to save
237 * @param stream the byte output to write the templates to in XML
238 * @throws IOException if writing the templates fails
239 */
240 public void save(TemplatePersistenceData[] templates, OutputStream stream) throws IOException {
241 save(templates, new StreamResult(stream));
242 }
243
244 /**
245 * Saves the templates as XML.
246 *
247 * @param templates the templates to save
248 * @param writer the writer to write the templates to in XML
249 * @throws IOException if writing the templates fails
250 */
251 public void save(TemplatePersistenceData[] templates, Writer writer) throws IOException {
252 save(templates, new StreamResult(writer));
253 }
254
255 /**
256 * Saves the templates as XML.
257 *
258 * @param templates the templates to save
259 * @param result the stream result to write to
260 * @throws IOException if writing the templates fails
261 */
262 private void save(TemplatePersistenceData[] templates, StreamResult result) throws IOException {
263 try {
264 DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
265 DocumentBuilder builder= factory.newDocumentBuilder();
266 Document document= builder.newDocument();
267
268 Node root= document.createElement(TEMPLATE_ROOT);
269 document.appendChild(root);
270
271 for (TemplatePersistenceData data : templates) {
272 Template template= data.getTemplate();
273
274 Node node= document.createElement(TEMPLATE_ELEMENT);
275 root.appendChild(node);
276
277 NamedNodeMap attributes= node.getAttributes();
278
279 String id= data.getId();
280 if (id != null) {
281 Attr idAttr= document.createAttribute(ID_ATTRIBUTE);
282 idAttr.setValue(id);
283 attributes.setNamedItem(idAttr);
284 }
285
286 if (template != null) {
287 Attr name= document.createAttribute(NAME_ATTRIBUTE);
288 name.setValue(validateXML(template.getName()));
289 attributes.setNamedItem(name);
290 }
291
292 if (template != null) {
293 Attr description= document.createAttribute(DESCRIPTION_ATTRIBUTE);
294 description.setValue(validateXML(template.getDescription()));
295 attributes.setNamedItem(description);
296 }
297
298 if (template != null) {
299 Attr context= document.createAttribute(CONTEXT_ATTRIBUTE);
300 context.setValue(validateXML(template.getContextTypeId()));
301 attributes.setNamedItem(context);
302 }
303
304 Attr enabled= document.createAttribute(ENABLED_ATTRIBUTE);
305 enabled.setValue(data.isEnabled() ? Boolean.toString(true) : Boolean.toString(false));
306 attributes.setNamedItem(enabled);
307
308 Attr deleted= document.createAttribute(DELETED_ATTRIBUTE);
309 deleted.setValue(data.isDeleted() ? Boolean.toString(true) : Boolean.toString(false));
310 attributes.setNamedItem(deleted);
311
312 if (template != null) {
313 Attr autoInsertable= document.createAttribute(AUTO_INSERTABLE_ATTRIBUTE);
314 autoInsertable.setValue(template.isAutoInsertable() ? Boolean.toString(true) : Boolean.toString(false));
315 attributes.setNamedItem(autoInsertable);
316 }
317
318 if (template != null) {
319 Text pattern= document.createTextNode(validateXML(template.getPattern()));
320 node.appendChild(pattern);
321 }
322 }
323
324
325 Transformer transformer=TransformerFactory.newInstance().newTransformer();
326 transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
327 transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
328 DOMSource source = new DOMSource(document);
329
330 transformer.transform(source, result);
331
332 } catch (ParserConfigurationException e) {
333 Assert.isTrue(false);
334 } catch (TransformerException e) {
335 if (e.getException() instanceof IOException)
336 throw (IOException) e.getException();
337 Assert.isTrue(false);
338 }
339 }
340
341 /**
342 * Validates whether the given string only contains valid XML characters.
343 *
344 * @param string the string to validate
345 * @return the input string
346 * @throws IOException when the first invalid character is detected
347 * @since 3.6
348 */
349 private static String validateXML(String string) throws IOException {
350 for (int i= 0; i < string.length(); i++) {
351 char ch= string.charAt(i);
352 if (!(ch == 9 || ch == 10 || ch == 13 || ch >= 32))
353 throw new IOException("Character reference \"&#" + Integer.toString(ch) + "\" is an invalid XML character."); //$NON-NLS-1$ //$NON-NLS-2$
354 }
355 return string;
356 }
357
358 private boolean getBooleanValue(NamedNodeMap attributes, String attribute, boolean defaultValue) throws SAXException {
359 Node enabledNode= attributes.getNamedItem(attribute);
360 if (enabledNode == null)
361 return defaultValue;
362 else if (enabledNode.getNodeValue().equals(Boolean.toString(true)))
363 return true;
364 else if (enabledNode.getNodeValue().equals(Boolean.toString(false)))
365 return false;
366 else
367 throw new SAXException(TextTemplateMessages.getString("TemplateReaderWriter.error.illegal_boolean_attribute")); //$NON-NLS-1$
368 }
369
370 private String getStringValue(NamedNodeMap attributes, String name) throws SAXException {
371 String val= getStringValue(attributes, name, null);
372 if (val == null)
373 throw new SAXException(TextTemplateMessages.getString("TemplateReaderWriter.error.missing_attribute")); //$NON-NLS-1$
374 return val;
375 }
376
377 private String getStringValue(NamedNodeMap attributes, String name, String defaultValue) {
378 Node node= attributes.getNamedItem(name);
379 return node == null ? defaultValue : node.getNodeValue();
380 }
381
382 private String translateString(String str, ResourceBundle bundle) {
383 if (bundle == null)
384 return str;
385
386 int idx= str.indexOf('%');
387 if (idx == -1) {
388 return str;
389 }
390 StringBuilder buf= new StringBuilder();
391 int k= 0;
392 while (idx != -1) {
393 buf.append(str.substring(k, idx));
394 for (k= idx + 1; k < str.length() && !Character.isWhitespace(str.charAt(k)); k++) {
395 // loop
396 }
397 String key= str.substring(idx + 1, k);
398 buf.append(getBundleString(key, bundle));
399 idx= str.indexOf('%', k);
400 }
401 buf.append(str.substring(k));
402 return buf.toString();
403 }
404
405 private String getBundleString(String key, ResourceBundle bundle) {
406 if (bundle != null) {
407 try {
408 return bundle.getString(key);
409 } catch (MissingResourceException e) {
410 return '!' + key + '!';
411 }
412 }
413 return TextTemplateMessages.getString(key); // default messages
414 }
415 }
416
0 /*******************************************************************************
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * IBM Corporation - initial API and implementation
12 *******************************************************************************/
13 package org.eclipse.text.templates;
14
15 import java.io.IOException;
16 import java.io.Reader;
17 import java.io.StringReader;
18 import java.io.StringWriter;
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.osgi.service.prefs.BackingStoreException;
23
24 import org.eclipse.core.runtime.Assert;
25 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
26 import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
27 import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
28
29 import org.eclipse.text.templates.ContextTypeRegistry;
30 import org.eclipse.text.templates.TemplatePersistenceData;
31
32 import org.eclipse.jface.text.templates.Template;
33 import org.eclipse.jface.text.templates.TemplateException;
34
35 /**
36 * A collection of templates. Clients may instantiate this class. In order to
37 * load templates contributed using the <code>org.eclipse.ui.editors.templates</code>
38 * extension point, use a <code>ContributionTemplateStore</code>.
39 *
40 * @since 3.7
41 */
42 public class TemplateStoreCore {
43
44 /** The stored templates. */
45 private final List<TemplatePersistenceData> fTemplates= new ArrayList<>();
46 /** The preference store. */
47 private IEclipsePreferences fPreferenceStore;
48 /**
49 * The key into <code>fPreferenceStore</code> the value of which holds custom templates
50 * encoded as XML.
51 */
52 private String fKey;
53 /**
54 * The context type registry, or <code>null</code> if all templates regardless
55 * of context type should be loaded.
56 */
57 private ContextTypeRegistry fRegistry;
58 /**
59 * Set to <code>true</code> if property change events should be ignored (e.g. during writing
60 * to the preference store).
61 *
62 * @since 3.2
63 */
64 private boolean fIgnorePreferenceStoreChanges= false;
65 /**
66 * The property listener, if any is registered, <code>null</code> otherwise.
67 *
68 * @since 3.2
69 */
70 private IPreferenceChangeListener fPropertyListener;
71
72
73 /**
74 * Creates a new template store.
75 *
76 * @param store the preference store in which to store custom templates
77 * under <code>key</code>
78 * @param key the key into <code>store</code> where to store custom
79 * templates
80 */
81 public TemplateStoreCore(IEclipsePreferences store, String key) {
82 Assert.isNotNull(key);
83 fPreferenceStore= store;
84 fKey= key;
85 }
86
87 /**
88 * Creates a new template store with a context type registry. Only templates
89 * that specify a context type contained in the registry will be loaded by
90 * this store if the registry is not <code>null</code>.
91 *
92 * @param registry a context type registry, or <code>null</code> if all
93 * templates should be loaded
94 * @param store the preference store in which to store custom templates
95 * under <code>key</code>
96 * @param key the key into <code>store</code> where to store custom
97 * templates
98 */
99 public TemplateStoreCore(ContextTypeRegistry registry, IEclipsePreferences store, String key) {
100 this(store, key);
101 fRegistry= registry;
102 }
103
104 /**
105 * Loads the templates from contributions and preferences.
106 *
107 * @throws IOException if loading fails.
108 */
109 public void load() throws IOException {
110 fTemplates.clear();
111 loadContributedTemplates();
112 loadCustomTemplates();
113 }
114
115 /**
116 * Starts listening for property changes on the preference store. If the configured preference
117 * key changes, the template store is {@link #load() reloaded}. Call
118 * {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the
119 * auto-updating behavior.
120 *
121 * @since 3.2
122 */
123 public void startListeningForPreferenceChanges() {
124 if (fPropertyListener == null) {
125 fPropertyListener= new IPreferenceChangeListener() {
126 @Override
127 public void preferenceChange(PreferenceChangeEvent event) {
128 /*
129 * Don't load if we are in the process of saving ourselves. We are in sync anyway after the
130 * save operation, and clients may trigger reloading by listening to preference store
131 * updates.
132 */
133 if (!fIgnorePreferenceStoreChanges && fKey.equals(event.getKey()))
134 try {
135 load();
136 } catch (IOException x) {
137 handleException(x);
138 }
139 }
140 };
141 fPreferenceStore.addPreferenceChangeListener(fPropertyListener);
142 }
143
144 }
145
146 /**
147 * Stops the auto-updating behavior started by calling
148 * {@link #startListeningForPreferenceChanges()}.
149 *
150 * @since 3.2
151 */
152 public void stopListeningForPreferenceChanges() {
153 if (fPropertyListener != null) {
154 fPreferenceStore.removePreferenceChangeListener(fPropertyListener);
155 fPropertyListener= null;
156 }
157 }
158
159 /**
160 * Handles an {@link IOException} thrown during reloading the preferences due to a preference
161 * store update. The default is to write to stderr.
162 *
163 * @param x the exception
164 * @since 3.2
165 */
166 protected void handleException(IOException x) {
167 x.printStackTrace();
168 }
169
170 /**
171 * Hook method to load contributed templates. Contributed templates are superseded
172 * by customized versions of user added templates stored in the preferences.
173 * <p>
174 * The default implementation does nothing.</p>
175 *
176 * @throws IOException if loading fails
177 */
178 protected void loadContributedTemplates() throws IOException {
179 }
180
181 /**
182 * Adds a template to the internal store. The added templates must have
183 * a unique id.
184 *
185 * @param data the template data to add
186 */
187 protected void internalAdd(TemplatePersistenceData data) {
188 if (!data.isCustom()) {
189 // check if the added template is not a duplicate id
190 String id= data.getId();
191 for (TemplatePersistenceData persistenceData : fTemplates) {
192 if (persistenceData.getId() != null && persistenceData.getId().equals(id))
193 return;
194 }
195 fTemplates.add(data);
196 }
197 }
198
199 /**
200 * Saves the templates to the preferences.
201 *
202 * @throws IOException if the templates cannot be written
203 */
204 public void save() throws IOException {
205 ArrayList<TemplatePersistenceData> custom= new ArrayList<>();
206 for (TemplatePersistenceData data : fTemplates) {
207 if (data.isCustom() && !(data.isUserAdded() && data.isDeleted())) // don't save deleted user-added templates
208 custom.add(data);
209 }
210
211 StringWriter output= new StringWriter();
212 TemplateReaderWriter writer= new TemplateReaderWriter();
213 writer.save(custom.toArray(new TemplatePersistenceData[custom.size()]), output);
214
215 fIgnorePreferenceStoreChanges= true;
216 try {
217 fPreferenceStore.put(fKey, output.toString());
218 fPreferenceStore.flush();
219 } catch (BackingStoreException e) {
220 } finally {
221 fIgnorePreferenceStoreChanges= false;
222 }
223 }
224
225 /**
226 * Adds a template encapsulated in its persistent form.
227 *
228 * @param data the template to add
229 */
230 public void add(TemplatePersistenceData data) {
231
232 if (!validateTemplate(data.getTemplate()))
233 return;
234
235 if (data.isUserAdded()) {
236 fTemplates.add(data);
237 } else {
238 for (TemplatePersistenceData persistenceData : fTemplates) {
239 if (persistenceData.getId() != null && persistenceData.getId().equals(data.getId())) {
240 persistenceData.setTemplate(data.getTemplate());
241 persistenceData.setDeleted(data.isDeleted());
242 persistenceData.setEnabled(data.isEnabled());
243 return;
244 }
245 }
246
247 // add an id which is not contributed as add-on
248 if (data.getTemplate() != null) {
249 TemplatePersistenceData newData= new TemplatePersistenceData(data.getTemplate(), data.isEnabled(), data.getId());
250 fTemplates.add(newData);
251 }
252 }
253 }
254
255 /**
256 * Removes a template from the store.
257 *
258 * @param data the template to remove
259 */
260 public void delete(TemplatePersistenceData data) {
261 if (data.isUserAdded())
262 fTemplates.remove(data);
263 else
264 data.setDeleted(true);
265 }
266
267 /**
268 * Restores all contributed templates that have been deleted.
269 */
270 public void restoreDeleted() {
271 for (TemplatePersistenceData data : fTemplates) {
272 if (data.isDeleted())
273 data.setDeleted(false);
274 }
275 }
276
277 /**
278 * Deletes all user-added templates and reverts all contributed templates.
279 *
280 * @param doSave <code>true</code> if the store should be saved after restoring
281 * @since 3.5
282 */
283 public void restoreDefaults(boolean doSave) {
284 String oldValue= null;
285 if (!doSave)
286 oldValue= fPreferenceStore.get(fKey, null);
287
288 try {
289 fIgnorePreferenceStoreChanges= true;
290 // See IPreferenceStore for default String value
291 fPreferenceStore.put(fKey, ""); //$NON-NLS-1$
292 } finally {
293 fIgnorePreferenceStoreChanges= false;
294 }
295
296 try {
297 load();
298 } catch (IOException x) {
299 // can't log from jface-text
300 handleException(x);
301 }
302
303 if (oldValue != null) {
304 try {
305 fIgnorePreferenceStoreChanges= true;
306 fPreferenceStore.put(fKey, oldValue);
307 } finally {
308 fIgnorePreferenceStoreChanges= false;
309 }
310 }
311 }
312
313 /**
314 * Deletes all user-added templates and reverts all contributed templates.
315 * <p>
316 * <strong>Note:</strong> the store will be saved after restoring.
317 * </p>
318 */
319 public void restoreDefaults() {
320 restoreDefaults(true);
321 }
322
323 /**
324 * Returns all enabled templates.
325 *
326 * @return all enabled templates
327 */
328 public Template[] getTemplates() {
329 return getTemplates(null);
330 }
331
332 /**
333 * Returns all enabled templates for the given context type.
334 *
335 * @param contextTypeId the id of the context type of the requested templates, or <code>null</code> if all templates should be returned
336 * @return all enabled templates for the given context type
337 */
338 public Template[] getTemplates(String contextTypeId) {
339 List<Template> templates= new ArrayList<>();
340 for (TemplatePersistenceData data : fTemplates) {
341 if (data.isEnabled() && !data.isDeleted() && (contextTypeId == null || contextTypeId.equals(data.getTemplate().getContextTypeId())))
342 templates.add(data.getTemplate());
343 }
344
345 return templates.toArray(new Template[templates.size()]);
346 }
347
348 /**
349 * Returns the first enabled template that matches the name.
350 *
351 * @param name the name of the template searched for
352 * @return the first enabled template that matches both name and context type id, or <code>null</code> if none is found
353 */
354 public Template findTemplate(String name) {
355 return findTemplate(name, null);
356 }
357
358 /**
359 * Returns the first enabled template that matches both name and context type id.
360 *
361 * @param name the name of the template searched for
362 * @param contextTypeId the context type id to clip unwanted templates, or <code>null</code> if any context type is OK
363 * @return the first enabled template that matches both name and context type id, or <code>null</code> if none is found
364 */
365 public Template findTemplate(String name, String contextTypeId) {
366 Assert.isNotNull(name);
367
368 for (TemplatePersistenceData data : fTemplates) {
369 Template template= data.getTemplate();
370 if (data.isEnabled() && !data.isDeleted()
371 && (contextTypeId == null || contextTypeId.equals(template.getContextTypeId()))
372 && name.equals(template.getName()))
373 return template;
374 }
375
376 return null;
377 }
378
379 /**
380 * Returns the first enabled template that matches the given template id.
381 *
382 * @param id the id of the template searched for
383 * @return the first enabled template that matches id, or <code>null</code> if none is found
384 * @since 3.1
385 */
386 public Template findTemplateById(String id) {
387 TemplatePersistenceData data= getTemplateData(id);
388 if (data != null && !data.isDeleted())
389 return data.getTemplate();
390
391 return null;
392 }
393
394 /**
395 * Returns all template data.
396 *
397 * @param includeDeleted whether to include deleted data
398 * @return all template data, whether enabled or not
399 */
400 public TemplatePersistenceData[] getTemplateData(boolean includeDeleted) {
401 List<TemplatePersistenceData> datas= new ArrayList<>();
402 for (TemplatePersistenceData data : fTemplates) {
403 if (includeDeleted || !data.isDeleted())
404 datas.add(data);
405 }
406
407 return datas.toArray(new TemplatePersistenceData[datas.size()]);
408 }
409
410 /**
411 * Returns the template data of the template with id <code>id</code> or
412 * <code>null</code> if no such template can be found.
413 *
414 * @param id the id of the template data
415 * @return the template data of the template with id <code>id</code> or <code>null</code>
416 * @since 3.1
417 */
418 public TemplatePersistenceData getTemplateData(String id) {
419 Assert.isNotNull(id);
420 for (TemplatePersistenceData data : fTemplates) {
421 if (id.equals(data.getId()))
422 return data;
423 }
424
425 return null;
426 }
427
428 private void loadCustomTemplates() throws IOException {
429 String pref= fPreferenceStore.get(fKey, null);
430 if (pref != null && pref.trim().length() > 0) {
431 Reader input= new StringReader(pref);
432 TemplateReaderWriter reader= new TemplateReaderWriter();
433 TemplatePersistenceData[] datas= reader.read(input);
434 for (TemplatePersistenceData data : datas) {
435 add(data);
436 }
437 }
438 }
439
440 /**
441 * Validates a template against the context type registered in the context
442 * type registry. Returns always <code>true</code> if no registry is
443 * present.
444 *
445 * @param template the template to validate
446 * @return <code>true</code> if validation is successful or no context
447 * type registry is specified, <code>false</code> if validation
448 * fails
449 */
450 private boolean validateTemplate(Template template) {
451 String contextTypeId= template.getContextTypeId();
452 if (contextExists(contextTypeId)) {
453 if (fRegistry != null)
454 try {
455 fRegistry.getContextType(contextTypeId).validate(template.getPattern());
456 } catch (TemplateException e) {
457 return false;
458 }
459 return true;
460 }
461
462 return false;
463 }
464
465 /**
466 * Returns <code>true</code> if a context type id specifies a valid context type
467 * or if no context type registry is present.
468 *
469 * @param contextTypeId the context type id to look for
470 * @return <code>true</code> if the context type specified by the id
471 * is present in the context type registry, or if no registry is
472 * specified
473 */
474 private boolean contextExists(String contextTypeId) {
475 return contextTypeId != null && (fRegistry == null || fRegistry.getContextType(contextTypeId) != null);
476 }
477
478 /**
479 * Returns the registry.
480 *
481 * @return Returns the registry
482 */
483 protected ContextTypeRegistry getRegistry() {
484 return fRegistry;
485 }
486
487 /**
488 * Return the key into the Preference Store whose value contains
489 * the custom templates encoded as XML.
490 *
491 * @return the key in the Preference Store
492 */
493 protected final String getKey () {
494 return fKey;
495 }
496
497 /**
498 * Return the stored templates
499 * @return the stored templates
500 */
501 protected final List<TemplatePersistenceData> internalGetTemplates () {
502 return fTemplates;
503 }
504
505 }
506
0 /*******************************************************************************
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * IBM Corporation - initial API and implementation
12 *******************************************************************************/
13 package org.eclipse.text.templates;
14
15 import java.util.MissingResourceException;
16 import java.util.ResourceBundle;
17
18 import com.ibm.icu.text.MessageFormat;
19
20 /*
21 * @since 3.0
22 */
23 class TextTemplateMessages {
24
25 private static final String RESOURCE_BUNDLE= TextTemplateMessages.class.getName();
26 private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
27
28 private TextTemplateMessages() {
29 }
30
31 public static String getString(String key) {
32 try {
33 return fgResourceBundle.getString(key);
34 } catch (MissingResourceException e) {
35 return '!' + key + '!';
36 }
37 }
38
39 public static String getFormattedString(String key, Object arg) {
40 return MessageFormat.format(getString(key), new Object[] { arg });
41 }
42
43
44 public static String getFormattedString(String key, Object[] args) {
45 return MessageFormat.format(getString(key), args);
46 }
47 }
0 ###############################################################################
1 # Copyright (c) 2000, 2016 IBM Corporation and others.
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
5 # which accompanies this distribution, and is available at
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
9 #
10 # Contributors:
11 # IBM Corporation - initial API and implementation
12 ###############################################################################
13
14 TemplateReaderWriter.duplicate.id= Duplicate template id: ''{0}''
15 TemplateReaderWriter.error.missing_attribute= Missing required attribute
16 TemplateReaderWriter.error.illegal_boolean_attribute= Illegal boolean attribute, must be "true" or "false".
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2006 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Plugin.name
33 Bundle-SymbolicName: org.eclipse.text.tests
4 Bundle-Version: 3.12.0.qualifier
4 Bundle-Version: 3.12.100.qualifier
55 Bundle-Vendor: %Plugin.providerName
66 Bundle-Localization: plugin
77 Export-Package:
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2007 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.text</groupId>
2020 <artifactId>org.eclipse.text.tests</artifactId>
21 <version>3.12.0-SNAPSHOT</version>
21 <version>3.12.100-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Anton Leherbauer - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
133136
134137 private void doChange(IDocument document, int count) {
135138 try {
136 String before= document.get();
137139
138140 if (DEBUG)
139 System.out.println(before);
141 System.out.println(document.get());
140142
141143 Position[] positions= new Position[count];
142144 String[] strings= new String[count];
00 /*******************************************************************************
11 * Copyright (c) 2007, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
912 * Cagatay Calli <ccalli@gmail.com> - [find/replace] retain caps when replacing - https://bugs.eclipse.org/bugs/show_bug.cgi?id=28949
1013 * Cagatay Calli <ccalli@gmail.com> - [find/replace] define & fix behavior of retain caps with other escapes and text before \C - https://bugs.eclipse.org/bugs/show_bug.cgi?id=217061
11 * Florian Ingerl <imelflorianingerl@gmail.com> - [find/replace] replace doesn't work when using a regex with a lookahead or boundary matchers - https://bugs.eclipse.org/bugs/show_bug.cgi?id=109481
1214 *******************************************************************************/
1315 package org.eclipse.text.tests;
1416
500502 }
501503 fail();
502504 }
503
504 @Test
505 public void testRegexReplaceWithLookarounds() throws Exception {
506 fDocument.set("1<2<3<4");
507 replaceAllRegex("(?<=(\\d))\\<(\\d)(?=\\<(\\d))", "<($1+$3)/2=$2", true);
508 assertEquals("1<(1+3)/2=2<(2+4)/2=3<4", fDocument.get());
509
510 fDocument.set("1<2<3<4");
511 replaceAllRegex("(?<=(\\d)\\<)(\\d)\\<(?=(\\d))", "$2=($1+$3)/2<", false);
512 assertEquals("1<2=(1+3)/2<3=(2+4)/2<4", fDocument.get());
513 }
514
515 private void replaceAllRegex(String findString, String replaceString, boolean forwardSearch) throws BadLocationException {
516 FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
517
518 int index= forwardSearch ? 0 : fDocument.getLength();
519 while(index!=-1) {
520 if(findReplaceDocumentAdapter.find(index, findString, forwardSearch, true, false, true)==null)
521 break;
522 IRegion region= findReplaceDocumentAdapter.replace(replaceString, true);
523 index= forwardSearch ? region.getOffset() + region.getLength() : region.getOffset() - 1;
524 }
525 }
526505 }
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
6265 public void testCovers1() throws Exception {
6366 InsertEdit insert= new InsertEdit(1, "");
6467 DeleteEdit delete= new DeleteEdit(2, 2);
65 Assert.assertEquals(false, insert.covers(delete));
68 Assert.assertFalse(insert.covers(delete));
6669 }
6770
6871 @Test
6972 public void testCovers2() throws Exception {
7073 MultiTextEdit multi= new MultiTextEdit(0,0);
7174 MultiTextEdit child= new MultiTextEdit(0,0);
72 Assert.assertEquals(true, multi.covers(child));
75 Assert.assertTrue(multi.covers(child));
7376 }
7477
7578 @Test
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1114
1215 import static org.junit.Assert.assertEquals;
1316 import static org.junit.Assert.assertFalse;
17 import static org.junit.Assert.assertTrue;
1418
1519 import org.junit.Before;
1620 import org.junit.Test;
3842 new LinkedPosition(new Document(), 123, 234);
3943 }
4044
41 @Test
45 @Test(expected=Throwable.class)
4246 public void testNullCreate() {
43 try {
44 new LinkedPosition(null, 1, 9);
45 } catch (Throwable e) {
46 return;
47 }
48 assertFalse(true);
47 new LinkedPosition(null, 1, 9);
4948 }
5049
5150 /*
5352 */
5453 @Test
5554 public void testIncludesint() {
56 assertEquals(true, fPos.includes(3));
57 assertEquals(true, fPos.includes(6));
58 assertEquals(true, fPos.includes(13));
59 assertEquals(false, fPos.includes(2));
60 assertEquals(false, fPos.includes(15));
55 assertTrue(fPos.includes(3));
56 assertTrue(fPos.includes(6));
57 assertTrue(fPos.includes(13));
58 assertFalse(fPos.includes(2));
59 assertFalse(fPos.includes(15));
6160 }
6261
6362 @Test
7170 @Test
7271 public void testOverlapsWithLinkedPosition() {
7372 LinkedPosition pos= new LinkedPosition(fDoc, 0, 2);
74 assertEquals(false, fPos.overlapsWith(pos));
73 assertFalse(fPos.overlapsWith(pos));
7574
7675 pos= new LinkedPosition(fDoc, 0, 3);
77 assertEquals(false, fPos.overlapsWith(pos));
76 assertFalse(fPos.overlapsWith(pos));
7877
7978 pos= new LinkedPosition(fDoc, 1, 4);
80 assertEquals(true, fPos.overlapsWith(pos));
79 assertTrue(fPos.overlapsWith(pos));
8180
8281 pos= new LinkedPosition(fDoc, 3, 5);
83 assertEquals(true, fPos.overlapsWith(pos));
82 assertTrue(fPos.overlapsWith(pos));
8483
8584 pos= new LinkedPosition(fDoc, 5, 7);
86 assertEquals(true, fPos.overlapsWith(pos));
85 assertTrue(fPos.overlapsWith(pos));
8786
8887 pos= new LinkedPosition(fDoc, 7, 6);
89 assertEquals(true, fPos.overlapsWith(pos));
88 assertTrue(fPos.overlapsWith(pos));
9089
9190 pos= new LinkedPosition(fDoc, 7, 7);
92 assertEquals(true, fPos.overlapsWith(pos));
91 assertTrue(fPos.overlapsWith(pos));
9392
9493 pos= new LinkedPosition(fDoc, 13, 1);
95 assertEquals(false, fPos.overlapsWith(pos));
94 assertFalse(fPos.overlapsWith(pos));
9695
9796 pos= new LinkedPosition(fDoc, 14, 4);
98 assertEquals(false, fPos.overlapsWith(pos));
97 assertFalse(fPos.overlapsWith(pos));
9998 }
10099
101100 /*
104103 @Test
105104 public void testIncludesDocumentEvent() {
106105 DocumentEvent de= new DocumentEvent(fDoc, 0, 2, "ignore");
107 assertEquals(false, fPos.includes(de));
106 assertFalse(fPos.includes(de));
108107
109108 de= new DocumentEvent(fDoc, 0, 3, "ignore");
110 assertEquals(false, fPos.includes(de));
109 assertFalse(fPos.includes(de));
111110
112111 de= new DocumentEvent(fDoc, 1, 4, "ignore");
113 assertEquals(false, fPos.includes(de));
112 assertFalse(fPos.includes(de));
114113
115114 de= new DocumentEvent(fDoc, 3, 5, "ignore");
116 assertEquals(true, fPos.includes(de));
115 assertTrue(fPos.includes(de));
117116
118117 de= new DocumentEvent(fDoc, 5, 7, "ignore");
119 assertEquals(true, fPos.includes(de));
118 assertTrue(fPos.includes(de));
120119
121120 de= new DocumentEvent(fDoc, 7, 6, "ignore");
122 assertEquals(true, fPos.includes(de));
121 assertTrue(fPos.includes(de));
123122
124123 de= new DocumentEvent(fDoc, 7, 7, "ignore");
125 assertEquals(false, fPos.includes(de));
124 assertFalse(fPos.includes(de));
126125
127126 de= new DocumentEvent(fDoc, 13, 1, "ignore");
128 assertEquals(false, fPos.includes(de));
127 assertFalse(fPos.includes(de));
129128
130129 de= new DocumentEvent(fDoc, 14, 4, "ignore");
131 assertEquals(false, fPos.includes(de));
130 assertFalse(fPos.includes(de));
132131 }
133132
134133 /*
137136 @Test
138137 public void testIncludesLinkedPosition() {
139138 LinkedPosition pos= new LinkedPosition(fDoc, 0, 2);
140 assertEquals(false, fPos.includes(pos));
139 assertFalse(fPos.includes(pos));
141140
142141 pos= new LinkedPosition(fDoc, 0, 3);
143 assertEquals(false, fPos.includes(pos));
142 assertFalse(fPos.includes(pos));
144143
145144 pos= new LinkedPosition(fDoc, 1, 4);
146 assertEquals(false, fPos.includes(pos));
145 assertFalse(fPos.includes(pos));
147146
148147 pos= new LinkedPosition(fDoc, 3, 5);
149 assertEquals(true, fPos.includes(pos));
148 assertTrue(fPos.includes(pos));
150149
151150 pos= new LinkedPosition(fDoc, 5, 7);
152 assertEquals(true, fPos.includes(pos));
151 assertTrue(fPos.includes(pos));
153152
154153 pos= new LinkedPosition(fDoc, 7, 6);
155 assertEquals(true, fPos.includes(pos));
154 assertTrue(fPos.includes(pos));
156155
157156 pos= new LinkedPosition(fDoc, 7, 7);
158 assertEquals(false, fPos.includes(pos));
157 assertFalse(fPos.includes(pos));
159158
160159 pos= new LinkedPosition(fDoc, 13, 1);
161 assertEquals(false, fPos.includes(pos));
160 assertFalse(fPos.includes(pos));
162161
163162 pos= new LinkedPosition(fDoc, 14, 4);
164 assertEquals(false, fPos.includes(pos));
163 assertFalse(fPos.includes(pos));
165164 }
166165
167166 @Test
179178 assertEquals("FAUST", p.getContent());
180179 }
181180
182 @Test
183 public void testBadLocationContent() {
181 @Test(expected= BadLocationException.class)
182 public void testBadLocationContentNull() throws BadLocationException {
184183 LinkedPosition p= new LinkedPosition(new Document(), 23, 3);
185 try {
186 p.getContent();
187 } catch (BadLocationException e) {
188 return;
189 }
190 assertFalse(true);
191
192 p= new LinkedPosition(fDoc, 23, 3);
184 p.getContent();
185 }
186
187 @Test(expected= BadLocationException.class)
188 public void testBadLocationContentEmpty() throws BadLocationException {
189 LinkedPosition p= new LinkedPosition(fDoc, 23, 3);
193190 fDoc.set("");
194 try {
195 p.getContent();
196 } catch (BadLocationException e) {
197 return;
198 }
199 assertFalse(true);
191 p.getContent();
200192 }
201193
202194 @Test
00 /*******************************************************************************
11 * Copyright (c) 2016 BSI Business Systems Integration AG.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * BSI Business Systems Integration AG - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2006, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2006, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1114 package org.eclipse.text.tests.templates;
1215
1316 import static org.junit.Assert.assertEquals;
17 import static org.junit.Assert.assertFalse;
1418 import static org.junit.Assert.assertNull;
15 import static org.junit.Assert.fail;
1619
1720 import java.util.ArrayList;
1821 import java.util.Arrays;
3942 fTranslator= new TemplateTranslator();
4043 }
4144
42 @Test
45 @Test(expected= NullPointerException.class)
4346 public void testNullTemplate() throws Exception {
44 try {
45 fTranslator.translate((String) null);
46 fail();
47 } catch (NullPointerException x) {
48 // expected
49 }
47 fTranslator.translate((String) null);
5048 }
5149
5250 @Test
5856 assertEquals("", buffer.getString());
5957 }
6058
59 @Test
6160 public void testNoVarTemplate() throws Exception {
6261 TemplateBuffer buffer= fTranslator.translate("foo bar");
6362 assertNull(fTranslator.getErrorMessage());
7776 assertEquals(1, vars[0].getOffsets().length);
7877 assertEquals(4, vars[0].getOffsets()[0]);
7978 assertEquals(3, vars[0].getLength());
80 assertEquals(false, vars[0].isUnambiguous());
79 assertFalse(vars[0].isUnambiguous());
8180 assertEquals("var", vars[0].getDefaultValue());
8281 assertEquals(1, vars[0].getValues().length);
8382 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
9695 assertEquals(4, vars[0].getOffsets()[0]);
9796 assertEquals(12, vars[0].getOffsets()[1]);
9897 assertEquals(3, vars[0].getLength());
99 assertEquals(false, vars[0].isUnambiguous());
98 assertFalse(vars[0].isUnambiguous());
10099 assertEquals("var", vars[0].getDefaultValue());
101100 assertEquals(1, vars[0].getValues().length);
102101 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
115114 assertEquals(1, vars[0].getOffsets().length);
116115 assertEquals(19, vars[0].getOffsets()[0]);
117116 assertEquals(4, vars[0].getLength());
118 assertEquals(false, vars[0].isUnambiguous());
117 assertFalse(vars[0].isUnambiguous());
119118 assertEquals("bl\u00F6d", vars[0].getDefaultValue());
120119 assertEquals(1, vars[0].getValues().length);
121120 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
125124 assertEquals(1, vars[1].getOffsets().length);
126125 assertEquals(50, vars[1].getOffsets()[0]);
127126 assertEquals(2, vars[1].getLength());
128 assertEquals(false, vars[1].isUnambiguous());
127 assertFalse(vars[1].isUnambiguous());
129128 assertEquals("h\u00E4", vars[1].getDefaultValue());
130129 assertEquals(1, vars[1].getValues().length);
131130 assertEquals(vars[1].getDefaultValue(), vars[1].getValues()[0]);
143142 assertEquals(0, vars[0].getOffsets()[0]);
144143 assertEquals(3, vars[0].getOffsets()[1]);
145144 assertEquals(1, vars[0].getLength());
146 assertEquals(false, vars[0].isUnambiguous());
145 assertFalse(vars[0].isUnambiguous());
147146 assertEquals("0", vars[0].getDefaultValue());
148147 assertEquals(1, vars[0].getValues().length);
149148 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
152151 assertEquals(Arrays.asList(new Object[] { "1", "2 ", "3" }), vars[0].getVariableType().getParams());
153152 }
154153
155 @Test
154 @Test(expected=TemplateException.class)
156155 public void testIllegalSyntax1() throws Exception {
157 ensureFailure("foo ${var");
158 }
159
160 private void ensureFailure(String template) {
161 try {
162 fTranslator.translate(template);
163 fail();
164 } catch (TemplateException e) {
165 // expected
166 }
167 }
168
169 @Test
156 fTranslator.translate("foo ${var");
157 }
158
159 @Test(expected=TemplateException.class)
170160 public void testIllegalSyntax2() throws Exception {
171 ensureFailure("foo $");
172 }
173
174 @Test
161 fTranslator.translate("foo $");
162 }
163
164 @Test(expected=TemplateException.class)
175165 public void testIllegalSyntax3() throws Exception {
176 ensureFailure("foo ${] } bar");
166 fTranslator.translate("foo ${] } bar");
177167 }
178168
179169 @Test
196186 assertEquals(1, vars[0].getOffsets().length);
197187 assertEquals(4, vars[0].getOffsets()[0]);
198188 assertEquals(0, vars[0].getLength());
199 assertEquals(false, vars[0].isUnambiguous());
189 assertFalse(vars[0].isUnambiguous());
200190 assertEquals("", vars[0].getDefaultValue());
201191 assertEquals(1, vars[0].getValues().length);
202192 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
215205 assertEquals(1, vars[0].getOffsets().length);
216206 assertEquals(4, vars[0].getOffsets()[0]);
217207 assertEquals(3, vars[0].getLength());
218 assertEquals(false, vars[0].isUnambiguous());
208 assertFalse(vars[0].isUnambiguous());
219209 assertEquals("var", vars[0].getDefaultValue());
220210 assertEquals(1, vars[0].getValues().length);
221211 assertEquals("type", vars[0].getType());
232222 assertEquals(1, vars[0].getOffsets().length);
233223 assertEquals(4, vars[0].getOffsets()[0]);
234224 assertEquals(3, vars[0].getLength());
235 assertEquals(false, vars[0].isUnambiguous());
225 assertFalse(vars[0].isUnambiguous());
236226 assertEquals("var", vars[0].getDefaultValue());
237227 assertEquals(1, vars[0].getValues().length);
238228 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
252242 assertEquals(4, vars[0].getOffsets()[0]);
253243 assertEquals(12, vars[0].getOffsets()[1]);
254244 assertEquals(3, vars[0].getLength());
255 assertEquals(false, vars[0].isUnambiguous());
245 assertFalse(vars[0].isUnambiguous());
256246 assertEquals("var", vars[0].getDefaultValue());
257247 assertEquals(1, vars[0].getValues().length);
258248 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
272262 assertEquals(4, vars[0].getOffsets()[0]);
273263 assertEquals(12, vars[0].getOffsets()[1]);
274264 assertEquals(3, vars[0].getLength());
275 assertEquals(false, vars[0].isUnambiguous());
265 assertFalse(vars[0].isUnambiguous());
276266 assertEquals("var", vars[0].getDefaultValue());
277267 assertEquals(1, vars[0].getValues().length);
278268 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
280270 assertEquals(Collections.singletonList("param"), vars[0].getVariableType().getParams());
281271 }
282272
283 @Test
284 public void testIllegallyParameterizedTypeTemplate() throws Exception {
285 ensureFailure("foo ${var:type(param)} bar ${var:type(other)} end");
286 ensureFailure("foo ${var:type(param)} bar ${var:type} end");
273 @Test(expected=TemplateException.class)
274 public void testIllegallyParameterizedTypeTemplate1() throws Exception {
275 fTranslator.translate("foo ${var:type(param)} bar ${var:type(other)} end");
276 }
277
278 @Test(expected=TemplateException.class)
279 public void testIllegallyParameterizedTypeTemplate2() throws Exception {
280 fTranslator.translate("foo ${var:type(param)} bar ${var:type} end");
287281 }
288282
289283 @Test
297291 assertEquals(1, vars[0].getOffsets().length);
298292 assertEquals(4, vars[0].getOffsets()[0]);
299293 assertEquals(3, vars[0].getLength());
300 assertEquals(false, vars[0].isUnambiguous());
294 assertFalse(vars[0].isUnambiguous());
301295 assertEquals("var", vars[0].getDefaultValue());
302296 assertEquals(1, vars[0].getValues().length);
303297 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
320314 assertEquals(1, vars[0].getOffsets().length);
321315 assertEquals(4, vars[0].getOffsets()[0]);
322316 assertEquals(3, vars[0].getLength());
323 assertEquals(false, vars[0].isUnambiguous());
317 assertFalse(vars[0].isUnambiguous());
324318 assertEquals("var", vars[0].getDefaultValue());
325319 assertEquals(1, vars[0].getValues().length);
326320 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
342336 assertEquals(1, vars[0].getOffsets().length);
343337 assertEquals(4, vars[0].getOffsets()[0]);
344338 assertEquals(3, vars[0].getLength());
345 assertEquals(false, vars[0].isUnambiguous());
339 assertFalse(vars[0].isUnambiguous());
346340 assertEquals("var", vars[0].getDefaultValue());
347341 assertEquals(1, vars[0].getValues().length);
348342 assertEquals(vars[0].getDefaultValue(), vars[0].getValues()[0]);
354348 assertEquals(params, vars[0].getVariableType().getParams());
355349 }
356350
357 @Test
351 @Test(expected=TemplateException.class)
358352 public void testIllegalSyntax4() throws Exception {
359 ensureFailure("foo ${var:} bar");
360 }
361
362 @Test
353 fTranslator.translate("foo ${var:} bar");
354 }
355
356 @Test(expected=TemplateException.class)
363357 public void testIllegalSyntax5() throws Exception {
364 ensureFailure("foo ${var:type(} bar");
365 }
366
367 @Test
358 fTranslator.translate("foo ${var:type(} bar");
359 }
360
361 @Test(expected=TemplateException.class)
368362 public void testIllegalSyntax6() throws Exception {
369 ensureFailure("foo ${var:type(] )} bar");
370 }
371
372 @Test
363 fTranslator.translate("foo ${var:type(] )} bar");
364 }
365
366 @Test(expected=TemplateException.class)
373367 public void testIllegalSyntax7() throws Exception {
374 ensureFailure("foo ${var:type((} bar");
368 fTranslator.translate("foo ${var:type((} bar");
375369 }
376370
377371 }
00 /*******************************************************************************
11 * Copyright (c) 2016 vogella GmbH and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lars Vogel <Lars.Vogel@vogella.com> - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
11 <component id="org.eclipse.ui.editors" version="2">
2 <resource path="META-INF/MANIFEST.MF">
3 <filter comment="The new field has @noreference, hence not a new API" id="924844039">
4 <message_arguments>
5 <message_argument value="3.11.100"/>
6 <message_argument value="3.11.0"/>
7 </message_arguments>
8 </filter>
9 </resource>
102 <resource path="src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java" type="org.eclipse.ui.editors.text.ITextEditorHelpContextIds">
113 <filter id="571473929">
124 <message_arguments>
135 <message_argument value="IAbstractTextEditorHelpContextIds"/>
146 <message_argument value="ITextEditorHelpContextIds"/>
15 </message_arguments>
16 </filter>
17 </resource>
18 <resource path="src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java" type="org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants">
19 <filter comment="@since tag not needed since @noreference and hence no API" id="1143996420">
20 <message_arguments>
21 <message_argument value="EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE"/>
227 </message_arguments>
238 </filter>
249 </resource>
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.ui.editors; singleton:=true
4 Bundle-Version: 3.11.100.qualifier
4 Bundle-Version: 3.11.200.qualifier
55 Bundle-Activator: org.eclipse.ui.internal.editors.text.EditorsPlugin
66 Bundle-ActivationPolicy: lazy
77 Bundle-Vendor: %providerName
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2016 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 <?xml version="1.0" encoding="UTF-8"?>
11 <?eclipse version="3.0"?>
2 <!-- ====================================================================== -->
3 <!-- Copyright (c) 2002, 2016 IBM Corporation and others. -->
4 <!-- All rights reserved. This program and the accompanying materials -->
5 <!-- are made available under the terms of the Eclipse Public License v1.0 -->
6 <!-- which accompanies this distribution, and is available at -->
7 <!-- http://www.eclipse.org/legal/epl-v10.html -->
8 <!-- -->
9 <!-- Contributors: -->
10 <!-- IBM Corporation - initial API and implementation -->
11 <!-- ====================================================================== -->
2 <!--
3 Copyright (c) 2002, 2016 IBM Corporation and others.
4
5 This program and the accompanying materials
6 are made available under the terms of the Eclipse Public License 2.0
7 which accompanies this distribution, and is available at
8 https://www.eclipse.org/legal/epl-2.0/
9
10 SPDX-License-Identifier: EPL-2.0
11
12 Contributors:
13 IBM Corporation - initial API and implementation
14 -->
1215 <plugin>
1316
1417 <extension-point id="documentProviders" name="%ExtPoint.documentProviders" schema="schema/documentProviders.exsd"/>
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.ui</groupId>
1919 <artifactId>org.eclipse.ui.editors</artifactId>
20 <version>3.11.100-SNAPSHOT</version>
20 <version>3.11.200-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
164164 </appInfo>
165165 <documentation>
166166 Copyright (c) 2001, 2008 IBM Corporation and others.&lt;br&gt;
167 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
167
168 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
169
170 SPDX-License-Identifier: EPL-2.0
168171 </documentation>
169172 </annotation>
170173
142142 </appInfo>
143143 <documentation>
144144 Copyright (c) 2001, 2009 IBM Corporation and others.&lt;br&gt;
145 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
145
146 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
147
148 SPDX-License-Identifier: EPL-2.0
146149 </documentation>
147150 </annotation>
148151
325325 </appInfo>
326326 <documentation>
327327 Copyright (c) 2001, 2016 IBM Corporation and others.&lt;br&gt;
328 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
328
329 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
330
331 SPDX-License-Identifier: EPL-2.0
329332 </documentation>
330333 </annotation>
331334
155155 </appInfo>
156156 <documentation>
157157 Copyright (c) 2001, 2014 IBM Corporation and others.&lt;br&gt;
158 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
158
159 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
160
161 SPDX-License-Identifier: EPL-2.0
159162 </documentation>
160163 </annotation>
161164
385385 </appInfo>
386386 <documentation>
387387 Copyright (c) 2001, 2010 IBM Corporation and others.&lt;br&gt;
388 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
388
389 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
390
391 SPDX-License-Identifier: EPL-2.0
389392 </documentation>
390393 </annotation>
391394
00 ###############################################################################
11 # Copyright (c) 2000, 2012 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2730 import org.eclipse.core.runtime.IStatus;
2831 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
2932 import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
30 import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
3133 import org.eclipse.core.runtime.preferences.InstanceScope;
3234
3335 import org.eclipse.core.resources.ResourcesPlugin;
7476
7577 IEclipsePreferences prefs= InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES);
7678
77 fPreferenceChangeListener= new IPreferenceChangeListener() {
78 @Override
79 public void preferenceChange(PreferenceChangeEvent event) {
80 if (ResourcesPlugin.PREF_ENCODING.equals(event.getKey())) {
81 Runnable runnable= new Runnable() {
82 @Override
83 public void run() {
84 setEncoding(null, false); // null means: use default
85 }
86 };
87 if (Display.getCurrent() != null)
88 runnable.run();
89 else {
90 // Post runnable into UI thread
91 Shell shell;
92 if (fTextEditor != null)
93 shell= fTextEditor.getSite().getShell();
94 else
95 shell= getActiveWorkbenchShell();
96 Display display;
97 if (shell != null)
98 display= shell.getDisplay();
99 else
100 display= Display.getDefault();
101 display.asyncExec(runnable);
102 }
79 fPreferenceChangeListener= event -> {
80 if (ResourcesPlugin.PREF_ENCODING.equals(event.getKey())) {
81 // null means: use default
82 Runnable runnable= () -> setEncoding(null, false);
83 if (Display.getCurrent() != null)
84 runnable.run();
85 else {
86 // Post runnable into UI thread
87 Shell shell;
88 if (fTextEditor != null)
89 shell= fTextEditor.getSite().getShell();
90 else
91 shell= getActiveWorkbenchShell();
92 Display display;
93 if (shell != null)
94 display= shell.getDisplay();
95 else
96 display= Display.getDefault();
97 display.asyncExec(runnable);
10398 }
10499 }
105100 };
142137 if (apply) {
143138 provider.setEncoding(input, encoding);
144139 Runnable encodingSetter=
145 new Runnable() {
146 @Override
147 public void run() {
148 fTextEditor.doRevertToSaved();
149 }
150 };
140 () -> fTextEditor.doRevertToSaved();
151141 Display display= fTextEditor.getSite().getShell().getDisplay();
152142 if (display != null && !display.isDisposed())
153143 BusyIndicator.showWhile(display, encodingSetter);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2010 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2007 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
311314 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=66686 and
312315 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56871
313316
314 Runnable runnable= new Runnable() {
315 @Override
316 public void run() {
317 synchronized (fLock) {
318 if (fDocumentProvider == provider)
319 // addElementStateListener adds at most once - no problem to call repeatedly
320 provider.addElementStateListener(LastSaveReferenceProvider.this);
321 }
317 Runnable runnable= () -> {
318 synchronized (fLock) {
319 if (fDocumentProvider == provider)
320 // addElementStateListener adds at most once - no problem to call repeatedly
321 provider.addElementStateListener(LastSaveReferenceProvider.this);
322322 }
323323 };
324324
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
4144 import org.eclipse.jface.resource.ImageRegistry;
4245 import org.eclipse.jface.viewers.ArrayContentProvider;
4346 import org.eclipse.jface.viewers.ComboViewer;
44 import org.eclipse.jface.viewers.ISelectionChangedListener;
4547 import org.eclipse.jface.viewers.IStructuredContentProvider;
4648 import org.eclipse.jface.viewers.LabelProvider;
47 import org.eclipse.jface.viewers.SelectionChangedEvent;
4849 import org.eclipse.jface.viewers.StructuredSelection;
4950 import org.eclipse.jface.viewers.StructuredViewer;
5051 import org.eclipse.jface.viewers.TableViewer;
296297 fIsNextPreviousTargetCheckBox.setLayoutData(gd);
297298
298299
299 fAnnotationTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
300 @Override
301 public void selectionChanged(SelectionChangedEvent event) {
302 handleAnnotationListSelection();
303 }
304 });
300 fAnnotationTypeViewer.addSelectionChangedListener(event -> handleAnnotationListSelection());
305301
306302 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
307303 @Override
389385 }
390386 });
391387
392 fDecorationViewer.addSelectionChangedListener(new ISelectionChangedListener() {
393
394 @Override
395 public void selectionChanged(SelectionChangedEvent event) {
396 String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
397 ListItem item= getSelectedItem();
398
399 if (fShowInTextCheckBox.getSelection()) {
400 if (HIGHLIGHT.equals(decoration)) {
401 fStore.setValue(item.highlightKey, true);
402 if (item.textKey != null) {
403 fStore.setValue(item.textKey, false);
404 if (item.textStyleKey != null)
405 fStore.setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
406 }
407 } else {
408 if (item.highlightKey != null)
409 fStore.setValue(item.highlightKey, false);
410 if (item.textKey != null) {
411 fStore.setValue(item.textKey, true);
412 if (item.textStyleKey != null)
413 fStore.setValue(item.textStyleKey, decoration[1]);
414 }
388 fDecorationViewer.addSelectionChangedListener(event -> {
389 String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
390 ListItem item= getSelectedItem();
391
392 if (fShowInTextCheckBox.getSelection()) {
393 if (HIGHLIGHT.equals(decoration)) {
394 fStore.setValue(item.highlightKey, true);
395 if (item.textKey != null) {
396 fStore.setValue(item.textKey, false);
397 if (item.textStyleKey != null)
398 fStore.setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
399 }
400 } else {
401 if (item.highlightKey != null)
402 fStore.setValue(item.highlightKey, false);
403 if (item.textKey != null) {
404 fStore.setValue(item.textKey, true);
405 if (item.textStyleKey != null)
406 fStore.setValue(item.textStyleKey, decoration[1]);
415407 }
416408 }
417
418 fAnnotationTypeViewer.refresh(item);
419 }
409 }
410
411 fAnnotationTypeViewer.refresh(item);
420412 });
421413
422414 composite.layout();
449441 final ListItem element= fListModel[i];
450442 if (data.equals(element.label)) {
451443 final Control control= fAnnotationTypeViewer.getControl();
452 control.getDisplay().asyncExec(new Runnable() {
453 @Override
454 public void run() {
455 control.setFocus();
456 fAnnotationTypeViewer.setSelection(new StructuredSelection(element), true);
457 }
444 control.getDisplay().asyncExec(() -> {
445 control.setFocus();
446 fAnnotationTypeViewer.setSelection(new StructuredSelection(element), true);
458447 });
459448 return;
460449 }
514503 public void initialize() {
515504
516505 fAnnotationTypeViewer.setInput(fListModel);
517 fAnnotationTypeViewer.getControl().getDisplay().asyncExec(new Runnable() {
518 @Override
519 public void run() {
520 if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
521 fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
522 }
506 fAnnotationTypeViewer.getControl().getDisplay().asyncExec(() -> {
507 if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
508 fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
523509 }
524510 });
525511
543529 }
544530 }
545531
546 Comparator<ListItem> comparator= new Comparator<ListItem>() {
547 @Override
548 public int compare(ListItem o1, ListItem o2) {
549 String label1= o1.label;
550 String label2= o2.label;
551
552 return Collator.getInstance().compare(label1, label2);
553
554 }
532 Comparator<ListItem> comparator= (o1, o2) -> {
533 String label1= o1.label;
534 String label2= o2.label;
535
536 return Collator.getInstance().compare(label1, label2);
537
555538 };
556539 Collections.sort(listModelItems, comparator);
557540
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2007, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
2023 import org.eclipse.swt.SWT;
2124 import org.eclipse.swt.events.KeyEvent;
2225 import org.eclipse.swt.events.KeyListener;
23 import org.eclipse.swt.events.ModifyEvent;
24 import org.eclipse.swt.events.ModifyListener;
2526 import org.eclipse.swt.events.SelectionAdapter;
2627 import org.eclipse.swt.events.SelectionEvent;
2728 import org.eclipse.swt.events.SelectionListener;
4546 import org.eclipse.jface.layout.PixelConverter;
4647 import org.eclipse.jface.layout.TableColumnLayout;
4748 import org.eclipse.jface.preference.PreferencePage;
48 import org.eclipse.jface.viewers.CheckStateChangedEvent;
4949 import org.eclipse.jface.viewers.CheckboxTableViewer;
5050 import org.eclipse.jface.viewers.ColumnLayoutData;
5151 import org.eclipse.jface.viewers.ColumnWeightData;
52 import org.eclipse.jface.viewers.ICheckStateListener;
5352 import org.eclipse.jface.viewers.ILabelProviderListener;
5453 import org.eclipse.jface.viewers.IStructuredContentProvider;
5554 import org.eclipse.jface.viewers.ITableLabelProvider;
265264 }
266265 });
267266
268 fHyperlinkDefaultKeyModifierText.addModifyListener(new ModifyListener() {
269 @Override
270 public void modifyText(ModifyEvent e) {
271 handleHyperlinkDefaultKeyModifierModified();
272 }
273 });
267 fHyperlinkDefaultKeyModifierText.addModifyListener(e -> handleHyperlinkDefaultKeyModifierModified());
274268
275269 addFiller(composite, 2);
276270
317311 fHyperlinkDetectorsViewer= new CheckboxTableViewer(hyperlinkDetectorTable);
318312 fHyperlinkDetectorsViewer.setUseHashlookup(true);
319313
320 fHyperlinkDetectorsViewer.addCheckStateListener(new ICheckStateListener() {
321 @Override
322 public void checkStateChanged(CheckStateChangedEvent event) {
323 String id= ((ListItem)event.getElement()).id;
324 if (id == null)
325 return;
326 fStore.setValue(id, !event.getChecked());
327 }
314 fHyperlinkDetectorsViewer.addCheckStateListener(event -> {
315 String id= ((ListItem) event.getElement()).id;
316 if (id == null)
317 return;
318 fStore.setValue(id, !event.getChecked());
328319 });
329320
330321 fHyperlinkDetectorsViewer.setLabelProvider(new ItemLabelProvider());
379370 }
380371 });
381372
382 fHyperlinkKeyModifierText.addModifyListener(new ModifyListener() {
383 @Override
384 public void modifyText(ModifyEvent e) {
385 handleHyperlinkKeyModifierModified();
386 }
387 });
373 fHyperlinkKeyModifierText.addModifyListener(e -> handleHyperlinkKeyModifierModified());
388374
389375 return composite;
390376 }
434420 textControl.setLayoutData(gd);
435421 textControl.setTextLimit(textLimit);
436422
437 textControl.addModifyListener(new ModifyListener() {
438 @Override
439 public void modifyText(ModifyEvent e) {
440 String value= textControl.getText();
441 if (key != null)
442 fStore.setValue(key, value);
443 }
423 textControl.addModifyListener(e -> {
424 String value= textControl.getText();
425 if (key != null)
426 fStore.setValue(key, value);
444427 });
445428
446429 return new Control[] {labelControl, textControl};
524507 listModelItems.add(new ListItem(desc.getId(), desc.getName(), target.getName(), modifierKeys));
525508 }
526509
527 Comparator<ListItem> comparator= new Comparator<ListItem>() {
528 @Override
529 public int compare(ListItem o1, ListItem o2) {
530 String label1= o1.name;
531 String label2= o2.name;
532 return Collator.getInstance().compare(label1, label2);
533
534 }
510 Comparator<ListItem> comparator= (o1, o2) -> {
511 String label1= o1.name;
512 String label2= o2.name;
513 return Collator.getInstance().compare(label1, label2);
514
535515 };
536516 Collections.sort(listModelItems, comparator);
537517
00 /*******************************************************************************
11 * Copyright (c) 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
4144 import org.eclipse.jface.resource.JFaceResources;
4245 import org.eclipse.jface.viewers.ArrayContentProvider;
4346 import org.eclipse.jface.viewers.ComboViewer;
44 import org.eclipse.jface.viewers.ISelectionChangedListener;
4547 import org.eclipse.jface.viewers.IStructuredContentProvider;
4648 import org.eclipse.jface.viewers.LabelProvider;
47 import org.eclipse.jface.viewers.SelectionChangedEvent;
4849 import org.eclipse.jface.viewers.StructuredSelection;
4950 import org.eclipse.jface.viewers.StructuredViewer;
5051 import org.eclipse.jface.viewers.TableViewer;
294295
295296 createDependency(fShowInTextCheckBox, new Control[] {label, foregroundColorButton});
296297
297 fAnnotationTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
298 @Override
299 public void selectionChanged(SelectionChangedEvent event) {
300 handleAnnotationListSelection();
301 }
302 });
298 fAnnotationTypeViewer.addSelectionChangedListener(event -> handleAnnotationListSelection());
303299
304300 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
305301 @Override
341337 }
342338 });
343339
344 fDecorationViewer.addSelectionChangedListener(new ISelectionChangedListener() {
345
346 @Override
347 public void selectionChanged(SelectionChangedEvent event) {
348 String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
349 ListItem item= getSelectedItem();
350
351 if (fShowInTextCheckBox.getSelection()) {
352 if (HIGHLIGHT.equals(decoration)) {
353 getPreferenceStore().setValue(item.highlightKey, true);
354 getPreferenceStore().setValue(item.textKey, false);
355 getPreferenceStore().setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
356 } else {
357 getPreferenceStore().setValue(item.highlightKey, false);
358 getPreferenceStore().setValue(item.textKey, true);
359 getPreferenceStore().setValue(item.textStyleKey, decoration[1]);
360 }
340 fDecorationViewer.addSelectionChangedListener(event -> {
341 String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement();
342 ListItem item= getSelectedItem();
343
344 if (fShowInTextCheckBox.getSelection()) {
345 if (HIGHLIGHT.equals(decoration)) {
346 getPreferenceStore().setValue(item.highlightKey, true);
347 getPreferenceStore().setValue(item.textKey, false);
348 getPreferenceStore().setValue(item.textStyleKey, AnnotationPreference.STYLE_NONE);
349 } else {
350 getPreferenceStore().setValue(item.highlightKey, false);
351 getPreferenceStore().setValue(item.textKey, true);
352 getPreferenceStore().setValue(item.textStyleKey, decoration[1]);
361353 }
362354 }
363355 });
443435 initializeFields();
444436
445437 fAnnotationTypeViewer.setInput(fListModel);
446 fAnnotationTypeViewer.getControl().getDisplay().asyncExec(new Runnable() {
447 @Override
448 public void run() {
449 if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
450 fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
451 initializeFields();
452 }
438 fAnnotationTypeViewer.getControl().getDisplay().asyncExec(() -> {
439 if (fAnnotationTypeViewer != null && !fAnnotationTypeViewer.getControl().isDisposed()) {
440 fAnnotationTypeViewer.setSelection(new StructuredSelection(fListModel[0]));
441 initializeFields();
453442 }
454443 });
455444 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
400403 String label= fQuickDiffProviderListModel[i][1];
401404 fQuickDiffProviderCombo.add(label);
402405 }
403 fQuickDiffProviderCombo.getDisplay().asyncExec(new Runnable() {
404 @Override
405 public void run() {
406 updateProviderList();
407 }
408 });
406 fQuickDiffProviderCombo.getDisplay().asyncExec(() -> updateProviderList());
409407
410408 initializeFields();
411409 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
166169 public void checkStateChanged(final CheckStateChangedEvent event) {
167170
168171 //Potentially long operation - show a busy cursor
169 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
170 @Override
171 public void run() {
172 if (event.getCheckable().equals(treeViewer))
173 treeItemChecked(event.getElement(), event.getChecked());
174 else
175 listItemChecked(event.getElement(), event.getChecked(), true);
176
177 notifyCheckStateChangeListeners(event);
178 }
172 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
173 if (event.getCheckable().equals(treeViewer))
174 treeItemChecked(event.getElement(), event.getChecked());
175 else
176 listItemChecked(event.getElement(), event.getChecked(), true);
177
178 notifyCheckStateChangeListeners(event);
179179 });
180180 }
181181
291291 * @param element the element to be expanded
292292 */
293293 private void expandTreeElement(final Object element) {
294 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
295 @Override
296 public void run() {
297
298 // First see if the children need to be given their checked
299 // state at all. If they've
300 // already been realized then this won't be necessary
301 if (expandedTreeNodes.contains(element))
302 checkNewTreeElements(treeContentProvider.getChildren(element));
303 else {
304
305 expandedTreeNodes.add(element);
306 if (whiteCheckedTreeItems.contains(element)) {
307 //If this is the first expansion and this is a white
308 // checked node then check the children
309 Object[] children= treeContentProvider.getChildren(element);
310 for (int i= 0; i < children.length; ++i) {
311 if (!whiteCheckedTreeItems.contains(children[i])) {
312 Object child= children[i];
313 setWhiteChecked(child, true);
314 treeViewer.setChecked(child, true);
315 checkedStateStore.put(child, new ArrayList<>());
316 }
294 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
295
296 // First see if the children need to be given their checked
297 // state at all. If they've
298 // already been realized then this won't be necessary
299 if (expandedTreeNodes.contains(element))
300 checkNewTreeElements(treeContentProvider.getChildren(element));
301 else {
302
303 expandedTreeNodes.add(element);
304 if (whiteCheckedTreeItems.contains(element)) {
305 //If this is the first expansion and this is a white
306 // checked node then check the children
307 Object[] children= treeContentProvider.getChildren(element);
308 for (int i= 0; i < children.length; ++i) {
309 if (!whiteCheckedTreeItems.contains(children[i])) {
310 Object child= children[i];
311 setWhiteChecked(child, true);
312 treeViewer.setChecked(child, true);
313 checkedStateStore.put(child, new ArrayList<>());
317314 }
318
319 //Now be sure to select the list of items too
320 setListForWhiteSelection(element);
321315 }
316
317 //Now be sure to select the list of items too
318 setListForWhiteSelection(element);
322319 }
323
324 }
320 }
321
325322 });
326323 }
327324
588585 if (!(expandedTreeNodes.contains(treeElement)) && whiteCheckedTreeItems.contains(treeElement)) {
589586
590587 //Potentially long operation - show a busy cursor
591 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
592 @Override
593 public void run() {
594 setListForWhiteSelection(treeElement);
595 listViewer.setAllChecked(true);
596 }
588 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
589 setListForWhiteSelection(treeElement);
590 listViewer.setAllChecked(true);
597591 });
598592
599593 } else {
679673 return;
680674
681675 //Potentially long operation - show a busy cursor
682 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
683 @Override
684 public void run() {
685 setTreeChecked(root, selection);
686 listViewer.setAllChecked(selection);
687 }
676 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
677 setTreeChecked(root, selection);
678 listViewer.setAllChecked(selection);
688679 });
689680 }
690681
691682 public void refresh() {
692683 //Potentially long operation - show a busy cursor
693 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
694 @Override
695 public void run() {
696 treeViewer.refresh();
697 populateListViewer(currentTreeSelection);
698 }
684 BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> {
685 treeViewer.refresh();
686 populateListViewer(currentTreeSelection);
699687 });
700688 }
701689
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
4043 import org.eclipse.jface.dialogs.Dialog;
4144 import org.eclipse.jface.dialogs.IDialogConstants;
4245 import org.eclipse.jface.layout.GridLayoutFactory;
43 import org.eclipse.jface.viewers.CheckStateChangedEvent;
44 import org.eclipse.jface.viewers.ICheckStateListener;
4546 import org.eclipse.jface.viewers.ITreeContentProvider;
4647
4748 import org.eclipse.ui.dialogs.TypeFilteringDialog;
111112 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
112113
113114 fResourceGroup= new SelectResourcesBlock(composite, ResourcesPlugin.getWorkspace().getRoot(), getResourceProvider(IResource.FOLDER | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), SWT.NONE, useHeightHint(parent));
114 fResourceGroup.addCheckStateListener(new ICheckStateListener() {
115 @Override
116 public void checkStateChanged(CheckStateChangedEvent event) {
117 updateSelectionCount();
118 }
119 });
115 fResourceGroup.addCheckStateListener(event -> updateSelectionCount());
120116
121117 fCountIndication= new Label(composite, SWT.LEFT);
122118 fCountIndication.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
244240
245241 private void filterSelection() {
246242
247 final IFilter filter= new IFilter() {
248 @Override
249 public boolean accept(IResource resource) {
250 return hasAcceptedFileType(resource);
251 }
252 };
243 final IFilter filter= resource -> hasAcceptedFileType(resource);
253244
254245 List<Object> list= fResourceGroup.getAllWhiteCheckedItems();
255246 final IResource[] resources= list.toArray(new IResource[list.size()]);
256247
257 Runnable runnable = new Runnable() {
258 @Override
259 public void run() {
260 setSelection(resources, filter);
261 }
262 };
248 Runnable runnable= () -> setSelection(resources, filter);
263249
264250 BusyIndicator.showWhile(getShell().getDisplay(), runnable);
265251 }
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
4750 if (colorTable == null) {
4851 colorTable= new HashMap<>(10);
4952 fDisplayTable.put(display, colorTable);
50 display.disposeExec(new Runnable() {
51 @Override
52 public void run() {
53 dispose(display);
54 }
55 });
53 display.disposeExec(() -> dispose(display));
5654 }
5755
5856 Color color= colorTable.get(rgb);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1821 import java.util.Set;
1922
2023 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.events.ModifyEvent;
22 import org.eclipse.swt.events.ModifyListener;
2324 import org.eclipse.swt.events.SelectionAdapter;
2425 import org.eclipse.swt.events.SelectionEvent;
2526 import org.eclipse.swt.events.SelectionListener;
619620 textControl.setToolTipText(preference.getDescription());
620621
621622 if (domain != null) {
622 textControl.addModifyListener(new ModifyListener() {
623 @Override
624 public void modifyText(ModifyEvent e) {
625 String value= textControl.getText();
626 IStatus status= domain.validate(value);
627 if (!status.matches(IStatus.ERROR)) {
628 fDialogOverlayStore.setValue(preference.getKey(), value);
629 setErrorMessage(null);
630 }
631 else {
632 setErrorMessage(NLSUtility.format(TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogInvalidInput, value));
633 }
623 textControl.addModifyListener(e -> {
624 String value= textControl.getText();
625 IStatus status= domain.validate(value);
626 if (!status.matches(IStatus.ERROR)) {
627 fDialogOverlayStore.setValue(preference.getKey(), value);
628 setErrorMessage(null);
629 } else {
630 setErrorMessage(NLSUtility.format(TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogInvalidInput, value));
634631 }
635632 });
636633 }
10431040
10441041 for (int i= 0; i < fAppearanceColorListModel.length; i++)
10451042 fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
1046 fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
1047 @Override
1048 public void run() {
1049 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1050 fAppearanceColorList.select(0);
1051 handleAppearanceColorListSelection();
1052 }
1043 fAppearanceColorList.getDisplay().asyncExec(() -> {
1044 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1045 fAppearanceColorList.select(0);
1046 handleAppearanceColorListSelection();
10531047 }
10541048 });
10551049 }
13001294 textControl.setToolTipText(preference.getDescription());
13011295
13021296 if (domain != null) {
1303 textControl.addModifyListener(new ModifyListener() {
1304 @Override
1305 public void modifyText(ModifyEvent e) {
1306 String value= textControl.getText();
1307 IStatus status= domain.validate(value);
1308 if (!status.matches(IStatus.ERROR))
1309 fOverlayStore.setValue(preference.getKey(), value);
1310 updateStatus(domain);
1311 }
1297 textControl.addModifyListener(e -> {
1298 String value= textControl.getText();
1299 IStatus status= domain.validate(value);
1300 if (!status.matches(IStatus.ERROR))
1301 fOverlayStore.setValue(preference.getKey(), value);
1302 updateStatus(domain);
13121303 });
13131304 }
13141305
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2018 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2006 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
473476 public Point computeSizeConstraints(int widthInChars, int heightInChars) {
474477 GC gc= new GC(fText);
475478 gc.setFont(fTextFont);
476 int width= gc.getFontMetrics().getAverageCharWidth();
479 double width= gc.getFontMetrics().getAverageCharacterWidth();
477480 int height= fText.getLineHeight();
478481 gc.dispose();
479482
480 return new Point (widthInChars * width, heightInChars * height);
483 return new Point((int) (widthInChars * width), heightInChars * height);
481484 }
482485 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2010 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
9497 protected static Map<ImageDescriptor, Image> getImageRegistry(Display display) {
9598 if (fgImageRegistry == null) {
9699 fgImageRegistry= new HashMap<>();
97 display.disposeExec(new Runnable() {
98 @Override
99 public void run() {
100 if (fgImageRegistry != null) {
101 Map<ImageDescriptor, Image> map= fgImageRegistry;
102 fgImageRegistry= null;
103 Iterator<Image> e= map.values().iterator();
104 while (e.hasNext()) {
105 Image image= e.next();
106 if (!image.isDisposed())
107 image.dispose();
108 }
100 display.disposeExec(() -> {
101 if (fgImageRegistry != null) {
102 Map<ImageDescriptor, Image> map= fgImageRegistry;
103 fgImageRegistry= null;
104 Iterator<Image> e= map.values().iterator();
105 while (e.hasNext()) {
106 Image image= e.next();
107 if (!image.isDisposed())
108 image.dispose();
109109 }
110110 }
111111 });
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2014 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Plugin.name
33 Bundle-SymbolicName: org.eclipse.ui.editors.tests;singleton:=true
4 Bundle-Version: 3.11.100.qualifier
4 Bundle-Version: 3.11.200.qualifier
55 Bundle-Vendor: %Plugin.providerName
66 Bundle-Localization: plugin
77 Export-Package: org.eclipse.ui.editors.tests
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.ui</groupId>
2020 <artifactId>org.eclipse.ui.editors.tests</artifactId>
21 <version>3.11.100-SNAPSHOT</version>
21 <version>3.11.200-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2016 Andrey Loskutov.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrey Loskutov <loskutov@gmx.de> - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2014, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Vasili Gulevich and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Vasili Gulevich <vasili.gulevich@xored.com> - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2016 Google, Inc and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Stefan Xenos (Google) - Initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2009 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.ui.examples.javaeditor; singleton:=true
4 Bundle-Version: 3.2.200.qualifier
4 Bundle-Version: 3.2.300.qualifier
55 Bundle-Activator: org.eclipse.ui.examples.javaeditor.JavaEditorExamplePlugin
66 Bundle-Vendor: %providerName
77 Bundle-Localization: plugin
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.ui</groupId>
1919 <artifactId>org.eclipse.ui.examples.javaeditor</artifactId>
20 <version>3.2.200-SNAPSHOT</version>
20 <version>3.2.300-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
+0
-17
org.eclipse.ui.genericeditor/.settings/.api_filters less more
0 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1 <component id="org.eclipse.ui.genericeditor" version="2">
2 <resource path="META-INF/MANIFEST.MF">
3 <filter comment="Minor version was wrongly increased" id="926941240">
4 <message_arguments>
5 <message_argument value="1.1.0"/>
6 <message_argument value="1.0.1"/>
7 </message_arguments>
8 </filter>
9 <filter id="926941240">
10 <message_arguments>
11 <message_argument value="1.1.0"/>
12 <message_argument value="1.0.2"/>
13 </message_arguments>
14 </filter>
15 </resource>
16 </component>
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Bundle-Name
33 Bundle-SymbolicName: org.eclipse.ui.genericeditor;singleton:=true
4 Bundle-Version: 1.1.0.qualifier
4 Bundle-Version: 1.1.100.qualifier
55 Bundle-Vendor: %Bundle-Vendor
66 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
77 Require-Bundle: org.eclipse.ui.workbench.texteditor;bundle-version="3.10.0",
1616 org.eclipse.core.expressions;bundle-version="3.6.0"
1717 Export-Package: org.eclipse.ui.internal.genericeditor;x-internal:=true,
1818 org.eclipse.ui.internal.genericeditor.hover;x-internal:=true,
19 org.eclipse.ui.internal.genericeditor.markers;x-internal:=true
19 org.eclipse.ui.internal.genericeditor.markers;x-internal:=true,
20 org.eclipse.ui.internal.genericeditor.preferences;x-internal:=true
2021 Bundle-Activator: org.eclipse.ui.internal.genericeditor.GenericEditorPlugin
2122 Bundle-Localization: plugin
2223 Bundle-ActivationPolicy: lazy
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2016 Red Hat Inc. and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # Red Hat Inc. - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2016, 2017 Red Hat Inc. and others
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # Sopot Cela & Mickael Istria (Red Hat Inc.) - initial implementation
1720 ExtPoint.contentAssistProcessors=Content Assist Providers
1821 ExtPoint.autoEditStrategies=Auto Edit Strategies
1922 ExtPoint.highlightReconcilers=Highlight Reconcilers
23 ExtPoint.foldingReconcilers=Folding Reconcilers
24 ExtPoint.characterPairMatchers=Character Pair Matcher Providers
2025 ExtPoint.hyperlinkDetectorTarget=Generic Text Editor
2126 openDeclarationCommand_name=Open Declaration
2227 context_name=in Generic Code Editor
2631 Bundle-Vendor=Eclipse.org
2732 Bundle-Name=Generic and Extensible Text Editor
2833 command.toggle.highlight.label = Toggle Mark Occurences
29 command.toggle.highlight.name = Toggle Highlight
34 command.toggle.highlight.name = Toggle Highlight
35 menu.source.label = Source
00 <?xml version="1.0" encoding="UTF-8"?>
11 <?eclipse version="3.4"?>
2 <!-- ====================================================================== -->
3 <!-- Copyright (c) 2016, 2017 Red Hat Inc. and others. -->
4 <!-- All rights reserved. This program and the accompanying materials -->
5 <!-- are made available under the terms of the Eclipse Public License v1.0 -->
6 <!-- which accompanies this distribution, and is available at -->
7 <!-- http://www.eclipse.org/legal/epl-v10.html -->
8 <!-- -->
9 <!-- Contributors: -->
10 <!-- Sopot Cela & Mickael Istria (Red Hat Inc). -initial implementation -->
11 <!-- Lucas Bullen (Red Hat Inc.) - Bug 508829 custom reconciler support -->
12 <!-- - Bug 521382 default highlighter -->
13 <!-- Simon Scholz <simon.scholz@vogella.com> - Bug 527830 -->
14 <!-- ====================================================================== -->
2 <!--
3 Copyright (c) 2016, 2017 Red Hat Inc. and others.
4
5 This program and the accompanying materials
6 are made available under the terms of the Eclipse Public License 2.0
7 which accompanies this distribution, and is available at
8 https://www.eclipse.org/legal/epl-2.0/
9
10 SPDX-License-Identifier: EPL-2.0
11
12 Contributors:
13 Sopot Cela & Mickael Istria (Red Hat Inc). -initial implementation
14 Lucas Bullen (Red Hat Inc.) - Bug 508829, 521382
15 Simon Scholz <simon.scholz@vogella.com> - Bug 527830
16 -->
1517 <plugin>
1618 <extension-point id="reconcilers" name="%ExtPoint.reconciliers" schema="schema/reconcilers.exsd"/>
1719 <extension-point id="presentationReconcilers" name="%ExtPoint.presentationReconciliers" schema="schema/presentationReconcilers.exsd"/>
1921 <extension-point id="hoverProviders" name="%ExtPoint.hoverProviders" schema="schema/hoverProviders.exsd"/>
2022 <extension-point id="autoEditStrategies" name="%ExtPoint.autoEditStrategies" schema="schema/autoEditStrategies.exsd"/>
2123 <extension-point id="highlightReconcilers" name="%ExtPoint.highlightReconcilers" schema="schema/highlightReconcilers.exsd"/>
24 <extension-point id="foldingReconcilers" name="%ExtPoint.foldingReconcilers" schema="schema/foldingReconcilers.exsd"/>
25 <extension-point id="characterPairMatchers" name="%ExtPoint.characterPairMatchers" schema="schema/characterPairMatchers.exsd"/>
2226 <extension
2327 point="org.eclipse.ui.editors">
2428 <editor
7882 <menuContribution
7983 allPopups="true"
8084 locationURI="popup:#TextEditorContext?after=additions">
85 <menu
86 id="org.eclipse.ui.genericeditor.source.menu"
87 label="%menu.source.label">
88 <command
89 commandId="org.eclipse.ui.edit.text.delete.line"
90 style="push">
91 </command>
92 <command
93 commandId="org.eclipse.ui.edit.text.copyLineDown"
94 style="push">
95 </command>
96 </menu>
8197 <command
8298 commandId="org.eclipse.ui.genericeditor.findReferences"
8399 style="push">
189205 </with>
190206 </definition>
191207 </extension>
208 <extension point="org.eclipse.core.runtime.preferences">
209 <initializer class="org.eclipse.ui.internal.genericeditor.preferences.GenericEditorPluginPreferenceInitializer"/>
210 </extension>
192211 </plugin>
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.ui</groupId>
1919 <artifactId>org.eclipse.ui.genericeditor</artifactId>
20 <version>1.1.0-SNAPSHOT</version>
20 <version>1.1.100-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
1316 'TextOccurrenceIndicationColor=27, 98, 145'
1417 }
1518
19 IEclipsePreferences#org-eclipse-ui-genericeditor:org-eclipse-ui-genericeditor {
20 preferences:
21 'matchingBracketsColor=249,250,244'
22 }
23
146146 </appinfo>
147147 <documentation>
148148 Copyright (c) 2017 Rogue Wave Software Inc. and others
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
0 <?xml version='1.0' encoding='UTF-8'?>
1 <!-- Schema file written by PDE -->
2 <schema targetNamespace="org.eclipse.ui.genericeditor" xmlns="http://www.w3.org/2001/XMLSchema">
3 <annotation>
4 <appinfo>
5 <meta.schema plugin="org.eclipse.ui.genericeditor" id="characterPairMatchers" name="Character pair matchers"/>
6 </appinfo>
7 <documentation>
8 This extension point is used to contribute character pair matchers for controlling the matching brackets on a file with a given content type.
9 </documentation>
10 </annotation>
11
12 <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
13
14 <element name="extension">
15 <annotation>
16 <appinfo>
17 <meta.element />
18 </appinfo>
19 </annotation>
20 <complexType>
21 <sequence minOccurs="1" maxOccurs="unbounded">
22 <element ref="characterPairMatcher"/>
23 </sequence>
24 <attribute name="point" type="string" use="required">
25 <annotation>
26 <documentation>
27 a fully qualified identifier of the target extension point
28 </documentation>
29 </annotation>
30 </attribute>
31 <attribute name="id" type="string">
32 <annotation>
33 <documentation>
34 an optional identifier of the extension instance
35 </documentation>
36 </annotation>
37 </attribute>
38 <attribute name="name" type="string">
39 <annotation>
40 <documentation>
41 an optional name of the extension instance
42 </documentation>
43 <appinfo>
44 <meta.attribute translatable="true"/>
45 </appinfo>
46 </annotation>
47 </attribute>
48 </complexType>
49 </element>
50
51 <element name="characterPairMatcher">
52 <complexType>
53 <sequence>
54 <element ref="enabledWhen" minOccurs="0" maxOccurs="1"/>
55 </sequence>
56 <attribute name="class" type="string" use="required">
57 <annotation>
58 <documentation>
59 The fully qualified class name implementing the interface &lt;code&gt;org.eclipse.jface.text.source.ICharacterPairMatcher&lt;/code&gt;
60 </documentation>
61 <appinfo>
62 <meta.attribute kind="java" basedOn=":org.eclipse.jface.text.source.ICharacterPairMatcher"/>
63 </appinfo>
64 </annotation>
65 </attribute>
66 <attribute name="contentType" type="string" use="required">
67 <annotation>
68 <documentation>
69 The target content-type for this extension. Content-types are defined as extension to the org.eclipse.core.contenttype.contentTypes extension point.
70 </documentation>
71 <appinfo>
72 <meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
73 </appinfo>
74 </annotation>
75 </attribute>
76 </complexType>
77 </element>
78
79 <element name="enabledWhen">
80 <annotation>
81 <documentation>
82 A core Expression that controls the enabled of the given character pair matcher. The viewer, editor, and editor input are registered in the evaluation context as variable:
83
84 * &lt;with variable=&quot;viewer&quot;/&gt; : use it if your expression requires the viewer.
85 * &lt;with variable=&quot;editor&quot;/&gt; : use it if your expression requires the editor.
86 * &lt;with variable=&quot;editorInput&quot;/&gt; : use it if your expression requires the editor input.
87 </documentation>
88 </annotation>
89 <complexType>
90 <choice minOccurs="0" maxOccurs="1">
91 <element ref="not"/>
92 <element ref="or"/>
93 <element ref="and"/>
94 <element ref="instanceof"/>
95 <element ref="test"/>
96 <element ref="systemTest"/>
97 <element ref="equals"/>
98 <element ref="count"/>
99 <element ref="with"/>
100 <element ref="resolve"/>
101 <element ref="adapt"/>
102 <element ref="iterate"/>
103 <element ref="reference"/>
104 </choice>
105 </complexType>
106 </element>
107
108 <annotation>
109 <appinfo>
110 <meta.section type="since"/>
111 </appinfo>
112 <documentation>
113 1.2
114 </documentation>
115 </annotation>
116
117 <annotation>
118 <appinfo>
119 <meta.section type="examples"/>
120 </appinfo>
121 <documentation>
122 Below is an example of how to use the character pair matchers extension point:
123
124 &lt;pre&gt;
125 &lt;extension point=&quot;org.eclipse.ui.genericeditor.characterPairMatchers&quot;&gt;
126 &lt;characterPairMatcher
127 class=&quot;org.eclipse.ui.genericeditor.examples.TargetDefinitionCharacterPairMatchers&quot;
128 contentType=&quot;org.eclipse.pde.targetFile&quot;&gt;
129 &lt;enabledWhen&gt;
130 &lt;with variable=&quot;editor&quot;&gt;
131 &lt;test property=&quot;org.eclipse.ui.genericeditor.examples.TargetDefinitionPropertyTester&quot;&gt;
132 &lt;/test&gt;
133 &lt;/with&gt;
134 &lt;/enabledWhen&gt;
135 &lt;/characterPairMatcher&gt;
136 &lt;/extension&gt;
137 &lt;/pre&gt;
138 </documentation>
139 </annotation>
140
141
142
143 <annotation>
144 <appinfo>
145 <meta.section type="copyright"/>
146 </appinfo>
147 <documentation>
148 Copyright (c) 2018 Angelo ZERR and others
149 All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v20.html&quot;&gt;http://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;
150 </documentation>
151 </annotation>
152
153 </schema>
146146 </appinfo>
147147 <documentation>
148148 Copyright (c) 2016 Red Hat Inc. and others
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
0 <?xml version='1.0' encoding='UTF-8'?>
1 <!-- Schema file written by PDE -->
2 <schema targetNamespace="org.eclipse.ui.genericeditor" xmlns="http://www.w3.org/2001/XMLSchema">
3 <annotation>
4 <appinfo>
5 <meta.schema plugin="org.eclipse.ui.genericeditor" id="foldingReconcilers" name="Folding reconcilers"/>
6 </appinfo>
7 <documentation>
8 This extension point is used to contribute folding reconcilers for controlling the folding on a file with a given content type.
9 </documentation>
10 </annotation>
11
12 <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
13
14 <element name="extension">
15 <annotation>
16 <appinfo>
17 <meta.element />
18 </appinfo>
19 </annotation>
20 <complexType>
21 <sequence minOccurs="1" maxOccurs="unbounded">
22 <element ref="foldingReconciler"/>
23 </sequence>
24 <attribute name="point" type="string" use="required">
25 <annotation>
26 <documentation>
27 a fully qualified identifier of the target extension point
28 </documentation>
29 </annotation>
30 </attribute>
31 <attribute name="id" type="string">
32 <annotation>
33 <documentation>
34 an optional identifier of the extension instance
35 </documentation>
36 </annotation>
37 </attribute>
38 <attribute name="name" type="string">
39 <annotation>
40 <documentation>
41 an optional name of the extension instance
42 </documentation>
43 <appinfo>
44 <meta.attribute translatable="true"/>
45 </appinfo>
46 </annotation>
47 </attribute>
48 </complexType>
49 </element>
50
51 <element name="foldingReconciler">
52 <complexType>
53 <sequence>
54 <element ref="enabledWhen" minOccurs="0" maxOccurs="1"/>
55 </sequence>
56 <attribute name="class" type="string" use="required">
57 <annotation>
58 <documentation>
59 The fully qualified class name implementing the interface &lt;code&gt;org.eclipse.jface.text.reconciler.IReconciler&lt;/code&gt;
60 To manipulate folding, the implementation reconciler needs to use ProjectionAnnotation and viewer.getProjectionModel(). You can find a sample in
61 org.eclipse.ui.internal.genericeditor.folding.DefaultFoldingReconciler.
62 </documentation>
63 <appinfo>
64 <meta.attribute kind="java" basedOn=":org.eclipse.jface.text.reconciler.IReconciler"/>
65 </appinfo>
66 </annotation>
67 </attribute>
68 <attribute name="contentType" type="string" use="required">
69 <annotation>
70 <documentation>
71 The target content-type for this extension. Content-types are defined as extension to the org.eclipse.core.contenttype.contentTypes extension point.
72 </documentation>
73 <appinfo>
74 <meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
75 </appinfo>
76 </annotation>
77 </attribute>
78 </complexType>
79 </element>
80
81 <element name="enabledWhen">
82 <annotation>
83 <documentation>
84 A core Expression that controls the enabled of the given folding reconciler. The viewer, editor, and editor input are registered in the evaluation context as variable:
85
86 * &lt;with variable=&quot;viewer&quot;/&gt; : use it if your expression requires the viewer.
87 * &lt;with variable=&quot;editor&quot;/&gt; : use it if your expression requires the editor.
88 * &lt;with variable=&quot;editorInput&quot;/&gt; : use it if your expression requires the editor input.
89 </documentation>
90 </annotation>
91 <complexType>
92 <choice minOccurs="0" maxOccurs="1">
93 <element ref="not"/>
94 <element ref="or"/>
95 <element ref="and"/>
96 <element ref="instanceof"/>
97 <element ref="test"/>
98 <element ref="systemTest"/>
99 <element ref="equals"/>
100 <element ref="count"/>
101 <element ref="with"/>
102 <element ref="resolve"/>
103 <element ref="adapt"/>
104 <element ref="iterate"/>
105 <element ref="reference"/>
106 </choice>
107 </complexType>
108 </element>
109
110 <annotation>
111 <appinfo>
112 <meta.section type="since"/>
113 </appinfo>
114 <documentation>
115 1.1
116 </documentation>
117 </annotation>
118
119 <annotation>
120 <appinfo>
121 <meta.section type="examples"/>
122 </appinfo>
123 <documentation>
124 Below is an example of how to use the Folding Reconciler extension point:
125 &lt;pre&gt;
126 &lt;extension point=&quot;org.eclipse.ui.genericeditor.foldingReconcilers&quot;&gt;
127 &lt;foldingReconciler
128 class=&quot;org.eclipse.ui.genericeditor.examples.TargetDefinitionFoldingReconciler&quot;
129 contentType=&quot;org.eclipse.pde.targetFile&quot;&gt;
130 &lt;enabledWhen&gt;
131 &lt;with variable=&quot;editor&quot;&gt;
132 &lt;test property=&quot;org.eclipse.ui.genericeditor.examples.TargetDefinitionPropertyTester&quot;&gt;
133 &lt;/test&gt;
134 &lt;/with&gt;
135 &lt;/enabledWhen&gt;
136 &lt;/foldingReconciler&gt;
137 &lt;/extension&gt;
138 &lt;/pre&gt;
139 </documentation>
140 </annotation>
141
142
143
144 <annotation>
145 <appinfo>
146 <meta.section type="copyright"/>
147 </appinfo>
148 <documentation>
149 Copyright (c) 2017 Red Hat Inc. and others
150
151 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
152
153 SPDX-License-Identifier: EPL-2.0
154 </documentation>
155 </annotation>
156
157 </schema>
146146 </appinfo>
147147 <documentation>
148148 Copyright (c) 2017 Red Hat Inc. and others
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
175175 </appinfo>
176176 <documentation>
177177 Copyright (c) 2016 Red Hat Inc. and others
178 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
178
179 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
180
181 SPDX-License-Identifier: EPL-2.0
179182 </documentation>
180183 </annotation>
181184
146146 </appinfo>
147147 <documentation>
148148 Copyright (c) 2016 Red Hat Inc. and others
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
146146 </appinfo>
147147 <documentation>
148148 Copyright (c) 2017 Red Hat Inc. and others
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Rogue Wave Software Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Michał Niewrzał (Rogue Wave Software Inc.) - initial implementation
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v2.0
4 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v20.html
6 *
7 * Contributors:
8 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 538111 - [generic editor] Extension point for ICharacterPairMatcher
9 */
10 package org.eclipse.ui.internal.genericeditor;
11
12 import java.util.HashMap;
13 import java.util.HashSet;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.Set;
17 import java.util.stream.Collectors;
18
19 import org.eclipse.core.runtime.IConfigurationElement;
20 import org.eclipse.core.runtime.IRegistryChangeEvent;
21 import org.eclipse.core.runtime.IRegistryChangeListener;
22 import org.eclipse.core.runtime.IStatus;
23 import org.eclipse.core.runtime.Platform;
24 import org.eclipse.core.runtime.Status;
25 import org.eclipse.core.runtime.content.IContentType;
26 import org.eclipse.jface.text.source.ICharacterPairMatcher;
27 import org.eclipse.jface.text.source.ISourceViewer;
28 import org.eclipse.ui.texteditor.ITextEditor;
29
30 /**
31 * A registry of character pair matchers provided by extension
32 * <code>org.eclipse.ui.genericeditor.characterPairMatchers</code>. Those
33 * extensions are specific to a given {@link IContentType}.
34 *
35 * @since 1.2
36 */
37 public class CharacterPairMatcherRegistry {
38
39 private static final String EXTENSION_POINT_ID = GenericEditorPlugin.BUNDLE_ID + ".characterPairMatchers"; //$NON-NLS-1$
40
41 private Map<IConfigurationElement, GenericContentTypeRelatedExtension<ICharacterPairMatcher>> extensions = new HashMap<>();
42 private boolean outOfSync = true;
43
44 /**
45 * Creates the registry and binds it to the extension point.
46 */
47 public CharacterPairMatcherRegistry() {
48 Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() {
49 @Override
50 public void registryChanged(IRegistryChangeEvent event) {
51 outOfSync = true;
52 }
53 }, EXTENSION_POINT_ID);
54 }
55
56 /**
57 * Get the contributed {@link IPresentationReconciliers}s that are relevant to
58 * hook on source viewer according to document content types.
59 *
60 * @param sourceViewer the source viewer we're hooking completion to.
61 * @param editor the text editor
62 * @param contentTypes the content types of the document we're editing.
63 * @return the list of {@link ICharacterPairMatcher} contributed for at least
64 * one of the content types.
65 */
66 public List<ICharacterPairMatcher> getCharacterPairMatchers(ISourceViewer sourceViewer, ITextEditor editor,
67 Set<IContentType> contentTypes) {
68 if (this.outOfSync) {
69 sync();
70 }
71 return this.extensions.values().stream().filter(ext -> contentTypes.contains(ext.targetContentType))
72 .filter(ext -> ext.matches(sourceViewer, editor))
73 .sorted(new ContentTypeSpecializationComparator<ICharacterPairMatcher>())
74 .map(GenericContentTypeRelatedExtension<ICharacterPairMatcher>::createDelegate)
75 .collect(Collectors.toList());
76 }
77
78 private void sync() {
79 Set<IConfigurationElement> toRemoveExtensions = new HashSet<>(this.extensions.keySet());
80 for (IConfigurationElement extension : Platform.getExtensionRegistry()
81 .getConfigurationElementsFor(EXTENSION_POINT_ID)) {
82 toRemoveExtensions.remove(extension);
83 if (!this.extensions.containsKey(extension)) {
84 try {
85 this.extensions.put(extension,
86 new GenericContentTypeRelatedExtension<ICharacterPairMatcher>(extension));
87 } catch (Exception ex) {
88 GenericEditorPlugin.getDefault().getLog()
89 .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
90 }
91 }
92 }
93 for (IConfigurationElement toRemove : toRemoveExtensions) {
94 this.extensions.remove(toRemove);
95 }
96 this.outOfSync = false;
97 }
98
99 }
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
5760 public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
5861 List<IContextInformation> res = new ArrayList<>();
5962 for (IContentAssistProcessor processor : this.fContentAssistProcessors) {
60 res.addAll(Arrays.asList(processor.computeContextInformation(viewer, offset)));
63 IContextInformation[] contextInformation = processor.computeContextInformation(viewer, offset);
64 if (contextInformation != null) {
65 res.addAll(Arrays.asList(contextInformation));
66 }
6167 }
6268 return res.toArray(new IContextInformation[res.size()]);
6369 }
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017, 2018 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
2427 import org.eclipse.jface.text.IDocument;
2528 import org.eclipse.jface.text.IRegion;
2629 import org.eclipse.jface.text.ISynchronizable;
30 import org.eclipse.jface.text.ITextSelection;
2731 import org.eclipse.jface.text.ITextViewer;
2832 import org.eclipse.jface.text.ITextViewerExtension5;
2933 import org.eclipse.jface.text.Position;
3438 import org.eclipse.jface.text.source.IAnnotationModel;
3539 import org.eclipse.jface.text.source.IAnnotationModelExtension;
3640 import org.eclipse.jface.text.source.ISourceViewer;
41 import org.eclipse.jface.viewers.IPostSelectionProvider;
42 import org.eclipse.jface.viewers.ISelection;
43 import org.eclipse.jface.viewers.ISelectionChangedListener;
3744 import org.eclipse.osgi.util.NLS;
38 import org.eclipse.swt.custom.CaretEvent;
39 import org.eclipse.swt.custom.CaretListener;
4045
4146 /**
4247 *
5156 *
5257 */
5358 public class DefaultWordHighlightStrategy
54 implements IReconcilingStrategy, IReconcilingStrategyExtension, CaretListener, IPreferenceChangeListener {
59 implements IReconcilingStrategy, IReconcilingStrategyExtension, IPreferenceChangeListener {
5560
5661 private static final String ANNOTATION_TYPE = "org.eclipse.ui.genericeditor.text"; //$NON-NLS-1$
5762
6671
6772 private Annotation[] fOccurrenceAnnotations = null;
6873
69 private void applyHighlights(int offset) {
74 private ISelectionChangedListener editorSelectionChangedListener = event -> applyHighlights(event.getSelection());
75
76 private void applyHighlights(ISelection selection) {
77 if (!(selection instanceof ITextSelection)) {
78 return;
79 }
80 ITextSelection textSelection = (ITextSelection) selection;
7081 if (sourceViewer == null || !enabled) {
7182 removeOccurrenceAnnotations();
7283 return;
7384 }
7485
7586 String text = document.get();
76 offset = ((ITextViewerExtension5) sourceViewer).widgetOffset2ModelOffset(offset);
87 int offset = ((ITextViewerExtension5) sourceViewer).widgetOffset2ModelOffset(textSelection.getOffset());
7788
7889 String word = findCurrentWord(text, offset);
7990 if (word == null) {
142153 preferences.addPreferenceChangeListener(this);
143154 this.enabled = preferences.getBoolean(ToggleHighlight.TOGGLE_HIGHLIGHT_PREFERENCE, true);
144155 this.sourceViewer = (ISourceViewer) viewer;
145 this.sourceViewer.getTextWidget().addCaretListener(this);
156 ((IPostSelectionProvider) sourceViewer.getSelectionProvider())
157 .addPostSelectionChangedListener(editorSelectionChangedListener);
146158 }
147159
148160 public void uninstall() {
149161 if (sourceViewer != null) {
150 sourceViewer.getTextWidget().removeCaretListener(this);
162 ((IPostSelectionProvider) sourceViewer.getSelectionProvider())
163 .removePostSelectionChangedListener(editorSelectionChangedListener);
151164 }
152165 IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GenericEditorPlugin.BUNDLE_ID);
153166 preferences.removePreferenceChangeListener(this);
166179 }
167180
168181 @Override
169 public void caretMoved(CaretEvent event) {
170 applyHighlights(event.caretOffset);
171 }
172
173 @Override
174182 public void initialReconcile() {
175183 if (sourceViewer != null) {
176184 sourceViewer.getTextWidget().getDisplay().asyncExec(() -> {
177185 if (sourceViewer != null && sourceViewer.getTextWidget() != null) {
178 applyHighlights(sourceViewer.getTextWidget().getCaretOffset());
186 applyHighlights(sourceViewer.getSelectionProvider().getSelection());
179187 }
180188 });
181189 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela, Mickael Istria (Red Hat Inc.) - initial implementation
912 * Lucas Bullen (Red Hat Inc.) - Bug 508829 custom reconciler support
13 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 538111 - [generic editor] Extension point for ICharacterPairMatcher
1014 *******************************************************************************/
1115 package org.eclipse.ui.internal.genericeditor;
1216
17 import java.util.List;
18
1319 import org.eclipse.core.runtime.CoreException;
20 import org.eclipse.jface.preference.IPreferenceStore;
21 import org.eclipse.jface.text.source.ICharacterPairMatcher;
1422 import org.eclipse.jface.text.source.ISourceViewer;
1523 import org.eclipse.jface.text.source.IVerticalRuler;
1624 import org.eclipse.jface.text.source.projection.ProjectionSupport;
1725 import org.eclipse.jface.text.source.projection.ProjectionViewer;
1826 import org.eclipse.swt.widgets.Composite;
1927 import org.eclipse.ui.IEditorInput;
28 import org.eclipse.ui.editors.text.EditorsUI;
2029 import org.eclipse.ui.editors.text.TextEditor;
30 import org.eclipse.ui.internal.genericeditor.preferences.GenericEditorPreferenceConstants;
31 import org.eclipse.ui.texteditor.ChainedPreferenceStore;
32 import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
2133
2234 /**
23 * A generic code editor that is aimed at being extended by contributions. Behavior
24 * is supposed to be added via extensions, not by inheritance.
35 * A generic code editor that is aimed at being extended by contributions.
36 * Behavior is supposed to be added via extensions, not by inheritance.
2537 *
2638 * @since 1.0
2739 */
2840 public class ExtensionBasedTextEditor extends TextEditor {
2941
3042 private static final String CONTEXT_ID = "org.eclipse.ui.genericeditor.genericEditorContext"; //$NON-NLS-1$
43
44 private static final String MATCHING_BRACKETS = GenericEditorPreferenceConstants.EDITOR_MATCHING_BRACKETS;
45 private static final String MATCHING_BRACKETS_COLOR = GenericEditorPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
46 private static final String HIGHLIGHT_BRACKET_AT_CARET_LOCATION = GenericEditorPreferenceConstants.EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION;
47 private static final String ENCLOSING_BRACKETS = GenericEditorPreferenceConstants.EDITOR_ENCLOSING_BRACKETS;
48
3149 private ExtensionBasedTextViewerConfiguration configuration;
3250
3351 /**
5169
5270 @Override
5371 protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
54 fAnnotationAccess= getAnnotationAccess();
55 fOverviewRuler= createOverviewRuler(getSharedColors());
72 fAnnotationAccess = getAnnotationAccess();
73 fOverviewRuler = createOverviewRuler(getSharedColors());
5674
57 ProjectionViewer viewer= new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
58 getSourceViewerDecorationSupport(viewer);
75 ProjectionViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(),
76 styles);
77 SourceViewerDecorationSupport support = getSourceViewerDecorationSupport(viewer);
78 configureCharacterPairMatcher(viewer, support);
5979 return viewer;
6080 }
6181
82 @Override
83 public void createPartControl(Composite parent) {
84 super.createPartControl(parent);
85 ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
6286
63 @Override
64 public void createPartControl(Composite parent)
65 {
66 super.createPartControl(parent);
67 ProjectionViewer viewer =(ProjectionViewer)getSourceViewer();
68
69 new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors()).install();
87 new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors()).install();
7088 viewer.doOperation(ProjectionViewer.TOGGLE);
7189 }
7290
91 @Override
92 protected void initializeEditor() {
93 super.initializeEditor();
94 setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] {
95 GenericEditorPreferenceConstants.getPreferenceStore(), EditorsUI.getPreferenceStore() }));
96 }
97
98 /**
99 * Configure the {@link ICharacterPairMatcher} from the
100 * "org.eclipse.ui.genericeditor.characterPairMatchers" extension point.
101 *
102 * @param viewer the source viewer.
103 *
104 * @param support the source viewer decoration support.
105 */
106 private void configureCharacterPairMatcher(ISourceViewer viewer, SourceViewerDecorationSupport support) {
107 List<ICharacterPairMatcher> matchers = GenericEditorPlugin.getDefault().getCharacterPairMatcherRegistry()
108 .getCharacterPairMatchers(viewer, this, configuration.getContentTypes());
109 if (!matchers.isEmpty()) {
110 ICharacterPairMatcher matcher = matchers.get(0);
111 support.setCharacterPairMatcher(matcher);
112 support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR,
113 HIGHLIGHT_BRACKET_AT_CARET_LOCATION, ENCLOSING_BRACKETS);
114 }
115 }
73116 }
00 /*******************************************************************************
11 * Copyright (c) 2016, 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela, Mickael Istria (Red Hat Inc.) - initial implementation
912 * Lucas Bullen (Red Hat Inc.) - Bug 508829 custom reconciler support
1013 * - Bug 521382 default highlight reconciler
1114 * Simon Scholz <simon.scholz@vogella.com> - Bug 527830
15 * Angelo Zerr <angelo.zerr@gmail.com> - [generic editor] Default Code folding for generic editor should use IndentFoldingStrategy - Bug 520659
1216 *******************************************************************************/
1317 package org.eclipse.ui.internal.genericeditor;
1418
4347 import org.eclipse.ui.IEditorPart;
4448 import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
4549 import org.eclipse.ui.internal.editors.text.EditorsPlugin;
50 import org.eclipse.ui.internal.genericeditor.folding.DefaultFoldingReconciler;
4651 import org.eclipse.ui.internal.genericeditor.hover.CompositeTextHover;
4752 import org.eclipse.ui.internal.genericeditor.markers.MarkerResoltionQuickAssistProcessor;
4853 import org.eclipse.ui.texteditor.ITextEditor;
4954 import org.eclipse.ui.texteditor.spelling.SpellingCorrectionProcessor;
5055
5156 /**
52 * The configuration of the {@link ExtensionBasedTextEditor}. It registers the proxy composite
53 * for hover, completion, syntax highlighting, and then those proxy take care of resolving to
54 * the right extensions on-demand.
57 * The configuration of the {@link ExtensionBasedTextEditor}. It registers the
58 * proxy composite for hover, completion, syntax highlighting, and then those
59 * proxy take care of resolving to the right extensions on-demand.
5560 *
5661 * @since 1.0
5762 */
5863 @SuppressWarnings("restriction")
59 public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewerConfiguration implements IDocumentPartitioningListener {
64 public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewerConfiguration
65 implements IDocumentPartitioningListener {
6066
6167 private ITextEditor editor;
6268 private Set<IContentType> contentTypes;
6773
6874 /**
6975 *
70 * @param editor the editor we're creating.
76 * @param editor the editor we're creating.
7177 * @param preferenceStore the preference store.
7278 */
7379 public ExtensionBasedTextViewerConfiguration(ITextEditor editor, IPreferenceStore preferenceStore) {
8086 });
8187 }
8288
83 private Set<IContentType> getContentTypes() {
89 Set<IContentType> getContentTypes() {
8490 if (this.contentTypes == null) {
8591 this.contentTypes = new LinkedHashSet<>();
86 Queue<IContentType> types = new LinkedList<>(Arrays.asList(Platform.getContentTypeManager().findContentTypesFor(editor.getEditorInput().getName())));
92 Queue<IContentType> types = new LinkedList<>(Arrays
93 .asList(Platform.getContentTypeManager().findContentTypesFor(editor.getEditorInput().getName())));
8794 while (!types.isEmpty()) {
8895 IContentType type = types.poll();
8996 this.contentTypes.add(type);
98105
99106 @Override
100107 public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
101 List<ITextHover> hovers = GenericEditorPlugin.getDefault().getHoverRegistry().getAvailableHovers(sourceViewer, editor, getContentTypes());
108 List<ITextHover> hovers = GenericEditorPlugin.getDefault().getHoverRegistry().getAvailableHovers(sourceViewer,
109 editor, getContentTypes());
102110 if (hovers == null || hovers.isEmpty()) {
103111 return null;
104112 } else if (hovers.size() == 1) {
110118
111119 @Override
112120 public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
113 ContentAssistProcessorRegistry registry= GenericEditorPlugin.getDefault().getContentAssistProcessorRegistry();
114 contentAssistant= new ContentAssistant(true);
121 ContentAssistProcessorRegistry registry = GenericEditorPlugin.getDefault().getContentAssistProcessorRegistry();
122 contentAssistant = new ContentAssistant(true);
115123 contentAssistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_BELOW);
116124 contentAssistant.setProposalPopupOrientation(ContentAssistant.PROPOSAL_REMOVE);
117125 contentAssistant.setAutoActivationDelay(0);
139147 @Override
140148 public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
141149 PresentationReconcilerRegistry registry = GenericEditorPlugin.getDefault().getPresentationReconcilerRegistry();
142 List<IPresentationReconciler> reconciliers = registry.getPresentationReconcilers(sourceViewer, editor, getContentTypes());
150 List<IPresentationReconciler> reconciliers = registry.getPresentationReconcilers(sourceViewer, editor,
151 getContentTypes());
143152 if (!reconciliers.isEmpty()) {
144153 return reconciliers.get(0);
145154 }
177186 @Override
178187 public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
179188 QuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant();
180 CompositeQuickAssistProcessor processor = new CompositeQuickAssistProcessor(Arrays.asList(
181 new MarkerResoltionQuickAssistProcessor(),
182 new SpellingCorrectionProcessor()
183 ));
189 CompositeQuickAssistProcessor processor = new CompositeQuickAssistProcessor(
190 Arrays.asList(new MarkerResoltionQuickAssistProcessor(), new SpellingCorrectionProcessor()));
184191 quickAssistAssistant.setQuickAssistProcessor(processor);
185 quickAssistAssistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); //$NON-NLS-1$
186 quickAssistAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString()));
192 quickAssistAssistant.setRestoreCompletionProposalSize(
193 EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); //$NON-NLS-1$
194 quickAssistAssistant.setInformationControlCreator(
195 parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString()));
187196 return quickAssistAssistant;
188197 }
189198
190199 @Override
191200 public IReconciler getReconciler(ISourceViewer sourceViewer) {
192201 ReconcilerRegistry registry = GenericEditorPlugin.getDefault().getReconcilerRegistry();
193 List<IReconciler> reconciliers = registry.getReconcilers(sourceViewer, editor, getContentTypes());
194 List<IReconciler> highlightReconciliers = registry.getHighlightReconcilers(sourceViewer, editor, getContentTypes());
195
196 if(!highlightReconciliers.isEmpty()) {
197 reconciliers.addAll(highlightReconciliers);
198 }else {
199 reconciliers.add(new DefaultWordHighlightReconciler());
200 }
201
202 if (!reconciliers.isEmpty()) {
203 return new CompositeReconciler(reconciliers);
202 List<IReconciler> reconcilers = registry.getReconcilers(sourceViewer, editor, getContentTypes());
203 // Fill with highlight reconcilers
204 List<IReconciler> highlightReconcilers = registry.getHighlightReconcilers(sourceViewer, editor,
205 getContentTypes());
206 if (!highlightReconcilers.isEmpty()) {
207 reconcilers.addAll(highlightReconcilers);
208 } else {
209 reconcilers.add(new DefaultWordHighlightReconciler());
210 }
211 // Fill with folding reconcilers
212 List<IReconciler> foldingReconcilers = registry.getFoldingReconcilers(sourceViewer, editor, getContentTypes());
213 if (!foldingReconcilers.isEmpty()) {
214 reconcilers.addAll(foldingReconcilers);
215 } else {
216 reconcilers.add(new DefaultFoldingReconciler());
217 }
218
219 if (!reconcilers.isEmpty()) {
220 return new CompositeReconciler(reconcilers);
204221 }
205222 return null;
206223 }
208225 @Override
209226 public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
210227 AutoEditStrategyRegistry registry = GenericEditorPlugin.getDefault().getAutoEditStrategyRegistry();
211 List<IAutoEditStrategy> editStrategies = registry.getAutoEditStrategies(sourceViewer, editor, getContentTypes());
228 List<IAutoEditStrategy> editStrategies = registry.getAutoEditStrategies(sourceViewer, editor,
229 getContentTypes());
212230 if (!editStrategies.isEmpty()) {
213231 return editStrategies.toArray(new IAutoEditStrategy[editStrategies.size()]);
214232 }
217235
218236 @Override
219237 protected Map<String, IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
220 Map<String, IAdaptable> targets= super.getHyperlinkDetectorTargets(sourceViewer);
238 Map<String, IAdaptable> targets = super.getHyperlinkDetectorTargets(sourceViewer);
221239 targets.put("org.eclipse.ui.genericeditor.GenericEditor", editor); //$NON-NLS-1$
222240 return targets;
223241 }
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016, 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela, Mickael Istria (Red Hat Inc.) - initial implementation
1013 *******************************************************************************/
1114 package org.eclipse.ui.internal.genericeditor;
1215
16 import org.eclipse.jface.text.IAutoEditStrategy;
1317 import org.eclipse.jface.text.ITextHover;
1418 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
1519 import org.eclipse.jface.text.presentation.IPresentationReconciler;
20 import org.eclipse.jface.text.reconciler.IReconciler;
21 import org.eclipse.jface.text.source.ICharacterPairMatcher;
22 import org.eclipse.jface.util.IPropertyChangeListener;
23 import org.eclipse.jface.util.PropertyChangeEvent;
24 import org.eclipse.ui.PlatformUI;
1625 import org.eclipse.ui.internal.genericeditor.hover.TextHoverRegistry;
26 import org.eclipse.ui.internal.genericeditor.preferences.GenericEditorPluginPreferenceInitializer;
27 import org.eclipse.ui.internal.genericeditor.preferences.GenericEditorPreferenceConstants;
1728 import org.eclipse.ui.plugin.AbstractUIPlugin;
29 import org.eclipse.ui.themes.IThemeManager;
1830 import org.osgi.framework.BundleContext;
1931
2032 /**
3345 private ReconcilerRegistry reconcilierRegistry;
3446 private PresentationReconcilerRegistry presentationReconcilierRegistry;
3547 private AutoEditStrategyRegistry autoEditStrategyRegistry;
48 private CharacterPairMatcherRegistry characterPairMatcherRegistry;
49
50 private IPropertyChangeListener themeListener;
3651
3752 @Override
38 public void start(BundleContext context) throws Exception{
53 public void start(BundleContext context) throws Exception {
3954 INSTANCE = this;
4055 super.start(context);
56
57 if (PlatformUI.isWorkbenchRunning()) {
58 themeListener = new IPropertyChangeListener() {
59 @Override
60 public void propertyChange(PropertyChangeEvent event) {
61 if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
62 GenericEditorPluginPreferenceInitializer
63 .setThemeBasedPreferences(GenericEditorPreferenceConstants.getPreferenceStore(), true);
64 }
65 };
66 PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
67 }
4168 }
4269
4370 @Override
4471 public void stop(BundleContext context) throws Exception {
4572 super.stop(context);
73 if (themeListener != null) {
74 PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(themeListener);
75 themeListener = null;
76 }
4677 INSTANCE = null;
4778 }
4879
6293 }
6394
6495 /**
65 * @return the registry allowing to access contributed {@link IContentAssistProcessor}s.
96 * @return the registry allowing to access contributed
97 * {@link IContentAssistProcessor}s.
6698 * @since 1.0
6799 */
68100 public synchronized ContentAssistProcessorRegistry getContentAssistProcessorRegistry() {
71103 }
72104 return this.contentAssistProcessorsRegistry;
73105 }
74
106
75107 /**
76108 * @return the registry allowing to access contributed {@link IReconciler}s.
77109 * @since 1.1
84116 }
85117
86118 /**
87 * @return the registry allowing to access contributed {@link IPresentationReconciler}s.
119 * @return the registry allowing to access contributed
120 * {@link IPresentationReconciler}s.
88121 * @since 1.0
89122 */
90123 public synchronized PresentationReconcilerRegistry getPresentationReconcilerRegistry() {
95128 }
96129
97130 /**
98 * @return the registry allowing to access contributed {@link IAutoEditStrategy}s.
131 * @return the registry allowing to access contributed
132 * {@link IAutoEditStrategy}s.
99133 * @since 1.1
100134 */
101135 public synchronized AutoEditStrategyRegistry getAutoEditStrategyRegistry() {
104138 }
105139 return this.autoEditStrategyRegistry;
106140 }
141
142 /**
143 * @return the registry allowing to access contributed
144 * {@link ICharacterPairMatcher}s.
145 * @since 1.2
146 */
147 public synchronized CharacterPairMatcherRegistry getCharacterPairMatcherRegistry() {
148 if (this.characterPairMatcherRegistry == null) {
149 this.characterPairMatcherRegistry = new CharacterPairMatcherRegistry();
150 }
151 return this.characterPairMatcherRegistry;
152 }
107153 }
00 /*******************************************************************************
11 * Copyright (c) 2018 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Alexander Kurtakov (Red Hat Inc.) - initial version
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela, Mickael Istria (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
2629 import org.eclipse.ui.texteditor.ITextEditor;
2730
2831 /**
29 * A registry of reconciliers provided by extensions <code>org.eclipse.ui.genericeditor.reconcilers</code>
30 * and <code>org.eclipse.ui.genericeditor.foldingReconcilers</code>.
31 * Those extensions are specific to a given {@link IContentType}.
32 * A registry of reconciliers provided by extensions
33 * <code>org.eclipse.ui.genericeditor.reconcilers</code> and
34 * <code>org.eclipse.ui.genericeditor.foldingReconcilers</code>. Those
35 * extensions are specific to a given {@link IContentType}.
3236 *
3337 * @since 1.1
3438 */
3640
3741 private static final String EXTENSION_POINT_ID = GenericEditorPlugin.BUNDLE_ID + ".reconcilers"; //$NON-NLS-1$
3842 private static final String HIGHLIGHT_EXTENSION_POINT_ID = GenericEditorPlugin.BUNDLE_ID + ".highlightReconcilers"; //$NON-NLS-1$
43 private static final String FOLDING_EXTENSION_POINT_ID = GenericEditorPlugin.BUNDLE_ID + ".foldingReconcilers"; //$NON-NLS-1$
3944
4045 private Map<IConfigurationElement, GenericContentTypeRelatedExtension<IReconciler>> extensions = new HashMap<>();
4146 private Map<IConfigurationElement, GenericContentTypeRelatedExtension<IReconciler>> highlightExtensions = new HashMap<>();
47 private Map<IConfigurationElement, GenericContentTypeRelatedExtension<IReconciler>> foldingExtensions = new HashMap<>();
4248 private boolean outOfSync = true;
4349 private boolean highlightOutOfSync = true;
50 private boolean foldingOutOfSync = true;
4451
4552 /**
4653 * Creates the registry and binds it to the extension point.
5360 Platform.getExtensionRegistry().addRegistryChangeListener(event -> {
5461 highlightOutOfSync = true;
5562 }, HIGHLIGHT_EXTENSION_POINT_ID);
56 }
57
58 /**
59 * Get the contributed {@link IReconciliers}s that are relevant to hook on source viewer according
60 * to document content types.
63
64 Platform.getExtensionRegistry().addRegistryChangeListener(event -> {
65 foldingOutOfSync = true;
66 }, FOLDING_EXTENSION_POINT_ID);
67 }
68
69 /**
70 * Get the contributed {@link IReconciliers}s that are relevant to hook on
71 * source viewer according to document content types.
72 *
6173 * @param sourceViewer the source viewer we're hooking completion to.
62 * @param editor the text editor
74 * @param editor the text editor
6375 * @param contentTypes the content types of the document we're editing.
64 * @return the list of {@link IReconciler} contributed for at least one of the content types,
65 * sorted by most generic content type to most specific.
66 */
67 public List<IReconciler> getReconcilers(ISourceViewer sourceViewer, ITextEditor editor, Set<IContentType> contentTypes) {
76 * @return the list of {@link IReconciler} contributed for at least one of the
77 * content types, sorted by most generic content type to most specific.
78 */
79 public List<IReconciler> getReconcilers(ISourceViewer sourceViewer, ITextEditor editor,
80 Set<IContentType> contentTypes) {
6881 if (this.outOfSync) {
6982 sync();
7083 }
7285 .filter(ext -> contentTypes.contains(ext.targetContentType))
7386 .filter(ext -> ext.matches(sourceViewer, editor))
7487 .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed())
75 .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate)
76 .collect(Collectors.toList());
88 .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate).collect(Collectors.toList());
7789 return reconcilers;
7890 }
7991
8092 /**
81 * Get the contributed highlight {@link IReconciliers}s that are relevant to hook on source viewer according
82 * to document content types.
93 * Get the contributed highlight {@link IReconciliers}s that are relevant to
94 * hook on source viewer according to document content types.
95 *
8396 * @param sourceViewer the source viewer we're hooking completion to.
84 * @param editor the text editor
97 * @param editor the text editor
8598 * @param contentTypes the content types of the document we're editing.
86 * @return the list of highlight {@link IReconciler}s contributed for at least one of the content types,
87 * sorted by most generic content type to most specific.
88 */
89 public List<IReconciler> getHighlightReconcilers(ISourceViewer sourceViewer, ITextEditor editor, Set<IContentType> contentTypes) {
99 * @return the list of highlight {@link IReconciler}s contributed for at least
100 * one of the content types, sorted by most generic content type to most
101 * specific.
102 */
103 public List<IReconciler> getHighlightReconcilers(ISourceViewer sourceViewer, ITextEditor editor,
104 Set<IContentType> contentTypes) {
90105 if (this.highlightOutOfSync) {
91106 syncHighlight();
92107 }
94109 .filter(ext -> contentTypes.contains(ext.targetContentType))
95110 .filter(ext -> ext.matches(sourceViewer, editor))
96111 .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed())
97 .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate)
98 .collect(Collectors.toList());
112 .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate).collect(Collectors.toList());
99113 return highlightReconcilers;
114 }
115
116 /**
117 * Get the contributed folding {@link IReconciliers}s that are relevant to hook
118 * on source viewer according to document content types.
119 *
120 * @param sourceViewer the source viewer we're hooking completion to.
121 * @param editor the text editor
122 * @param contentTypes the content types of the document we're editing.
123 * @return the list of folding {@link IReconciler}s contributed for at least one
124 * of the content types, sorted by most generic content type to most
125 * specific.
126 */
127 public List<IReconciler> getFoldingReconcilers(ISourceViewer sourceViewer, ITextEditor editor,
128 Set<IContentType> contentTypes) {
129 if (this.foldingOutOfSync) {
130 syncFolding();
131 }
132 List<IReconciler> foldingReconcilers = this.foldingExtensions.values().stream()
133 .filter(ext -> contentTypes.contains(ext.targetContentType))
134 .filter(ext -> ext.matches(sourceViewer, editor))
135 .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed())
136 .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate).collect(Collectors.toList());
137 return foldingReconcilers;
100138 }
101139
102140 private void sync() {
103141 Set<IConfigurationElement> toRemoveExtensions = new HashSet<>(this.extensions.keySet());
104 for (IConfigurationElement extension : Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID)) {
142 for (IConfigurationElement extension : Platform.getExtensionRegistry()
143 .getConfigurationElementsFor(EXTENSION_POINT_ID)) {
105144 toRemoveExtensions.remove(extension);
106145 if (!this.extensions.containsKey(extension)) {
107146 try {
108147 this.extensions.put(extension, new GenericContentTypeRelatedExtension<IReconciler>(extension));
109148 } catch (Exception ex) {
110 GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
149 GenericEditorPlugin.getDefault().getLog()
150 .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
111151 }
112152 }
113153 }
119159
120160 private void syncHighlight() {
121161 Set<IConfigurationElement> toRemoveExtensions = new HashSet<>(this.extensions.keySet());
122 for (IConfigurationElement extension : Platform.getExtensionRegistry().getConfigurationElementsFor(HIGHLIGHT_EXTENSION_POINT_ID)) {
162 for (IConfigurationElement extension : Platform.getExtensionRegistry()
163 .getConfigurationElementsFor(HIGHLIGHT_EXTENSION_POINT_ID)) {
123164 toRemoveExtensions.remove(extension);
124165 if (!this.highlightExtensions.containsKey(extension)) {
125166 try {
126 this.highlightExtensions.put(extension, new GenericContentTypeRelatedExtension<IReconciler>(extension));
167 this.highlightExtensions.put(extension,
168 new GenericContentTypeRelatedExtension<IReconciler>(extension));
127169 } catch (Exception ex) {
128 GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
170 GenericEditorPlugin.getDefault().getLog()
171 .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
129172 }
130173 }
131174 }
135178 this.highlightOutOfSync = false;
136179 }
137180
181 private void syncFolding() {
182 Set<IConfigurationElement> toRemoveExtensions = new HashSet<>(this.extensions.keySet());
183 for (IConfigurationElement extension : Platform.getExtensionRegistry()
184 .getConfigurationElementsFor(FOLDING_EXTENSION_POINT_ID)) {
185 toRemoveExtensions.remove(extension);
186 if (!this.foldingExtensions.containsKey(extension)) {
187 try {
188 this.foldingExtensions.put(extension,
189 new GenericContentTypeRelatedExtension<IReconciler>(extension));
190 } catch (Exception ex) {
191 GenericEditorPlugin.getDefault().getLog()
192 .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
193 }
194 }
195 }
196 for (IConfigurationElement toRemove : toRemoveExtensions) {
197 this.foldingExtensions.remove(toRemove);
198 }
199 this.foldingOutOfSync = false;
200 }
138201 }
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [generic editor] Default Code folding for generic editor should use IndentFoldingStrategy - Bug 520659
12 */
13 package org.eclipse.ui.internal.genericeditor.folding;
14
15 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.jface.text.IDocument;
17 import org.eclipse.jface.text.ITextViewer;
18 import org.eclipse.jface.text.reconciler.AbstractReconciler;
19 import org.eclipse.jface.text.reconciler.DirtyRegion;
20 import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
21 import org.eclipse.jface.text.source.projection.ProjectionViewer;
22
23 public class DefaultFoldingReconciler extends AbstractReconciler {
24
25 private final IndentFoldingStrategy foldingStrategy;
26
27 public DefaultFoldingReconciler() {
28 this.foldingStrategy = new IndentFoldingStrategy();
29 }
30
31 @Override
32 public void install(ITextViewer textViewer) {
33 super.install(textViewer);
34 ProjectionViewer viewer = (ProjectionViewer) textViewer;
35 foldingStrategy.setViewer(viewer);
36 }
37
38 @Override
39 public void uninstall() {
40 super.uninstall();
41 foldingStrategy.uninstall();
42 }
43
44 @Override
45 protected void process(DirtyRegion dirtyRegion) {
46 foldingStrategy.reconcile(dirtyRegion, null);
47 }
48
49 @Override
50 protected void reconcilerDocumentChanged(IDocument newDocument) {
51 foldingStrategy.setDocument(newDocument);
52 }
53
54 @Override
55 public IReconcilingStrategy getReconcilingStrategy(String contentType) {
56 return foldingStrategy;
57 }
58
59 @Override
60 public void setProgressMonitor(IProgressMonitor monitor) {
61 super.setProgressMonitor(monitor);
62 foldingStrategy.setProgressMonitor(monitor);
63 }
64
65 @Override
66 protected void initialProcess() {
67 super.initialProcess();
68 foldingStrategy.initialReconcile();
69 }
70 }
0 /*******************************************************************************
1 * Copyright (c) 2009, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * IBM Corporation - initial API and implementation
12 * Angelo Zerr <angelo.zerr@gmail.com> - adapt code org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy to support generic indent folding strategy.
13 * [generic editor] Default Code folding for generic editor should use IndentFoldingStrategy - Bug 520659
14 */
15 package org.eclipse.ui.internal.genericeditor.folding;
16
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.Iterator;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.eclipse.core.runtime.IProgressMonitor;
24 import org.eclipse.jface.text.BadLocationException;
25 import org.eclipse.jface.text.IDocument;
26 import org.eclipse.jface.text.IRegion;
27 import org.eclipse.jface.text.Position;
28 import org.eclipse.jface.text.reconciler.DirtyRegion;
29 import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
30 import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
31 import org.eclipse.jface.text.source.Annotation;
32 import org.eclipse.jface.text.source.projection.IProjectionListener;
33 import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
34 import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
35 import org.eclipse.jface.text.source.projection.ProjectionViewer;
36 import org.eclipse.swt.graphics.FontMetrics;
37 import org.eclipse.swt.graphics.GC;
38 import org.eclipse.swt.graphics.Rectangle;
39 import org.eclipse.swt.widgets.Canvas;
40
41 /**
42 * Indent folding strategy to fold code by using indentation. The folding
43 * strategy must be associated with a viewer for it to function.
44 */
45 public class IndentFoldingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension, IProjectionListener {
46
47 private IDocument document;
48 private ProjectionViewer viewer;
49 private ProjectionAnnotationModel projectionAnnotationModel;
50 private final String lineStartsWithKeyword;
51
52 public IndentFoldingStrategy() {
53 this(null);
54 }
55
56 public IndentFoldingStrategy(String lineStartsWithKeyword) {
57 this.lineStartsWithKeyword = lineStartsWithKeyword;
58 }
59
60 /**
61 * A FoldingAnnotation is a {@link ProjectionAnnotation} it is folding and
62 * overriding the paint method (in a hacky type way) to prevent one line folding
63 * annotations to be drawn.
64 */
65 protected class FoldingAnnotation extends ProjectionAnnotation {
66 private boolean visible; /* workaround for BUG85874 */
67
68 /**
69 * Creates a new FoldingAnnotation.
70 *
71 * @param isCollapsed true if this annotation should be collapsed, false
72 * otherwise
73 */
74 public FoldingAnnotation(boolean isCollapsed) {
75 super(isCollapsed);
76 visible = false;
77 }
78
79 /**
80 * Does not paint hidden annotations. Annotations are hidden when they only span
81 * one line.
82 *
83 * @see ProjectionAnnotation#paint(org.eclipse.swt.graphics.GC,
84 * org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
85 */
86 @Override
87 public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
88 /* workaround for BUG85874 */
89 /*
90 * only need to check annotations that are expanded because hidden annotations
91 * should never have been given the chance to collapse.
92 */
93 if (!isCollapsed()) {
94 // working with rectangle, so line height
95 FontMetrics metrics = gc.getFontMetrics();
96 if (metrics != null) {
97 // do not draw annotations that only span one line and
98 // mark them as not visible
99 if ((rectangle.height / metrics.getHeight()) <= 1) {
100 visible = false;
101 return;
102 }
103 }
104 }
105 visible = true;
106 super.paint(gc, canvas, rectangle);
107 }
108
109 @Override
110 public void markCollapsed() {
111 /* workaround for BUG85874 */
112 // do not mark collapsed if annotation is not visible
113 if (visible)
114 super.markCollapsed();
115 }
116 }
117
118 /**
119 * The folding strategy must be associated with a viewer for it to function
120 *
121 * @param viewer the viewer to associate this folding strategy with
122 */
123 public void setViewer(ProjectionViewer viewer) {
124 if (this.viewer != null) {
125 this.viewer.removeProjectionListener(this);
126 }
127 this.viewer = viewer;
128 this.viewer.addProjectionListener(this);
129 this.projectionAnnotationModel = this.viewer.getProjectionAnnotationModel();
130 }
131
132 public void uninstall() {
133 setDocument(null);
134
135 if (viewer != null) {
136 viewer.removeProjectionListener(this);
137 viewer = null;
138 }
139
140 projectionDisabled();
141 }
142
143 @Override
144 public void setDocument(IDocument document) {
145 this.document = document;
146 }
147
148 @Override
149 public void projectionDisabled() {
150 projectionAnnotationModel = null;
151 }
152
153 @Override
154 public void projectionEnabled() {
155 if (viewer != null) {
156 projectionAnnotationModel = viewer.getProjectionAnnotationModel();
157 }
158 }
159
160 private class LineIndent {
161 public int line;
162 public final int indent;
163
164 public LineIndent(int line, int indent) {
165 this.line = line;
166 this.indent = indent;
167 }
168 }
169
170 @Override
171 public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
172 if (projectionAnnotationModel != null) {
173
174 // these are what are passed off to the annotation model to
175 // actually create and maintain the annotations
176 List<Annotation> modifications = new ArrayList<Annotation>();
177 List<FoldingAnnotation> deletions = new ArrayList<FoldingAnnotation>();
178 List<FoldingAnnotation> existing = new ArrayList<FoldingAnnotation>();
179 Map<Annotation, Position> additions = new HashMap<Annotation, Position>();
180
181 // find and mark all folding annotations with length 0 for deletion
182 markInvalidAnnotationsForDeletion(dirtyRegion, deletions, existing);
183
184 List<LineIndent> previousRegions = new ArrayList<LineIndent>();
185
186 int tabSize = 1;
187 int minimumRangeSize = 1;
188 try {
189
190 // Today we recompute annotation from the whole document each
191 // time.
192 // performance s good even with large document, but it should be
193 // better to loop for only DirtyRegion (and before/after)
194 // int offset = dirtyRegion.getOffset();
195 // int length = dirtyRegion.getLength();
196 // int startLine = 0; //document.getLineOfOffset(offset);
197 int endLine = document.getNumberOfLines() - 1; // startLine +
198 // document.getNumberOfLines(offset,
199 // length) - 1;
200
201 // sentinel, to make sure there's at least one entry
202 previousRegions.add(new LineIndent(endLine + 1, -1));
203
204 int lastLineWhichIsNotEmpty = 0;
205 int lineEmptyCount = 0;
206 Integer lastLineForKeyword = null;
207 int line = endLine;
208 for (line = endLine; line >= 0; line--) {
209 int lineOffset = document.getLineOffset(line);
210 String delim = document.getLineDelimiter(line);
211 int lineLength = document.getLineLength(line) - (delim != null ? delim.length() : 0);
212 String lineContent = document.get(lineOffset, lineLength);
213
214 LineState state = getLineState(lineContent, lastLineForKeyword);
215 switch (state) {
216 case StartWithKeyWord:
217 lineEmptyCount = 0;
218 lastLineWhichIsNotEmpty = line;
219 if (lastLineForKeyword == null) {
220 lastLineForKeyword = line;
221 }
222 break;
223 case EmptyLine:
224 lineEmptyCount++;
225 break;
226 default:
227 addAnnotationForKeyword(modifications, deletions, existing, additions,
228 line + 1 + lineEmptyCount, lastLineForKeyword);
229 lastLineForKeyword = null;
230 lineEmptyCount = 0;
231 lastLineWhichIsNotEmpty = line;
232 int indent = computeIndentLevel(lineContent, tabSize);
233 if (indent == -1) {
234 continue; // only whitespace
235 }
236
237 LineIndent previous = previousRegions.get(previousRegions.size() - 1);
238 if (previous.indent > indent) {
239 // discard all regions with larger indent
240 do {
241 previousRegions.remove(previousRegions.size() - 1);
242 previous = previousRegions.get(previousRegions.size() - 1);
243 } while (previous.indent > indent);
244
245 // new folding range
246 int endLineNumber = previous.line - 1;
247 if (endLineNumber - line >= minimumRangeSize) {
248 updateAnnotation(modifications, deletions, existing, additions, line, endLineNumber);
249 }
250 }
251 if (previous.indent == indent) {
252 previous.line = line;
253 } else { // previous.indent < indent
254 // new region with a bigger indent
255 previousRegions.add(new LineIndent(line, indent));
256 }
257 }
258 }
259 addAnnotationForKeyword(modifications, deletions, existing, additions, lastLineWhichIsNotEmpty,
260 lastLineForKeyword);
261 } catch (BadLocationException e) {
262 // should never done
263 e.printStackTrace();
264 }
265
266 // be sure projection has not been disabled
267 if (projectionAnnotationModel != null) {
268 if (existing.size() > 0) {
269 deletions.addAll(existing);
270 }
271 // send the calculated updates to the annotations to the
272 // annotation model
273 projectionAnnotationModel.modifyAnnotations(deletions.toArray(new Annotation[1]), additions,
274 modifications.toArray(new Annotation[0]));
275 }
276 }
277 }
278
279 private void addAnnotationForKeyword(List<Annotation> modifications, List<FoldingAnnotation> deletions,
280 List<FoldingAnnotation> existing, Map<Annotation, Position> additions, int startLine,
281 Integer lastLineForKeyword) throws BadLocationException {
282 if (lastLineForKeyword != null) {
283 updateAnnotation(modifications, deletions, existing, additions, startLine, lastLineForKeyword);
284 }
285 }
286
287 private enum LineState {
288 StartWithKeyWord, DontStartWithKeyWord, EmptyLine
289 }
290
291 /**
292 * Returns the line state for line which starts with a given keyword.
293 *
294 * @param lineContent line content.
295 * @param lastLineForKeyword last line for the given keyword.
296 * @return
297 */
298 private LineState getLineState(String lineContent, Integer lastLineForKeyword) {
299 if (lineStartsWithKeyword == null) {
300 // none keyword defined.
301 return LineState.DontStartWithKeyWord;
302 }
303 if (lineContent != null && lineContent.trim().startsWith(lineStartsWithKeyword)) {
304 // The line starts with the given keyword (ex: starts with "import")
305 return LineState.StartWithKeyWord;
306 }
307 if (lastLineForKeyword != null && (lineContent == null || lineContent.trim().length() == 0)) {
308 // a last line for keyword was defined, line is empty
309 return LineState.EmptyLine;
310 }
311 return LineState.DontStartWithKeyWord;
312 }
313
314 /**
315 * Compute indentation level of the given line by using the given tab size.
316 *
317 * @param line the line text.
318 * @param tabSize the tab size.
319 * @return the indentation level of the given line by using the given tab size.
320 */
321 private static int computeIndentLevel(String line, int tabSize) {
322 int i = 0;
323 int indent = 0;
324 while (i < line.length()) {
325 char ch = line.charAt(i);
326 if (ch == ' ') {
327 indent++;
328 } else if (ch == '\t') {
329 indent = indent - indent % tabSize + tabSize;
330 } else {
331 break;
332 }
333 i++;
334 }
335 if (i == line.length()) {
336 return -1; // line only consists of whitespace
337 }
338 return indent;
339 }
340
341 /**
342 * Given a {@link DirtyRegion} returns an {@link Iterator} of the already
343 * existing annotations in that region.
344 *
345 * @param dirtyRegion the {@link DirtyRegion} to check for existing annotations
346 * in
347 *
348 * @return an {@link Iterator} over the annotations in the given
349 * {@link DirtyRegion}. The iterator could have no annotations in it. Or
350 * <code>null</code> if projection has been disabled.
351 */
352 private Iterator<Annotation> getAnnotationIterator(DirtyRegion dirtyRegion) {
353 Iterator<Annotation> annoIter = null;
354 // be sure project has not been disabled
355 if (projectionAnnotationModel != null) {
356 // workaround for Platform Bug 299416
357 int offset = dirtyRegion.getOffset();
358 if (offset > 0) {
359 offset--;
360 }
361 annoIter = projectionAnnotationModel.getAnnotationIterator(0, document.getLength(), false, false);
362 }
363 return annoIter;
364 }
365
366 /**
367 * Update annotations.
368 *
369 * @param modifications the folding annotations to update.
370 * @param deletions the folding annotations to delete.
371 * @param existing the existing folding annotations.
372 * @param additions annoation to add
373 * @param line the line index
374 * @param endLineNumber the end line number
375 * @throws BadLocationException
376 */
377 private void updateAnnotation(List<Annotation> modifications, List<FoldingAnnotation> deletions,
378 List<FoldingAnnotation> existing, Map<Annotation, Position> additions, int line, Integer endLineNumber)
379 throws BadLocationException {
380 int startOffset = document.getLineOffset(line);
381 int endOffset = document.getLineOffset(endLineNumber) + document.getLineLength(endLineNumber);
382 Position newPos = new Position(startOffset, endOffset - startOffset);
383 if (existing.size() > 0) {
384 FoldingAnnotation existingAnnotation = existing.remove(existing.size() - 1);
385 updateAnnotations(existingAnnotation, newPos, modifications, deletions);
386 } else {
387 additions.put(new FoldingAnnotation(false), newPos);
388 }
389 }
390
391 /**
392 * Update annotations.
393 *
394 * @param existingAnnotation the existing annotations that need to be updated
395 * based on the given dirtied IndexRegion
396 * @param newPos the new position that caused the annotations need
397 * for updating and null otherwise.
398 * @param modifications the list of annotations to be modified
399 * @param deletions the list of annotations to be deleted
400 */
401 protected void updateAnnotations(Annotation existingAnnotation, Position newPos, List<Annotation> modifications,
402 List<FoldingAnnotation> deletions) {
403 if (existingAnnotation instanceof FoldingAnnotation) {
404 FoldingAnnotation foldingAnnotation = (FoldingAnnotation) existingAnnotation;
405
406 // if a new position can be calculated then update the position of
407 // the annotation,
408 // else the annotation needs to be deleted
409 if (newPos != null && newPos.length > 0 && projectionAnnotationModel != null) {
410 Position oldPos = projectionAnnotationModel.getPosition(foldingAnnotation);
411 // only update the position if we have to
412 if (!newPos.equals(oldPos)) {
413 oldPos.setOffset(newPos.offset);
414 oldPos.setLength(newPos.length);
415 modifications.add(foldingAnnotation);
416 }
417 } else {
418 deletions.add(foldingAnnotation);
419 }
420 }
421 }
422
423 /**
424 * <p>
425 * Searches the given {@link DirtyRegion} for annotations that now have a length
426 * of 0. This is caused when something that was being folded has been deleted.
427 * These {@link FoldingAnnotation}s are then added to the {@link List} of
428 * {@link FoldingAnnotation}s to be deleted
429 * </p>
430 *
431 * @param dirtyRegion find the now invalid {@link FoldingAnnotation}s in this
432 * {@link DirtyRegion}
433 * @param deletions the current list of {@link FoldingAnnotation}s marked for
434 * deletion that the newly found invalid
435 * {@link FoldingAnnotation}s will be added to
436 */
437 protected void markInvalidAnnotationsForDeletion(DirtyRegion dirtyRegion, List<FoldingAnnotation> deletions,
438 List<FoldingAnnotation> existing) {
439 Iterator<Annotation> iter = getAnnotationIterator(dirtyRegion);
440 if (iter != null) {
441 while (iter.hasNext()) {
442 Annotation anno = iter.next();
443 if (anno instanceof FoldingAnnotation) {
444 FoldingAnnotation folding = (FoldingAnnotation) anno;
445 Position pos = projectionAnnotationModel.getPosition(anno);
446 if (pos.length == 0) {
447 deletions.add(folding);
448 } else {
449 existing.add(folding);
450 }
451 }
452 }
453 }
454 }
455
456 @Override
457 public void reconcile(IRegion partition) {
458 // not used, we use:
459 // reconcile(DirtyRegion dirtyRegion, IRegion subRegion)
460 }
461
462 @Override
463 public void setProgressMonitor(IProgressMonitor monitor) {
464 // Do nothing
465 }
466
467 @Override
468 public void initialReconcile() {
469 reconcile(new DirtyRegion(0, document.getLength(), DirtyRegion.INSERT, document.get()), null);
470 }
471 }
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - initial implementation
2124 /**
2225 * A comparator that allows to sort elements according to their relative
2326 * placement (isBefore and isAfter)
24 *TODO: generalizing to any kind of extension supporting isBefore and isAfter
27 * TODO: generalizing to any kind of extension supporting isBefore and isAfter
2528 */
2629 class OrderedExtensionComparator implements Comparator<TextHoverExtension> {
2730
5255 return true;
5356 }
5457 String id1 = arg1.getId();
55 if (id1 == null) {
56 return false;
57 }
5858 if (before0.equals(id1)) {
5959 return true;
6060 }
7474 return true;
7575 }
7676 String id1 = arg1.getId();
77 if (id1 == null) {
78 return false;
79 }
8077 if (after0.equals(id1)) {
8178 return true;
8279 }
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - initial implementation
00 ###############################################################################
11 # Copyright (c) 2018 Red Hat Inc. and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # Alexander Kurtakov (Red Hat Inc.) - initial API and implementation
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v2.0
4 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v20.html
6 *
7 * Contributors:
8 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 538111 - [generic editor] Extension point for ICharacterPairMatcher
9 */
10 package org.eclipse.ui.internal.genericeditor.preferences;
11
12 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
13 import org.eclipse.jface.preference.IPreferenceStore;
14 import org.eclipse.jface.preference.PreferenceConverter;
15 import org.eclipse.jface.resource.ColorRegistry;
16 import org.eclipse.swt.graphics.RGB;
17 import org.eclipse.ui.PlatformUI;
18
19 /**
20 * Preference initializer for Generic Editor plug-in.
21 *
22 * @since 1.2
23 */
24 public class GenericEditorPluginPreferenceInitializer extends AbstractPreferenceInitializer {
25
26 @Override
27 public void initializeDefaultPreferences() {
28 IPreferenceStore store = GenericEditorPreferenceConstants.getPreferenceStore();
29 GenericEditorPreferenceConstants.initializeDefaultValues(store);
30 }
31
32 public static void setThemeBasedPreferences(IPreferenceStore store, boolean fireEvent) {
33 ColorRegistry registry = null;
34 if (PlatformUI.isWorkbenchRunning())
35 registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
36
37 setDefault(store, GenericEditorPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR,
38 findRGB(registry, IGenericEditorThemeConstants.EDITOR_MATCHING_BRACKETS_COLOR, new RGB(127, 0, 85)),
39 fireEvent);
40
41 }
42
43 /**
44 * Sets the default value and fires a property change event if necessary.
45 *
46 * @param store the preference store
47 * @param key the preference key
48 * @param newValue the new value
49 * @param fireEvent <code>false</code> if no event should be fired
50 * @since 1.2
51 */
52 private static void setDefault(IPreferenceStore store, String key, RGB newValue, boolean fireEvent) {
53 if (!fireEvent) {
54 PreferenceConverter.setDefault(store, key, newValue);
55 return;
56 }
57
58 RGB oldValue = null;
59 if (store.isDefault(key))
60 oldValue = PreferenceConverter.getDefaultColor(store, key);
61
62 PreferenceConverter.setDefault(store, key, newValue);
63
64 if (oldValue != null && !oldValue.equals(newValue))
65 store.firePropertyChangeEvent(key, oldValue, newValue);
66 }
67
68 /**
69 * Returns the RGB for the given key in the given color registry.
70 *
71 * @param registry the color registry
72 * @param key the key for the constant in the registry
73 * @param defaultRGB the default RGB if no entry is found
74 * @return RGB the RGB
75 * @since 1.2
76 */
77 private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) {
78 if (registry == null)
79 return defaultRGB;
80
81 RGB rgb = registry.getRGB(key);
82 if (rgb != null)
83 return rgb;
84
85 return defaultRGB;
86 }
87
88 }
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v2.0
4 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v20.html
6 *
7 * Contributors:
8 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 538111 - [generic editor] Extension point for ICharacterPairMatcher
9 */
10 package org.eclipse.ui.internal.genericeditor.preferences;
11
12 import org.eclipse.jface.preference.IPreferenceStore;
13 import org.eclipse.ui.internal.genericeditor.GenericEditorPlugin;
14
15 /**
16 * Preference constants used in the Generic Editor preference store. Clients
17 * should only read the Generic Editor preference store using these values.
18 * Clients are not allowed to modify the preference store programmatically.
19 * <p>
20 * This class it is not intended to be instantiated or subclassed by clients.
21 * </p>
22 *
23 * @since 1.2
24 *
25 * @noinstantiate This class is not intended to be instantiated by clients.
26 * @noextend This class is not intended to be subclassed by clients.
27 */
28 public class GenericEditorPreferenceConstants {
29
30 private GenericEditorPreferenceConstants() {
31
32 }
33
34 /**
35 * A named preference that controls whether bracket matching highlighting is
36 * turned on or off.
37 * <p>
38 * Value is of type <code>Boolean</code>.
39 * </p>
40 *
41 * @since 1.2
42 */
43 public final static String EDITOR_MATCHING_BRACKETS = "matchingBrackets"; //$NON-NLS-1$
44
45 /**
46 * A named preference that holds the color used to highlight matching brackets.
47 * <p>
48 * Value is of type <code>String</code>. A RGB color value encoded as a string
49 * using class <code>PreferenceConverter</code>
50 * </p>
51 *
52 * @see org.eclipse.jface.resource.StringConverter
53 * @see org.eclipse.jface.preference.PreferenceConverter
54 *
55 * @since 1.2
56 */
57 public final static String EDITOR_MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
58
59 /**
60 * A named preference that controls whether bracket at caret location is
61 * highlighted or not.
62 * <p>
63 * Value is of type <code>Boolean</code>.
64 * </p>
65 *
66 * @since 1.2
67 */
68 public final static String EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION = "highlightBracketAtCaretLocation"; //$NON-NLS-1$
69
70 /**
71 * A named preference that controls whether enclosing bracket matching
72 * highlighting is turned on or off.
73 * <p>
74 * Value is of type <code>Boolean</code>.
75 * </p>
76 *
77 * @since 1.2
78 */
79 public final static String EDITOR_ENCLOSING_BRACKETS = "enclosingBrackets"; //$NON-NLS-1$
80
81 /**
82 * Returns the Generic Editor preference store.
83 *
84 * @return the Generic Editor preference store
85 */
86 public static IPreferenceStore getPreferenceStore() {
87 return GenericEditorPlugin.getDefault().getPreferenceStore();
88 }
89
90 /**
91 * Initializes the given preference store with the default values.
92 *
93 * @param store the preference store to be initialized
94 *
95 * @since 1.2
96 */
97 public static void initializeDefaultValues(IPreferenceStore store) {
98 store.setDefault(GenericEditorPreferenceConstants.EDITOR_MATCHING_BRACKETS, true);
99 store.setDefault(GenericEditorPreferenceConstants.EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION, false);
100 store.setDefault(GenericEditorPreferenceConstants.EDITOR_ENCLOSING_BRACKETS, false);
101 // Colors that are set by the current theme
102 GenericEditorPluginPreferenceInitializer.setThemeBasedPreferences(store, false);
103 }
104
105 }
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v2.0
4 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v20.html
6 *
7 * Contributors:
8 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 538111 - [generic editor] Extension point for ICharacterPairMatcher
9 */
10 package org.eclipse.ui.internal.genericeditor.preferences;
11
12 import org.eclipse.ui.internal.genericeditor.GenericEditorPlugin;
13
14 /**
15 * Defines the constants used in the <code>org.eclipse.ui.themes</code>
16 * extension contributed by this plug-in.
17 *
18 * @since 1.2
19 */
20 public interface IGenericEditorThemeConstants {
21
22 String ID_PREFIX = GenericEditorPlugin.BUNDLE_ID + "."; //$NON-NLS-1$
23
24 /**
25 * Theme constant for the color used to highlight matching brackets.
26 */
27 public final String EDITOR_MATCHING_BRACKETS_COLOR = ID_PREFIX
28 + GenericEditorPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
29
30 }
11 Bundle-ManifestVersion: 2
22 Bundle-Name: Examples for Generic Editor
33 Bundle-SymbolicName: org.eclipse.ui.genericeditor.examples;singleton:=true
4 Bundle-Version: 1.1.0.qualifier
4 Bundle-Version: 1.1.100.qualifier
55 Bundle-Vendor: Eclipse.org
66 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
77 Require-Bundle: org.eclipse.ui.genericeditor;bundle-version="1.0.0",
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
8 <h2>About This Content</h2>
99
10 <p>June 2, 2006</p>
11 <h3>License</h3>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1212
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
1821
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2016, 2017 Red Hat Inc. and others
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # Sopot Cela & Mickael Istria (Red Hat Inc.) - initial implementation
00 <?xml version="1.0" encoding="UTF-8"?>
11 <?eclipse version="3.4"?>
2 <!-- ====================================================================== -->
3 <!-- Copyright (c) 2016, 2017 Red Hat Inc. and others. -->
4 <!-- All rights reserved. This program and the accompanying materials -->
5 <!-- are made available under the terms of the Eclipse Public License v1.0 -->
6 <!-- which accompanies this distribution, and is available at -->
7 <!-- http://www.eclipse.org/legal/epl-v10.html -->
8 <!-- -->
9 <!-- Contributors: -->
10 <!-- Sopot Cela & Mickael Istria (Red Hat Inc). -initial implementation -->
11 <!-- Lucas Bullen (Red Hat Inc.) - Bug 508829 custom reconciler support -->
12 <!-- - Bug 521382 default highlighter -->
13 <!-- Simon Scholz <simon.scholz@vogella.com> - Bug 527834 -->
14 <!-- ====================================================================== -->
2 <!--
3 Copyright (c) 2016, 2017 Red Hat Inc. and others.
4
5 This program and the accompanying materials
6 are made available under the terms of the Eclipse Public License 2.0
7 which accompanies this distribution, and is available at
8 https://www.eclipse.org/legal/epl-2.0/
9
10 SPDX-License-Identifier: EPL-2.0
11
12 Contributors:
13 Sopot Cela & Mickael Istria (Red Hat Inc). -initial implementation
14 Lucas Bullen (Red Hat Inc.) - Bug 508829, 521382
15 Simon Scholz <simon.scholz@vogella.com> - Bug 527834
16 -->
1517 <plugin>
1618 <extension
1719 point="org.eclipse.core.contenttype.contentTypes">
4648 </presentationReconciler>
4749 </extension>
4850 <extension
49 point="org.eclipse.ui.genericeditor.reconcilers">
50 <reconciler
51 point="org.eclipse.ui.genericeditor.foldingReconcilers">
52 <foldingReconciler
5153 class="org.eclipse.ui.genericeditor.examples.dotproject.FoldingReconciler"
5254 contentType="org.eclipse.ui.genericeditor.examples.dotproject">
53 </reconciler>
54 <reconciler
55 class="org.eclipse.ui.genericeditor.examples.dotproject.BracketMatchingReconciler"
56 contentType="org.eclipse.ui.genericeditor.examples.dotproject">
57 </reconciler>
55 </foldingReconciler>
5856 </extension>
5957 <extension
6058 point="org.eclipse.ui.editors">
9492 targetId="org.eclipse.ui.genericeditor.GenericEditor">
9593 </hyperlinkDetector>
9694 </extension>
95 <extension
96 point="org.eclipse.ui.genericeditor.characterPairMatchers">
97 <characterPairMatcher
98 class="org.eclipse.ui.genericeditor.examples.dotproject.TagCharacterPairMatcher"
99 contentType="org.eclipse.ui.genericeditor.examples.dotproject">
100 </characterPairMatcher>
101 </extension>
97102 <!-- ================== CodeMining support for .project ================== -->
98103 <!-- 1) register CodeMining provider with extension point -->
99104 <extension
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.ui</groupId>
1919 <artifactId>org.eclipse.ui.genericeditor.examples</artifactId>
20 <version>1.1.0-SNAPSHOT</version>
20 <version>1.1.100-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
00 /*******************************************************************************
11 * Copyright (c) 2016, 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria, Sopot Cela (Red Hat Inc.)
+0
-91
org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/BracketMatchingReconciler.java less more
0 /*******************************************************************************
1 * Copyright (c) 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
4 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 *
7 * Contributors:
8 * Lucas Bullen (Red Hat Inc.) - initial implementation
9 *******************************************************************************/
10 package org.eclipse.ui.genericeditor.examples.dotproject;
11
12 import org.eclipse.jface.text.BadLocationException;
13 import org.eclipse.jface.text.IDocument;
14 import org.eclipse.jface.text.IRegion;
15 import org.eclipse.jface.text.ITextViewer;
16 import org.eclipse.jface.text.ITextViewerExtension2;
17 import org.eclipse.jface.text.Region;
18 import org.eclipse.jface.text.reconciler.IReconciler;
19 import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
20 import org.eclipse.jface.text.source.ICharacterPairMatcher;
21 import org.eclipse.jface.text.source.MatchingCharacterPainter;
22 import org.eclipse.jface.text.source.SourceViewer;
23 import org.eclipse.swt.graphics.Color;
24 import org.eclipse.swt.graphics.RGBA;
25 import org.eclipse.swt.widgets.Display;
26
27 public class BracketMatchingReconciler implements IReconciler{
28 private RGBA fBoxingRGB = new RGBA(155, 155, 155, 50);
29 private MatchingCharacterPainter fMatchingCharacterPainter;
30 private SourceViewer fSourceViewer;
31 private ICharacterPairMatcher fCharacterPairMatcher = new ICharacterPairMatcher() {
32 @Override
33 public IRegion match(IDocument document, int offset){
34 try {
35 String before = document.get(0, offset);
36 String after = document.get(offset, document.getLength() - offset);
37 int closingIndex = after.indexOf('>');
38 int openingIndex = before.lastIndexOf('<');
39 int previousClosingIndex = after.indexOf('<');
40 int previousOpeningIndex = before.lastIndexOf('>');
41 if((previousClosingIndex != -1 && closingIndex > previousClosingIndex)
42 || (previousOpeningIndex != -1 && openingIndex < previousOpeningIndex)) {
43 return null;
44 }
45 return new Region(openingIndex, offset - openingIndex + closingIndex + 1);
46 } catch (BadLocationException e) {
47 return null;
48 }
49 }
50
51 @Override
52 public int getAnchor() {
53 return ICharacterPairMatcher.RIGHT;
54 }
55
56 @Override
57 public void dispose() {
58 if(fMatchingCharacterPainter != null) {
59 fMatchingCharacterPainter.dispose();
60 }
61 }
62
63 @Override
64 public void clear() {
65 // No memory implemented
66 }
67 };
68
69 @Override
70 public void install(ITextViewer textViewer) {
71 if (textViewer instanceof ITextViewerExtension2 && textViewer instanceof SourceViewer) {
72 fSourceViewer = (SourceViewer)textViewer;
73 fMatchingCharacterPainter = new MatchingCharacterPainter(fSourceViewer, fCharacterPairMatcher);
74 fMatchingCharacterPainter.setColor(new Color (Display.getCurrent(), fBoxingRGB));
75 fMatchingCharacterPainter.setHighlightCharacterAtCaretLocation(true);
76 fMatchingCharacterPainter.setHighlightEnclosingPeerCharacters(true);
77 fSourceViewer.addPainter(fMatchingCharacterPainter);
78 }
79 }
80
81 @Override
82 public void uninstall() {
83 fSourceViewer.removePainter(fMatchingCharacterPainter);
84 }
85
86 @Override
87 public IReconcilingStrategy getReconcilingStrategy(String contentType) {
88 return null;
89 }
90 }
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016, 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria, Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016, 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria, Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Rogue Wave Software Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Michał Niewrzał (Rogue Wave Software Inc.) - initial implementation
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v2.0
4 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v20.html
6 *
7 * Contributors:
8 * Angelo Zerr <angelo.zerr@gmail.com> - Bug 538111 - [generic editor] Extension point for ICharacterPairMatcher
9 */
10 package org.eclipse.ui.genericeditor.examples.dotproject;
11
12 import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
13
14 public class TagCharacterPairMatcher extends DefaultCharacterPairMatcher {
15
16 public TagCharacterPairMatcher() {
17 super(new char[] { '<', '>', '"', '"' });
18 }
19
20 }
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide extension point for CodeMining - Bug 528419
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide extension point for CodeMining - Bug 528419
00 /*******************************************************************************
11 * Copyright (c) 2017 vogella GmbH and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Simon Scholz <simon.scholz@vogella.com> - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 vogella GmbH and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Simon Scholz <simon.scholz@vogella.com> - initial implementation
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Plugin.name
33 Bundle-SymbolicName: org.eclipse.ui.genericeditor.tests;singleton:=true
4 Bundle-Version: 1.1.0.qualifier
4 Bundle-Version: 1.1.100.qualifier
55 Bundle-Vendor: %Plugin.providerName
66 Bundle-Localization: plugin
77 Export-Package: org.eclipse.ui.genericeditor.tests,
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
8 <h2>About This Content</h2>
99
10 <p>June 2, 2006</p>
11 <h3>License</h3>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1212
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
1821
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2016 Red Hat Inc. and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2016 Red Hat Inc. and others
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # Mickael Istria (Red Hat Inc.) - initial API and implementation
11 <?eclipse version="3.4"?>
22 <!-- ====================================================================== -->
33 <!-- Copyright (c) 2016, 2017 Red Hat Inc. and others. -->
4 <!-- All rights reserved. This program and the accompanying materials -->
5 <!-- are made available under the terms of the Eclipse Public License v1.0 -->
4 <!-- This program and the accompanying materials -->
5 <!-- are made available under the terms of the Eclipse Public License 2.0 -->
66 <!-- which accompanies this distribution, and is available at -->
7 <!-- http://www.eclipse.org/legal/epl-v10.html -->
7 <!-- https://www.eclipse.org/legal/epl-2.0/ -->
8 <!-- -->
9 <!-- SPDX-License-Identifier: EPL-2.0 -->
810 <!-- -->
911 <!-- Contributors: -->
1012 <!-- Sopot Cela & Mickael Istria (Red Hat Inc). -initial implementation -->
234236 </highlightReconciler>
235237 </extension>
236238 <extension
239 point="org.eclipse.ui.genericeditor.foldingReconcilers">
240 <foldingReconciler
241 class="org.eclipse.ui.genericeditor.tests.contributions.FoldingReconciler"
242 contentType="org.eclipse.ui.genericeditor.tests.content-type-bar">
243 </foldingReconciler>
244 <foldingReconciler
245 class="org.eclipse.ui.genericeditor.tests.contributions.FoldingReconciler"
246 contentType="org.eclipse.ui.genericeditor.tests.enabled-when-content-type">
247 <enabledWhen>
248 <test
249 forcePluginActivation="true"
250 property="org.eclipse.ui.genericeditor.tests.contributions.enabled">
251 </test>
252 </enabledWhen>
253 </foldingReconciler>
254 </extension>
255 <extension
237256 point="org.eclipse.core.expressions.propertyTesters">
238257 <propertyTester
239258 class="org.eclipse.ui.genericeditor.tests.contributions.EnabledPropertyTester"
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.ui</groupId>
2020 <artifactId>org.eclipse.ui.genericeditor.tests</artifactId>
21 <version>1.1.0-SNAPSHOT</version>
21 <version>1.1.100-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Rogue Wave Software Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Michał Niewrzał (Rogue Wave Software Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria, Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Stephan Wahlbrink and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Stephan Wahlbrink <sw@wahlbrink.eu>
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.)
0 /**
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [generic editor] Default Code folding for generic editor should use IndentFoldingStrategy - Bug 520659
12 */
13 package org.eclipse.ui.genericeditor.tests;
14
15 import java.util.ArrayList;
16 import java.util.Collections;
17 import java.util.Iterator;
18 import java.util.List;
19
20 import org.junit.Assert;
21 import org.junit.Test;
22
23 import org.eclipse.swt.widgets.Display;
24
25 import org.eclipse.jface.text.ITextViewer;
26 import org.eclipse.jface.text.Position;
27 import org.eclipse.jface.text.source.Annotation;
28 import org.eclipse.jface.text.source.IAnnotationModel;
29 import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
30 import org.eclipse.jface.text.source.projection.ProjectionViewer;
31 import org.eclipse.jface.text.tests.util.DisplayHelper;
32
33 import org.eclipse.ui.genericeditor.tests.contributions.EnabledPropertyTester;
34
35 public class FoldingTest extends AbstratGenericEditorTest {
36
37 @Override
38 protected void createAndOpenFile() throws Exception {
39 //leave editor creation to individual tests
40 }
41
42 @Test
43 public void testDefaultIndentFoldingOneFold() throws Exception {
44 createAndOpenFile("bar.xml", "<a>\n b</a>");
45 checkFolding(pos(0, 10));
46 }
47
48 @Test
49 public void testDefaultIndentFoldingTwoFold() throws Exception {
50 createAndOpenFile("bar.xml", "<a>\n <b>\n c\n </b>\n</a>");
51 checkFolding(pos(0, 19), pos(4, 9));
52 }
53
54 @Test
55 public void testCustomFoldingReconciler() throws Exception {
56 createAndOpenFile("bar.txt", "<a>\n <b>\n c\n </b>\n</a>\n");
57 checkFolding(pos(0, 24), pos(5, 14));
58 }
59
60 @Test
61 public void testEnabledWhenCustomFoldingReconciler() throws Exception {
62 EnabledPropertyTester.setEnabled(true);
63 createAndOpenFile("enabledWhen.txt", "<a>\n <b>\n c\n </b>\n</a>\n");
64 checkFolding(pos(0, 24), pos(5, 14));
65 cleanFileAndEditor();
66
67 EnabledPropertyTester.setEnabled(false);
68 createAndOpenFile("enabledWhen.txt", "<a>\n <b>\n c\n </b>\n</a>\n");
69 checkFolding();
70 }
71
72 private static Position pos(int offset, int length) {
73 return new Position(offset, length);
74 }
75
76 private void checkFolding(Position... expectedPositions) {
77 if (expectedPositions == null) {
78 expectedPositions= new Position[0];
79 }
80 waitForAnnotations(expectedPositions.length);
81 List<Annotation> folderAnnotations= getAnnotationsFromAnnotationModel();
82 Assert.assertEquals(expectedPositions.length, folderAnnotations.size());
83 List<Position> actualPositions= new ArrayList<>(expectedPositions.length);
84 for (int i= 0; i < expectedPositions.length; i++) {
85 Annotation folderAnnotation= folderAnnotations.get(i);
86 Position actualPosition= getProjectionAnnotationModel().getPosition(folderAnnotation);
87 actualPositions.add(actualPosition);
88 }
89 // Sort actual positions by offset
90 Collections.sort(actualPositions, (p1, p2) -> p1.offset - p2.offset);
91 Assert.assertArrayEquals(expectedPositions, actualPositions.toArray());
92 }
93
94 private IAnnotationModel getProjectionAnnotationModel() {
95 ProjectionViewer dp= (ProjectionViewer) editor.getAdapter(ITextViewer.class);
96 IAnnotationModel am= dp.getProjectionAnnotationModel();
97 return am;
98 }
99
100 private void waitForAnnotations(int count) {
101 new DisplayHelper() {
102 @Override
103 protected boolean condition() {
104 return getAnnotationsFromAnnotationModel().size() == count;
105 }
106 }.waitForCondition(Display.getDefault(), 2000);
107 }
108
109 private List<Annotation> getAnnotationsFromAnnotationModel() {
110 List<Annotation> annotationList= new ArrayList<>();
111 Iterator<Annotation> annotationIterator= getProjectionAnnotationModel().getAnnotationIterator();
112 while (annotationIterator.hasNext()) {
113 Annotation ann= annotationIterator.next();
114 if (ann.getType().equals(ProjectionAnnotation.TYPE)) {
115 annotationList.add(ann);
116 }
117 }
118 return annotationList;
119 }
120 }
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria, Sopot Cela (Red Hat Inc.)
2124 StylingTest.class,
2225 HoverTest.class,
2326 EditorTest.class,
27 FoldingTest.class,
2428 AutoEditTest.class,
2529 ReconcilerTest.class,
2630 HighlightTest.class
00 /*******************************************************************************
11 * Copyright (c) 2017, 2018 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016, 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria, Sopot Cela (Red Hat Inc.)
6265 public class HoverTest extends AbstratGenericEditorTest {
6366
6467 @Rule
65 public TestName testName = new TestName();
68 public TestName testName= new TestName();
6669
6770 @Before
68 public void skipOnWindows() {
71 public void skipOnNonLinux() {
6972 Assume.assumeFalse("This test currently always fail on Windows (bug 505842), skipping", Platform.OS_WIN32.equals(Platform.getOS()));
73 Assume.assumeFalse("This test currently always fail on macOS (bug 505842), skipping", Platform.OS_MACOSX.equals(Platform.getOS()));
7074 }
7175
7276 @Test
7377 public void testSingleHover() throws Exception {
74 Shell shell = getHoverShell(triggerCompletionAndRetrieveInformationControlManager());
78 Shell shell= getHoverShell(triggerCompletionAndRetrieveInformationControlManager(), true);
7579 assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
7680 assertNull(findControl(shell, StyledText.class, HelloHoverProvider.LABEL));
7781 assertNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
7983
8084 @Test
8185 public void testEnabledWhenHover() throws Exception {
86 cleanFileAndEditor();
8287 EnabledPropertyTester.setEnabled(true);
8388 createAndOpenFile("enabledWhen.txt", "bar 'bar'");
84 Shell shell = getHoverShell(triggerCompletionAndRetrieveInformationControlManager());
89 Shell shell= getHoverShell(triggerCompletionAndRetrieveInformationControlManager(), true);
8590 assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
8691 assertNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
92
8793 cleanFileAndEditor();
88
8994 EnabledPropertyTester.setEnabled(false);
9095 createAndOpenFile("enabledWhen.txt", "bar 'bar'");
91 shell = getHoverShell(triggerCompletionAndRetrieveInformationControlManager());
96 shell= getHoverShell(triggerCompletionAndRetrieveInformationControlManager(), true);
9297 assertNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
9398 assertNotNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
9499 }
101106 public void testMultipleHover() throws Exception {
102107 cleanFileAndEditor();
103108 createAndOpenFile("bar.txt", "Hi");
104 Shell shell = getHoverShell(triggerCompletionAndRetrieveInformationControlManager());
109 Shell shell= getHoverShell(triggerCompletionAndRetrieveInformationControlManager(), true);
105110 assertNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
106111 assertNotNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
107112 assertNotNull(findControl(shell, StyledText.class, HelloHoverProvider.LABEL));
109114
110115 @Test
111116 public void testProblemHover() throws Exception {
112 String problemMessage = "Huston...";
113 IMarker marker = null;
117 String problemMessage= "Huston...";
118 IMarker marker= null;
114119 try {
115 marker = this.file.createMarker(IMarker.PROBLEM);
120 marker= this.file.createMarker(IMarker.PROBLEM);
116121 marker.setAttribute(IMarker.LINE_NUMBER, 1);
117122 marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
118123 marker.setAttribute(IMarker.CHAR_START, 0);
119124 marker.setAttribute(IMarker.CHAR_END, 5);
120125 marker.setAttribute(IMarker.MESSAGE, problemMessage);
121126 marker.setAttribute(MarkerResolutionGenerator.FIXME, true);
122 AbstractInformationControlManager manager = triggerCompletionAndRetrieveInformationControlManager();
123 Object hoverData = getHoverData(manager);
127 AbstractInformationControlManager manager= triggerCompletionAndRetrieveInformationControlManager();
128 Object hoverData= getHoverData(manager);
124129 assertTrue(hoverData instanceof Map);
125 assertTrue(((Map<?,?>)hoverData).containsValue(Collections.singletonList(marker)));
126 assertTrue(((Map<?,?>)hoverData).containsValue(AlrightyHoverProvider.LABEL));
127 assertFalse(((Map<?,?>)hoverData).containsValue(HelloHoverProvider.LABEL));
130 assertTrue(((Map<?, ?>) hoverData).containsValue(Collections.singletonList(marker)));
131 assertTrue(((Map<?, ?>) hoverData).containsValue(AlrightyHoverProvider.LABEL));
132 assertFalse(((Map<?, ?>) hoverData).containsValue(HelloHoverProvider.LABEL));
128133 // check dialog content
129 Shell shell= getHoverShell(manager);
134 Shell shell= getHoverShell(manager, true);
130135 assertNotNull(findControl(shell, Label.class, marker.getAttribute(IMarker.MESSAGE, "NONE")));
131136 assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
132137 assertNull(findControl(shell, StyledText.class, HelloHoverProvider.LABEL));
133138 // check quick-fix works
134 Link link = findControl(shell, Link.class, MarkerResolutionGenerator.FIXME);
139 Link link= findControl(shell, Link.class, MarkerResolutionGenerator.FIXME);
135140 assertNotNull(link);
136 Event event = new Event();
137 event.widget = link;
138 event.display = link.getDisplay();
139 event.doit = true;
140 event.type = SWT.Selection;
141 Event event= new Event();
142 event.widget= link;
143 event.display= link.getDisplay();
144 event.doit= true;
145 event.type= SWT.Selection;
141146 link.notifyListeners(SWT.Selection, event);
142 final IMarker m = marker;
147 final IMarker m= marker;
143148 new DisplayHelper() {
144149 @Override
145150 protected boolean condition() {
154159 }
155160 }
156161
157 private Shell getHoverShell(AbstractInformationControlManager manager) {
158 AbstractInformationControl[] control = { null };
159 new DisplayHelper() {
160 @Override
161 protected boolean condition() {
162 control[0] = (AbstractInformationControl)new Accessor(manager, AbstractInformationControlManager.class).get("fInformationControl");
162 private Shell getHoverShell(AbstractInformationControlManager manager, boolean failOnError) {
163 AbstractInformationControl[] control= { null };
164 new DisplayHelper() {
165 @Override
166 protected boolean condition() {
167 control[0]= (AbstractInformationControl) new Accessor(manager, AbstractInformationControlManager.class).get("fInformationControl");
163168 return control[0] != null;
164169 }
165170 }.waitForCondition(this.editor.getSite().getShell().getDisplay(), 5000);
166171 if (control[0] == null) {
167 ScreenshotTest.takeScreenshot(getClass(), testName.getMethodName(), System.out);
168 fail();
169 }
170 Shell shell = (Shell)new Accessor(control[0], AbstractInformationControl.class).get("fShell");
172 if (failOnError) {
173 ScreenshotTest.takeScreenshot(getClass(), testName.getMethodName(), System.out);
174 fail();
175 } else {
176 return null;
177 }
178 }
179 Shell shell= (Shell) new Accessor(control[0], AbstractInformationControl.class).get("fShell");
171180 new DisplayHelper() {
172181 @Override
173182 protected boolean condition() {
174183 return shell.isVisible();
175184 }
176185 }.waitForCondition(this.editor.getSite().getShell().getDisplay(), 2000);
177 assertTrue(shell.isVisible());
186 if (failOnError) {
187 assertTrue(shell.isVisible());
188 }
178189 return shell;
179190 }
180191
181192 private <T extends Control> T findControl(Control control, Class<T> controlType, String label) {
182193 if (control.getClass() == controlType) {
183194 @SuppressWarnings("unchecked")
184 T res = (T) control;
195 T res= (T) control;
185196 if (label == null) {
186197 return res;
187198 }
188 String controlLabel = null;
199 String controlLabel= null;
189200 if (control instanceof Label) {
190 controlLabel = ((Label)control).getText();
201 controlLabel= ((Label) control).getText();
191202 } else if (control instanceof Link) {
192 controlLabel = ((Link) control).getText();
203 controlLabel= ((Link) control).getText();
193204 } else if (control instanceof Text) {
194 controlLabel = ((Text) control).getText();
205 controlLabel= ((Text) control).getText();
195206 } else if (control instanceof StyledText) {
196 controlLabel = ((StyledText) control).getText();
207 controlLabel= ((StyledText) control).getText();
197208 }
198209 if (controlLabel != null && controlLabel.contains(label)) {
199210 return res;
200211 }
201212 } else if (control instanceof Composite) {
202213 for (Control child : ((Composite) control).getChildren()) {
203 T res = findControl(child, controlType, label);
214 T res= findControl(child, controlType, label);
204215 if (res != null) {
205216 return res;
206217 }
209220 return null;
210221 }
211222
212 private Object getHoverData(AbstractInformationControlManager manager) throws Exception {
213 Object hoverData = new Accessor(manager, AbstractInformationControlManager.class).get("fInformation");
223 private Object getHoverData(AbstractInformationControlManager manager) {
224 Object hoverData= new Accessor(manager, AbstractInformationControlManager.class).get("fInformation");
214225 return hoverData;
215226 }
216227
217228 private AbstractInformationControlManager triggerCompletionAndRetrieveInformationControlManager() {
218 this.editor.selectAndReveal(2, 0);
219 final StyledText editorTextWidget = (StyledText) this.editor.getAdapter(Control.class);
220 new DisplayHelper() {
221 @Override
222 protected boolean condition() {
223 return editorTextWidget.isFocusControl() && editorTextWidget.getSelection().x == 2;
224 }
225 }.waitForCondition(editorTextWidget.getDisplay(), 1000);
229 final int caretLocation= 2;
230 this.editor.selectAndReveal(caretLocation, 0);
231 final StyledText editorTextWidget= (StyledText) this.editor.getAdapter(Control.class);
232 new DisplayHelper() {
233 @Override
234 protected boolean condition() {
235 return editorTextWidget.isFocusControl() && editorTextWidget.getSelection().x == caretLocation;
236 }
237 }.waitForCondition(editorTextWidget.getDisplay(), 3000);
226238 // sending event to trigger hover computation
227239 editorTextWidget.getShell().forceActive();
228240 editorTextWidget.getShell().setActive();
229241 editorTextWidget.getShell().setFocus();
230242 editorTextWidget.getShell().getDisplay().wake();
231 Event hoverEvent = new Event();
232 hoverEvent.widget = editorTextWidget;
233 hoverEvent.type = SWT.MouseHover;
234 hoverEvent.x = editorTextWidget.getClientArea().x + 5;
235 hoverEvent.y = editorTextWidget.getClientArea().y + 5;
236 hoverEvent.display = editorTextWidget.getDisplay();
237 hoverEvent.doit = true;
243 Event hoverEvent= new Event();
244 hoverEvent.widget= editorTextWidget;
245 hoverEvent.type= SWT.MouseHover;
246 hoverEvent.x= editorTextWidget.getClientArea().x + 5;
247 hoverEvent.y= editorTextWidget.getClientArea().y + 5;
248 hoverEvent.display= editorTextWidget.getDisplay();
249 hoverEvent.doit= true;
238250 editorTextWidget.getDisplay().setCursorLocation(editorTextWidget.toDisplay(hoverEvent.x, hoverEvent.y));
239251 editorTextWidget.notifyListeners(SWT.MouseHover, hoverEvent);
240 // Events need to be processed for hover listener to work correctly
241 DisplayHelper.sleep(editorTextWidget.getDisplay(), 1000);
252 ITextViewer viewer= (ITextViewer) new Accessor(editor, AbstractTextEditor.class).invoke("getSourceViewer", new Object[0]);
253 AbstractInformationControlManager textHoverManager= (AbstractInformationControlManager) new Accessor(viewer, TextViewer.class).get("fTextHoverManager");
242254 // retrieving hover content
243 ITextViewer viewer = (ITextViewer)new Accessor(editor, AbstractTextEditor.class).invoke("getSourceViewer", new Object[0]);
244 AbstractInformationControlManager textHoverManager = (AbstractInformationControlManager)new Accessor(viewer, TextViewer.class).get("fTextHoverManager");
255 new DisplayHelper() {
256 @Override
257 protected boolean condition() {
258 return getHoverData(textHoverManager) != null;
259 }
260 }.waitForCondition(hoverEvent.display, 6000);
245261 return textHoverManager;
246262 }
247
248263 }
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2018 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
0 /*******************************************************************************
1 * Copyright (c) 2017 Red Hat Inc. and others
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Lucas Bullen (Red Hat Inc.) - initial implementation
12 *******************************************************************************/
13 package org.eclipse.ui.genericeditor.tests.contributions;
14
15 import org.eclipse.jface.text.IDocument;
16 import org.eclipse.jface.text.ITextViewer;
17 import org.eclipse.jface.text.reconciler.Reconciler;
18 import org.eclipse.jface.text.source.projection.ProjectionViewer;
19
20 public class FoldingReconciler extends Reconciler {
21
22 private FoldingStrategy fStrategy;
23
24 public FoldingReconciler() {
25 fStrategy = new FoldingStrategy();
26 this.setReconcilingStrategy(fStrategy, IDocument.DEFAULT_CONTENT_TYPE);
27 }
28
29 @Override
30 public void install(ITextViewer textViewer) {
31 super.install(textViewer);
32 ProjectionViewer pViewer =(ProjectionViewer)textViewer;
33 fStrategy.setProjectionViewer(pViewer);
34 }
35 }
0 /*******************************************************************************
1 * Copyright (c) 2017 Red Hat Inc. and others
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Lucas Bullen (Red Hat Inc.) - initial implementation
12 *******************************************************************************/
13 package org.eclipse.ui.genericeditor.tests.contributions;
14
15 import java.util.ArrayList;
16 import java.util.HashMap;
17 import java.util.List;
18 import java.util.Map;
19
20 import org.eclipse.core.runtime.IProgressMonitor;
21 import org.eclipse.jface.text.BadLocationException;
22 import org.eclipse.jface.text.IDocument;
23 import org.eclipse.jface.text.IRegion;
24 import org.eclipse.jface.text.Position;
25 import org.eclipse.jface.text.reconciler.DirtyRegion;
26 import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
27 import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
28 import org.eclipse.jface.text.source.Annotation;
29 import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
30 import org.eclipse.jface.text.source.projection.ProjectionViewer;
31
32 public class FoldingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension {
33
34 private IDocument document;
35 private String oldDocument;
36 private ProjectionViewer projectionViewer;
37 private List<Annotation> oldAnnotations = new ArrayList<>();
38 private List<Position> oldPositions = new ArrayList<>();
39
40 @Override
41 public void setDocument(IDocument document) {
42 this.document = document;
43 }
44
45 public void setProjectionViewer(ProjectionViewer projectionViewer) {
46 this.projectionViewer = projectionViewer;
47 }
48
49 @Override
50 public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
51 initialReconcile();
52 }
53
54 @Override
55 public void reconcile(IRegion partition) {
56 initialReconcile();
57 }
58
59 @Override
60 public void initialReconcile() {
61 if(document.get().equals(oldDocument)) return;
62 oldDocument = document.get();
63
64 List<Position> positions = getNewPositionsOfAnnotations();
65
66 List<Position> positionsToRemove = new ArrayList<>();
67 List<Annotation> annotationToRemove = new ArrayList<>();
68
69 for (Position position : oldPositions) {
70 if(!positions.contains(position)) {
71 projectionViewer.getProjectionAnnotationModel().removeAnnotation(oldAnnotations.get(oldPositions.indexOf(position)));
72 positionsToRemove.add(position);
73 annotationToRemove.add(oldAnnotations.get(oldPositions.indexOf(position)));
74 }else {
75 positions.remove(position);
76 }
77 }
78 oldPositions.removeAll(positionsToRemove);
79 oldAnnotations.removeAll(annotationToRemove);
80
81 for (Position position : positions) {
82 Annotation annotation = new ProjectionAnnotation();
83 projectionViewer.getProjectionAnnotationModel().addAnnotation(annotation, position);
84 oldPositions.add(position);
85 oldAnnotations.add(annotation);
86 }
87 }
88
89 private static enum SearchingFor {
90 START_OF_TAG, START_OF_WORD, END_OF_WORD, END_OF_LINE
91 }
92
93 private List<Position> getNewPositionsOfAnnotations(){
94 List<Position> positions = new ArrayList<>();
95 Map<String, Integer> startOfAnnotation = new HashMap<>();
96 SearchingFor searchingFor = SearchingFor.START_OF_TAG;
97
98 int characters = document.getLength();
99 int currentCharIndex = 0;
100
101 int wordStartIndex = 0;
102 int sectionStartIndex = 0;
103 String word = "";
104
105 try {
106 while (currentCharIndex < characters) {
107 char currentChar = document.getChar(currentCharIndex);
108 switch (searchingFor) {
109 case START_OF_TAG:
110 if(currentChar == '<') {
111 char nextChar = document.getChar(currentCharIndex+1);
112 if(nextChar != '?') {
113 sectionStartIndex = currentCharIndex;
114 searchingFor = SearchingFor.START_OF_WORD;
115 }
116 }
117 break;
118 case START_OF_WORD:
119 if(Character.isLetter(currentChar)) {
120 wordStartIndex = currentCharIndex;
121 searchingFor = SearchingFor.END_OF_WORD;
122 }
123 break;
124 case END_OF_WORD:
125 if(!Character.isLetter(currentChar)) {
126 word = document.get(wordStartIndex, currentCharIndex - wordStartIndex);
127 if(startOfAnnotation.containsKey(word)) {
128 searchingFor = SearchingFor.END_OF_LINE;
129 }else {
130 startOfAnnotation.put(word, sectionStartIndex);
131 searchingFor = SearchingFor.START_OF_TAG;
132 }
133 }
134 break;
135 case END_OF_LINE:
136 if(currentChar == '\n') {
137 int start = startOfAnnotation.get(word);
138 if(document.getLineOfOffset(start) != document.getLineOfOffset(currentCharIndex)) {
139 positions.add(new Position(start,currentCharIndex + 1 - start));
140 }
141 startOfAnnotation.remove(word);
142 searchingFor = SearchingFor.START_OF_TAG;
143 }
144 break;
145 }
146 currentCharIndex++;
147 }
148 } catch (BadLocationException e) {
149 // skip the remainder of file due to error
150 }
151 return positions;
152 }
153
154 @Override
155 public void setProgressMonitor(IProgressMonitor monitor) {
156 // no progress monitor used
157 }
158
159 }
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Lucas Bullen (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * - Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Rogue Wave Software Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Michał Niewrzał (Rogue Wave Software Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Rogue Wave Software Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Michał Niewrzał (Rogue Wave Software Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Rogue Wave Software Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Michał Niewrzał (Rogue Wave Software Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016-2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2016 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Sopot Cela (Red Hat Inc.)
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.) - initial implementation
00 /*******************************************************************************
11 * Copyright (c) 2017 Red Hat Inc. and others
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Lucas Bullen (Red Hat Inc.)
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %pluginName
33 Bundle-SymbolicName: org.eclipse.ui.workbench.texteditor; singleton:=true
4 Bundle-Version: 3.11.0.qualifier
4 Bundle-Version: 3.11.100.qualifier
55 Bundle-Activator: org.eclipse.ui.internal.texteditor.TextEditorPlugin
66 Bundle-ActivationPolicy: lazy
77 Bundle-Vendor: %providerName
1414 org.eclipse.ui.internal.texteditor.quickdiff.compare.equivalence;x-internal:=true,
1515 org.eclipse.ui.internal.texteditor.rulers;x-internal:=true,
1616 org.eclipse.ui.internal.texteditor.spelling;x-internal:=true,
17 org.eclipse.ui.internal.views.minimap;x-internal:=true,
1718 org.eclipse.ui.texteditor; texteditor="split"; mandatory:="texteditor",
1819 org.eclipse.ui.texteditor.link,
1920 org.eclipse.ui.texteditor.quickdiff,
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2015 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
192195
193196 blockSelectionModeFont.label= Text Editor Block Selection Font
194197 blockSelectionModeFont.description= The block selection mode font is used by text editors in block (column) mode. A monospace font should be used.
198
199 MinimapView.name=Minimap
13371337 </command>
13381338 </menuContribution>
13391339 </extension>
1340
1341 <extension
1342 point="org.eclipse.ui.views">
1343 <view
1344 category="org.eclipse.ui"
1345 class="org.eclipse.ui.internal.views.minimap.MinimapView"
1346 icon="icons/full/eview16/minimap.png"
1347 id="org.eclipse.ui.views.minimap.MinimapView"
1348 name="%MinimapView.name"
1349 allowMultiple="false"
1350 restorable="true">
1351 </view>
1352 </extension>
13401353 </plugin>
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <groupId>org.eclipse.ui</groupId>
1919 <artifactId>org.eclipse.ui.workbench.texteditor</artifactId>
20 <version>3.11.0-SNAPSHOT</version>
20 <version>3.11.100-SNAPSHOT</version>
2121 <packaging>eclipse-plugin</packaging>
2222 </project>
163163 </appInfo>
164164 <documentation>
165165 Copyright (c) 2017 Angelo ZERR.&lt;br&gt;
166 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
166
167 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
168
169 SPDX-License-Identifier: EPL-2.0
167170 </documentation>
168171 </annotation>
169172
144144 </appInfo>
145145 <documentation>
146146 Copyright (c) 2007 IBM Corporation and others.&lt;br&gt;
147 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
147
148 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
149
150 SPDX-License-Identifier: EPL-2.0
148151 </documentation>
149152 </annotation>
150153
161161 </appInfo>
162162 <documentation>
163163 Copyright (c) 2007, 2008 IBM Corporation and others.&lt;br&gt;
164 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
164
165 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
166
167 SPDX-License-Identifier: EPL-2.0
165168 </documentation>
166169 </annotation>
167170
146146 </appInfo>
147147 <documentation>
148148 Copyright (c) 2001, 2005 IBM Corporation and others.&lt;br&gt;
149 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
149
150 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
151
152 SPDX-License-Identifier: EPL-2.0
150153 </documentation>
151154 </annotation>
152155
303303 </appInfo>
304304 <documentation>
305305 Copyright (c) 2006, 2008 IBM Corporation and others.&lt;br&gt;
306 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
306
307 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
308
309 SPDX-License-Identifier: EPL-2.0
307310 </documentation>
308311 </annotation>
309312
150150 </appInfo>
151151 <documentation>
152152 Copyright (c) 2001, 2005 IBM Corporation and others.&lt;br&gt;
153 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
153
154 This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
155
156 SPDX-License-Identifier: EPL-2.0
154157 </documentation>
155158 </annotation>
156159
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
912 *******************************************************************************/
1013 package org.eclipse.ui.contentassist;
1114
12 import org.eclipse.swt.events.DisposeEvent;
13 import org.eclipse.swt.events.DisposeListener;
1415 import org.eclipse.swt.events.FocusEvent;
1516 import org.eclipse.swt.events.FocusListener;
1617 import org.eclipse.swt.widgets.Combo;
112113 fContentAssistant= contentAssistant;
113114 fContentAssistSubjectAdapter= subjectAdapter;
114115 setEnabled(true);
115 fControl.addDisposeListener(new DisposeListener() {
116 @Override
117 public void widgetDisposed(DisposeEvent e) {
118 setEnabled(false);
119 }
120 });
116 fControl.addDisposeListener(e -> setEnabled(false));
121117 }
122118
123119 /**
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2007 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Genady Beryozkin, me@genady.org - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide extension point for CodeMining - Bug 528419
00 /**
11 * Copyright (c) 2017 Angelo ZERR.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Angelo Zerr <angelo.zerr@gmail.com> - [CodeMining] Provide extension point for CodeMining - Bug 528419
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
212215 * @since 3.2
213216 */
214217 private final IDocumentRewriteSessionListener fSessionListener= new IDocumentRewriteSessionListener() {
218
219 /**
220 * <code>true</code> if this line differ was suspended because of a
221 * {@link DocumentRewriteSessionEvent#SESSION_START session start} and
222 * needs to be resumed after a
223 * {@link DocumentRewriteSessionEvent#SESSION_STOP session stop} event,
224 * <code>false</code> otherwise.
225 */
226 private boolean fResumeOnRewriteSessionStop;
227
215228 @Override
216229 public void documentRewriteSessionChanged(DocumentRewriteSessionEvent event) {
217230 if (event.getSession().getSessionType() == DocumentRewriteSessionType.UNRESTRICTED_SMALL)
218231 return;
219 if (DocumentRewriteSessionEvent.SESSION_START.equals(event.getChangeType()))
232 if (DocumentRewriteSessionEvent.SESSION_START.equals(event.getChangeType())) {
233 fResumeOnRewriteSessionStop = !isSuspended();
220234 suspend();
221 else if (DocumentRewriteSessionEvent.SESSION_STOP.equals(event.getChangeType()))
235 }
236 else if (fResumeOnRewriteSessionStop
237 && DocumentRewriteSessionEvent.SESSION_STOP.equals(event.getChangeType())) {
222238 resume();
239 fResumeOnRewriteSessionStop= false;
240 }
241
223242 }
224243 };
225244
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2006, 2007 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2007 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 *******************************************************************************/
13 package org.eclipse.ui.internal.views.minimap;
14
15 import org.eclipse.osgi.util.NLS;
16
17 /**
18 * MinimapMessages is the message class for the messages used in the minimap.
19 *
20 */
21 public class MinimapMessages extends NLS {
22 private static final String BUNDLE_NAME = "org.eclipse.ui.internal.views.minimap.MinimapMessages";//$NON-NLS-1$
23
24 // ==============================================================================
25 // Minimap View
26 // ==============================================================================
27 /** */
28 public static String MinimapViewNoMinimap;
29
30 static {
31 // load message values from bundle file
32 NLS.initializeMessages(BUNDLE_NAME, MinimapMessages.class);
33 }
34 }
0 ###############################################################################
1 # Copyright (c) 2018 Angelo ZERR.
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
5 # which accompanies this distribution, and is available at
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
9 #
10 # Contributors:
11 # Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 ###############################################################################
13
14 # ==============================================================================
15 # Minimap View
16 # ==============================================================================
17 MinimapViewNoMinimap=A minimap is not available.
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 *******************************************************************************/
13 package org.eclipse.ui.internal.views.minimap;
14
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.Control;
17
18 import org.eclipse.jface.text.ITextOperationTarget;
19 import org.eclipse.jface.text.ITextViewer;
20
21 import org.eclipse.ui.part.Page;
22
23 import org.eclipse.ui.texteditor.ITextEditor;
24
25 /**
26 * Minimap page which displays scaled content of the given text editor.
27 *
28 */
29 public class MinimapPage extends Page {
30
31 /**
32 * Try to create a MinimapPage for a text editor. Only succeeds if the
33 * {@link ITextViewer} for the editor can be determined.
34 *
35 * @param textEditor
36 * the {@link ITextEditor} for which the page should be created.
37 * @return the created MinimapPage or <code>null</code>
38 */
39 public static MinimapPage createMinimapPage(ITextEditor textEditor) {
40 ITextViewer textViewer = textEditor.getAdapter(ITextViewer.class);
41 if (textViewer == null) {
42 // try fallback that sometimes works (TextViewer implements
43 // ITextOperationTarget)
44 ITextOperationTarget textOperationTarget = textEditor.getAdapter(ITextOperationTarget.class);
45 if (textOperationTarget instanceof ITextViewer) {
46 textViewer = (ITextViewer) textOperationTarget;
47 }
48 }
49 if (textViewer == null) {
50 return null;
51 }
52 return new MinimapPage(textViewer);
53 }
54
55 private final ITextViewer fEditorViewer;
56 private MinimapWidget fMinimapWidget;
57
58 private MinimapPage(ITextViewer textViewer) {
59 fEditorViewer = textViewer;
60 }
61
62 @Override
63 public void createControl(Composite parent) {
64 // Create minimap styled text
65 fMinimapWidget = new MinimapWidget(parent, fEditorViewer);
66 fMinimapWidget.install();
67 }
68
69 @Override
70 public Control getControl() {
71 return fMinimapWidget.getControl();
72 }
73
74 @Override
75 public void setFocus() {
76 fMinimapWidget.getControl().setFocus();
77 }
78
79 @Override
80 public void dispose() {
81 fMinimapWidget.uninstall();
82 super.dispose();
83 }
84 }
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 *******************************************************************************/
13 package org.eclipse.ui.internal.views.minimap;
14
15 import org.eclipse.ui.IWorkbenchPage;
16 import org.eclipse.ui.IWorkbenchPart;
17 import org.eclipse.ui.part.IPage;
18 import org.eclipse.ui.part.MessagePage;
19 import org.eclipse.ui.part.MultiPageEditorPart;
20 import org.eclipse.ui.part.Page;
21 import org.eclipse.ui.part.PageBook;
22 import org.eclipse.ui.part.PageBookView;
23 import org.eclipse.ui.part.PageSite;
24
25 import org.eclipse.ui.texteditor.ITextEditor;
26
27 /**
28 * Minimap view used to display content of current text editor with scale.
29 *
30 */
31 public class MinimapView extends PageBookView {
32
33 private String defaultText;
34
35 public MinimapView() {
36 this.defaultText = MinimapMessages.MinimapViewNoMinimap;
37 }
38
39 @Override
40 protected IPage createDefaultPage(PageBook book) {
41 MessagePage page = new MessagePage();
42 this.initPage(page);
43 page.createControl(book);
44 page.setMessage(this.defaultText);
45 return page;
46 }
47
48 @Override
49 protected PageRec doCreatePage(IWorkbenchPart part) {
50 Page page = createMinimapPage(part);
51 if (page == null) {
52 return null;
53 }
54 PageSite site = new PageSite(this.getViewSite());
55 page.init(site);
56 page.createControl(this.getPageBook());
57 return new PageBookView.PageRec(part, page);
58 }
59
60 private Page createMinimapPage(IWorkbenchPart part) {
61 if (part instanceof MultiPageEditorPart) {
62 return new MultiPageMinimapPage((MultiPageEditorPart) part);
63 }
64 return MinimapPage.createMinimapPage((ITextEditor) part);
65 }
66
67 @Override
68 protected void doDestroyPage(IWorkbenchPart part, PageRec rec) {
69 IPage page = rec.page;
70 page.dispose();
71 rec.dispose();
72 }
73
74 @Override
75 protected IWorkbenchPart getBootstrapPart() {
76 IWorkbenchPage page = this.getSite().getPage();
77 return page != null ? page.getActiveEditor() : null;
78 }
79
80 @Override
81 protected boolean isImportant(IWorkbenchPart part) {
82 return part instanceof ITextEditor || part instanceof MultiPageEditorPart;
83 }
84
85 @Override
86 public void partBroughtToTop(IWorkbenchPart part) {
87 partActivated(part);
88 }
89 }
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 * Arne Deutsch <arne.deutsch@itemis.de> - Correct view height - Bug 536207
13 *******************************************************************************/
14 package org.eclipse.ui.internal.views.minimap;
15
16 import java.util.ArrayList;
17 import java.util.HashMap;
18 import java.util.Iterator;
19 import java.util.List;
20 import java.util.Map;
21
22 import org.eclipse.swt.SWT;
23 import org.eclipse.swt.custom.CaretEvent;
24 import org.eclipse.swt.custom.CaretListener;
25 import org.eclipse.swt.custom.StyleRange;
26 import org.eclipse.swt.custom.StyledText;
27 import org.eclipse.swt.custom.TextChangeListener;
28 import org.eclipse.swt.custom.TextChangedEvent;
29 import org.eclipse.swt.custom.TextChangingEvent;
30 import org.eclipse.swt.events.ControlEvent;
31 import org.eclipse.swt.events.ControlListener;
32 import org.eclipse.swt.events.MouseEvent;
33 import org.eclipse.swt.events.MouseWheelListener;
34 import org.eclipse.swt.events.PaintEvent;
35 import org.eclipse.swt.events.PaintListener;
36 import org.eclipse.swt.events.SelectionEvent;
37 import org.eclipse.swt.events.SelectionListener;
38 import org.eclipse.swt.graphics.Font;
39 import org.eclipse.swt.graphics.FontData;
40 import org.eclipse.swt.graphics.GC;
41 import org.eclipse.swt.graphics.Point;
42 import org.eclipse.swt.graphics.Rectangle;
43 import org.eclipse.swt.widgets.Composite;
44 import org.eclipse.swt.widgets.Control;
45
46 import org.eclipse.core.runtime.IStatus;
47 import org.eclipse.core.runtime.Status;
48
49 import org.eclipse.jface.text.IDocument;
50 import org.eclipse.jface.text.IRegion;
51 import org.eclipse.jface.text.ITextInputListener;
52 import org.eclipse.jface.text.ITextPresentationListener;
53 import org.eclipse.jface.text.ITextViewer;
54 import org.eclipse.jface.text.ITextViewerExtension4;
55 import org.eclipse.jface.text.ITextViewerExtension5;
56 import org.eclipse.jface.text.IViewportListener;
57 import org.eclipse.jface.text.JFaceTextUtil;
58 import org.eclipse.jface.text.Region;
59 import org.eclipse.jface.text.TextPresentation;
60 import org.eclipse.jface.text.TextViewer;
61
62 import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
63
64 /**
65 * Minimap widget which displays scaled content of the given text editor.
66 *
67 */
68 public class MinimapWidget {
69
70 private static final float SCALE = 0.2f;
71
72 private final ITextViewer fEditorViewer;
73
74 private final StyledText fMinimapTextWidget;
75
76 /**
77 * Editor tracker used to track text changed and styles changes of the
78 * editor content.
79 */
80 class EditorTracker implements TextChangeListener, ControlListener, ITextPresentationListener, ITextInputListener,
81 IViewportListener {
82
83 private Map<Font, Font> fScaledFonts;
84
85 @Override
86 public void textSet(TextChangedEvent event) {
87 synchText();
88 }
89
90 @Override
91 public void textChanging(TextChangingEvent event) {
92 try {
93 fMinimapTracker.replaceTextRange(event);
94 } catch (Exception e) {
95 IStatus status = new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK,
96 "Minimap text content synchronization failed", e); //$NON-NLS-1$
97 TextEditorPlugin.getDefault().getLog().log(status);
98 synchText();
99 }
100 }
101
102 @Override
103 public void textChanged(TextChangedEvent event) {
104 updateMinimapAfterTextChange();
105 }
106
107 @Override
108 public void applyTextPresentation(TextPresentation presentation) {
109 try {
110 addPresentation(presentation);
111 } catch (Exception e) {
112 synchTextAndStyles();
113 IStatus status = new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK,
114 "Minimap styles synchronization failed", e); //$NON-NLS-1$
115 TextEditorPlugin.getDefault().getLog().log(status);
116 }
117 }
118
119 private StyleRange modelStyleRange2WidgetStyleRange(StyleRange range) {
120 IRegion region = modelRange2WidgetRange(new Region(range.start, range.length));
121 if (region != null) {
122 StyleRange result = (StyleRange) range.clone();
123 result.start = region.getOffset();
124 result.length = region.getLength();
125 return result;
126 }
127 return null;
128 }
129
130 private IRegion modelRange2WidgetRange(IRegion region) {
131 if (fEditorViewer instanceof ITextViewerExtension5) {
132 ITextViewerExtension5 extension = (ITextViewerExtension5) fEditorViewer;
133 return extension.modelRange2WidgetRange(region);
134 }
135 if (fEditorViewer instanceof TextViewer) {
136 return ((TextViewer) fEditorViewer).modelRange2WidgetRange(region);
137 }
138 IRegion visibleRegion = fEditorViewer.getVisibleRegion();
139 int start = region.getOffset() - visibleRegion.getOffset();
140 int end = start + region.getLength();
141 if (end > visibleRegion.getLength())
142 end = visibleRegion.getLength();
143
144 return new Region(start, end - start);
145 }
146
147 private void addPresentation(TextPresentation presentation) {
148
149 StyleRange range = presentation.getDefaultStyleRange();
150 if (range != null) {
151
152 range = modelStyleRange2WidgetStyleRange(range);
153 if (range != null) {
154 updateStyle(range);
155 fMinimapTextWidget.setStyleRange(range);
156 }
157 List<StyleRange> ranges = new ArrayList<>(presentation.getDenumerableRanges());
158 Iterator<StyleRange> e = presentation.getNonDefaultStyleRangeIterator();
159 while (e.hasNext()) {
160 range = e.next();
161 range = modelStyleRange2WidgetStyleRange(range);
162 if (range != null) {
163 updateStyle(range);
164 ranges.add(range);
165 }
166 }
167
168 if (!ranges.isEmpty()) {
169 fMinimapTextWidget.replaceStyleRanges(0, 0, ranges.toArray(new StyleRange[ranges.size()]));
170 }
171
172 } else {
173 IRegion region = modelRange2WidgetRange(presentation.getCoverage());
174 if (region == null)
175 return;
176
177 List<StyleRange> list = new ArrayList<>(presentation.getDenumerableRanges());
178 Iterator<StyleRange> e = presentation.getAllStyleRangeIterator();
179 while (e.hasNext()) {
180 range = e.next();
181 range = modelStyleRange2WidgetStyleRange(range);
182 if (range != null) {
183 updateStyle(range);
184 list.add(range);
185 }
186 }
187
188 if (!list.isEmpty()) {
189 StyleRange[] ranges = new StyleRange[list.size()];
190 list.toArray(ranges);
191 fMinimapTextWidget.replaceStyleRanges(region.getOffset(), region.getLength(), ranges);
192 }
193 }
194 }
195
196 void updateStyle(StyleRange range) {
197 // scale the font
198 range.font = getScaledFont(range.font);
199 // remove GlyphMetrics (created by code mining)
200 range.metrics = null;
201 }
202
203 Font getScaledFont(Font editorFont) {
204 if (editorFont == null) {
205 return null;
206 }
207 Font scaledFont = fScaledFonts.get(editorFont);
208 if (scaledFont != null) {
209 return scaledFont;
210 }
211 FontData[] fontData = editorFont.getFontData();
212 FontData fontDatum = fontData[0];
213
214 scaledFont = new Font(editorFont.getDevice(), fontDatum.getName(),
215 (int) Math.ceil(fontDatum.getHeight() * getScale()), fontDatum.getStyle());
216 fScaledFonts.put(editorFont, scaledFont);
217 return scaledFont;
218 }
219
220 @Override
221 public void controlMoved(ControlEvent e) {
222 // Do nothing
223 }
224
225 @Override
226 public void controlResized(ControlEvent e) {
227 updateMinimapAfterResize();
228 }
229
230 @Override
231 public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
232 if (oldInput != newInput) {
233 synchTextAndStyles();
234 }
235 }
236
237 @Override
238 public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
239 // Do nothing
240 }
241
242 @Override
243 public void viewportChanged(int verticalOffset) {
244 fMinimapTextWidget.getDisplay().asyncExec(() -> {
245 if (!fMinimapTextWidget.isDisposed()) {
246 updateMinimapAfterResize();
247 }
248 });
249 }
250
251 void updateMinimapAfterResize() {
252 updateMinimap(false);
253 }
254
255 void updateMinimapAfterTextChange() {
256 updateMinimap(true);
257 }
258
259 void updateMinimap(boolean textChanged) {
260 StyledText editorTextWidget = fEditorViewer.getTextWidget();
261 int editorTopIndex = JFaceTextUtil.getPartialTopIndex(editorTextWidget);
262 int editorBottomIndex = JFaceTextUtil.getPartialBottomIndex(editorTextWidget);
263 int maximalLines = fEditorViewer.getTextWidget().getClientArea().height
264 / fEditorViewer.getTextWidget().getLineHeight();
265 fMinimapTracker.updateMinimap(editorTopIndex, editorBottomIndex, maximalLines, textChanged);
266 }
267
268 void install() {
269 StyledText editorTextWidget = fEditorViewer.getTextWidget();
270 fScaledFonts = new HashMap<>();
271 // Compute scaled font
272 Font scaledFont = getScaledFont(editorTextWidget.getFont());
273 fMinimapTextWidget.setFont(scaledFont);
274 // track changed content of styled text of the editor
275 editorTextWidget.getContent().addTextChangeListener(this);
276 // track changed styles of styled text of the editor
277 fMinimapTextWidget.setBackground(editorTextWidget.getBackground());
278 fMinimapTextWidget.setForeground(editorTextWidget.getForeground());
279 if (fEditorViewer instanceof ITextViewerExtension4) {
280 ((ITextViewerExtension4) fEditorViewer).addTextPresentationListener(this);
281 }
282 fEditorViewer.addTextInputListener(this);
283 // track changed of vertical bar scroll to update highlight
284 // Viewport.
285 fEditorViewer.addViewportListener(this);
286 editorTextWidget.addControlListener(this);
287 synchTextAndStyles();
288 }
289
290 void synchTextAndStyles() {
291 synchText();
292 synchStyles();
293 }
294
295 private void synchStyles() {
296 StyledText editorTextWidget = fEditorViewer.getTextWidget();
297 StyleRange[] ranges = editorTextWidget.getStyleRanges();
298 if (ranges != null) {
299 for (StyleRange range : ranges) {
300 updateStyle(range);
301 }
302 }
303 fMinimapTextWidget.setStyleRanges(ranges);
304 }
305
306 private void synchText() {
307 StyledText editorTextWidget = fEditorViewer.getTextWidget();
308 fMinimapTextWidget.setText(editorTextWidget.getText());
309 }
310
311 void uninstall() {
312 StyledText editorTextWidget = fEditorViewer.getTextWidget();
313 // untrack changed content of styled text of the editor
314 if (editorTextWidget.getContent() != null) {
315 editorTextWidget.getContent().removeTextChangeListener(this);
316 }
317 // untrack changed styles of styled text of the editor
318 if (fEditorViewer instanceof ITextViewerExtension4) {
319 ((ITextViewerExtension4) fEditorViewer).removeTextPresentationListener(this);
320 }
321 fEditorViewer.removeTextInputListener(this);
322 // track changed of vertical bar scroll to update highlight
323 // Viewport.
324 fEditorViewer.removeViewportListener(this);
325 editorTextWidget.removeControlListener(this);
326 fScaledFonts.values().forEach(Font::dispose);
327 }
328 }
329
330 /**
331 * Minimap tracker.
332 *
333 */
334 class MinimapTracker implements CaretListener, SelectionListener, PaintListener, MouseWheelListener {
335
336 private static final int NB_LINES_SCROLL = 10;
337
338 private int fEditorTopIndex;
339
340 private int fEditorBottomIndex;
341
342 private int fTopIndexY;
343
344 private int fBottomIndexY;
345
346 private int fMinimalHeight;
347
348 private int fMaximalLines;
349
350 private boolean fTextChanging;
351
352 @Override
353 public void caretMoved(CaretEvent event) {
354 if (fTextChanging) {
355 // When editor content changed, it updates the minimap styled
356 // text content which update caret.
357 // In this case, ignore it to avoid set the top index of the
358 // editor viewer.
359 return;
360 }
361 updateEditorTopIndex();
362 }
363
364 private void updateEditorTopIndex() {
365 int caretOffset = fMinimapTextWidget.getCaretOffset();
366 int lineAtOffset = fMinimapTextWidget.getLineAtOffset(caretOffset);
367 int newTopIndex = lineAtOffset;
368 if (fEditorViewer instanceof ITextViewerExtension5) {
369 // adjust offset according folded content
370 newTopIndex = ((ITextViewerExtension5) fEditorViewer).widgetLine2ModelLine(lineAtOffset);
371 }
372 fEditorViewer.setTopIndex(newTopIndex);
373 }
374
375 void updateMinimap(int editorTopIndex, int editorBottomIndex, int maximalLines, boolean textChanged) {
376 if (editorTopIndex != fEditorTopIndex || editorBottomIndex != fEditorBottomIndex
377 || maximalLines != fMaximalLines || textChanged) {
378 fEditorTopIndex = editorTopIndex;
379 fEditorBottomIndex = editorBottomIndex;
380 fMaximalLines = maximalLines;
381 // Update the position of minimap styled text
382 fMinimapTextWidget.setRedraw(false);
383 int newMinimapTopIndex = editorTopIndex;
384 if (editorTopIndex != 0
385 && editorBottomIndex != fMinimapTextWidget.getLineAtOffset(fMinimapTextWidget.getCharCount())) {
386 // center the draw of square of editor client area
387 int minimapTopIndex = JFaceTextUtil.getPartialTopIndex(fMinimapTextWidget);
388 int minimapBottomIndex = JFaceTextUtil.getPartialBottomIndex(fMinimapTextWidget);
389 int minimapVisibleLineCount = minimapBottomIndex - minimapTopIndex;
390 int editorVisibleLineCount = editorBottomIndex - editorTopIndex;
391 newMinimapTopIndex = Math.max(0,
392 editorTopIndex + editorVisibleLineCount - minimapVisibleLineCount / 2);
393 }
394 fMinimapTextWidget.setTopIndex(newMinimapTopIndex);
395 fTopIndexY = fMinimapTextWidget.getLinePixel(fEditorTopIndex);
396 // "fEditorBottomIndex + 1" because fEditorBottomIndex is START
397 // of last line ... we want to include it
398 fBottomIndexY = fMinimapTextWidget.getLinePixel(fEditorBottomIndex + 1);
399 // to avoid that the highlight viewport shrinks to the text
400 // height in case all content is visible in the editor,
401 // calculate a minimal height based on the number of lines
402 // maximal shown and the line height in the minimap
403 fMinimalHeight = maximalLines > fMinimapTextWidget.getLineCount()
404 ? maximalLines * fMinimapTextWidget.getLineHeight()
405 : 0;
406 fMinimapTextWidget.setRedraw(true);
407 }
408 }
409
410 void replaceTextRange(TextChangingEvent event) {
411 fTextChanging = true;
412 int start = event.start;
413 int length = event.replaceCharCount;
414 String text = event.newText;
415 if (event.newLineCount > 0 || event.replaceLineCount > 0) {
416 Rectangle clientArea = fMinimapTextWidget.getClientArea();
417 fMinimapTextWidget.setRedraw(false);
418 fMinimapTextWidget.replaceTextRange(start, length, text);
419 fMinimapTextWidget.redraw(0, fTopIndexY, clientArea.width, clientArea.height, false);
420 fMinimapTextWidget.setRedraw(true);
421 } else {
422 fMinimapTextWidget.replaceTextRange(start, length, text);
423 }
424 fTextChanging = false;
425 }
426
427 @Override
428 public void widgetDefaultSelected(SelectionEvent e) {
429 // Do nothing
430 }
431
432 @Override
433 public void widgetSelected(SelectionEvent e) {
434 // hack to avoid drawing selection of styled text while mouse move
435 // of highlight viewport
436 fMinimapTextWidget.setSelection(fMinimapTextWidget.getCaretOffset());
437 }
438
439 @Override
440 public void paintControl(PaintEvent event) {
441 GC gc = event.gc;
442 int clientAreaWidth = fMinimapTextWidget.getClientArea().width;
443 gc.setBackground(fMinimapTextWidget.getSelectionBackground());
444 Rectangle rect = new Rectangle(0, fTopIndexY, clientAreaWidth,
445 Math.max(fBottomIndexY - fTopIndexY, fMinimalHeight));
446 gc.drawRectangle(rect.x, rect.y, Math.max(1, rect.width - 1), Math.max(1, rect.height - 1));
447 gc.setAdvanced(true);
448 if (gc.getAdvanced()) {
449 gc.setAlpha(20);
450 gc.fillRectangle(rect);
451 gc.setAdvanced(false);
452 }
453 }
454
455 @Override
456 public void mouseScrolled(MouseEvent e) {
457 int caretOffset = fMinimapTextWidget.getOffsetAtPoint(new Point(0, fTopIndexY));
458 int lineIndex = fMinimapTextWidget.getLineAtOffset(caretOffset);
459 if (e.count > 0) {
460 lineIndex = Math.max(0, lineIndex - NB_LINES_SCROLL);
461 } else {
462 lineIndex = Math.min(fMinimapTextWidget.getCharCount(), lineIndex + NB_LINES_SCROLL);
463 }
464 caretOffset = fMinimapTextWidget.getOffsetAtLine(lineIndex);
465 fMinimapTextWidget.setCaretOffset(caretOffset);
466 }
467
468 void install() {
469 fMinimapTextWidget.addCaretListener(this);
470 fMinimapTextWidget.addSelectionListener(this);
471 fMinimapTextWidget.addPaintListener(this);
472 fMinimapTextWidget.addMouseWheelListener(this);
473 }
474
475 void uninstall() {
476 if (!fMinimapTextWidget.isDisposed()) {
477 fMinimapTextWidget.removeCaretListener(this);
478 fMinimapTextWidget.removeSelectionListener(this);
479 fMinimapTextWidget.removePaintListener(this);
480 fMinimapTextWidget.removeMouseWheelListener(this);
481 }
482 }
483
484 }
485
486 private final EditorTracker fEditorTracker;
487
488 private final MinimapTracker fMinimapTracker;
489
490 public MinimapWidget(Composite parent, ITextViewer viewer) {
491 fEditorViewer = viewer;
492
493 // Create minimap styled text
494 fMinimapTextWidget = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY);
495 fMinimapTextWidget.setEditable(false);
496 fMinimapTextWidget.setCursor(fMinimapTextWidget.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));
497
498 // Initialize trackers
499 fEditorTracker = new EditorTracker();
500 fMinimapTracker = new MinimapTracker();
501 }
502
503 /**
504 * Install minimap widget.
505 */
506 public void install() {
507 fEditorTracker.install();
508 fMinimapTracker.install();
509 }
510
511 public void uninstall() {
512 fEditorTracker.uninstall();
513 fMinimapTracker.uninstall();
514 }
515
516 public Control getControl() {
517 return fMinimapTextWidget;
518 }
519
520 float getScale() {
521 return SCALE;
522 }
523 }
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 *******************************************************************************/
13 package org.eclipse.ui.internal.views.minimap;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Control;
21 import org.eclipse.swt.widgets.Label;
22
23 import org.eclipse.jface.dialogs.IPageChangedListener;
24
25 import org.eclipse.ui.part.MultiPageEditorPart;
26 import org.eclipse.ui.part.Page;
27 import org.eclipse.ui.part.PageBook;
28
29 import org.eclipse.ui.texteditor.ITextEditor;
30
31 /**
32 * Minimap with multi page editor which shows a minimap for the current page
33 * which is an {@link ITextEditor}.
34 *
35 */
36 public class MultiPageMinimapPage extends Page {
37
38 private final MultiPageEditorPart fMultiPageEditor;
39 private final Map<Object, Control> fTextWidgetMap;
40 private final IPageChangedListener fPageChangedListener;
41 private PageBook fPageBook;
42 private Label fErrorLabel;
43
44 public MultiPageMinimapPage(MultiPageEditorPart multiPageEditor) {
45 this.fMultiPageEditor = multiPageEditor;
46 this.fTextWidgetMap = new HashMap<>();
47 this.fPageChangedListener = e -> {
48 Object selectedPage = multiPageEditor.getSelectedPage();
49 // Find from cache the minimap for the selected page
50 Control textWidget = fTextWidgetMap.get(selectedPage);
51 if (textWidget != null) {
52 fPageBook.showPage(textWidget);
53 return;
54 }
55
56 MinimapPage minimapPage = null;
57 if (selectedPage instanceof ITextEditor) {
58 // Create and show a minimap page for the given text editor page
59 ITextEditor textEditor = (ITextEditor) selectedPage;
60 minimapPage = MinimapPage.createMinimapPage(textEditor);
61 }
62 if (minimapPage != null) {
63 minimapPage.createControl(fPageBook);
64 textWidget = minimapPage.getControl();
65 fTextWidgetMap.put(selectedPage, textWidget);
66 fPageBook.showPage(textWidget);
67 } else {
68 fTextWidgetMap.put(selectedPage, fErrorLabel);
69 fPageBook.showPage(fErrorLabel);
70 }
71 };
72 multiPageEditor.addPageChangedListener(fPageChangedListener);
73 }
74
75 @Override
76 public void createControl(Composite parent) {
77 fPageBook = new PageBook(parent, SWT.NORMAL);
78 fErrorLabel = new Label(fPageBook, SWT.NORMAL);
79 fErrorLabel.setText(MinimapMessages.MinimapViewNoMinimap);
80 fPageChangedListener.pageChanged(null);
81 }
82
83 @Override
84 public Control getControl() {
85 return fPageBook;
86 }
87
88 @Override
89 public void setFocus() {
90 fPageBook.setFocus();
91 }
92
93 @Override
94 public void dispose() {
95 super.dispose();
96 fMultiPageEditor.removePageChangedListener(fPageChangedListener);
97 }
98 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
6669 import org.eclipse.swt.widgets.Control;
6770 import org.eclipse.swt.widgets.Display;
6871 import org.eclipse.swt.widgets.Event;
69 import org.eclipse.swt.widgets.Listener;
7072 import org.eclipse.swt.widgets.Menu;
7173 import org.eclipse.swt.widgets.Shell;
7274
113115 import org.eclipse.jface.viewers.ISelectionProvider;
114116 import org.eclipse.jface.viewers.SelectionChangedEvent;
115117 import org.eclipse.jface.viewers.StructuredSelection;
116 import org.eclipse.jface.window.IShellProvider;
117118
118119 import org.eclipse.jface.text.AbstractInformationControlManager;
119120 import org.eclipse.jface.text.BadLocationException;
401402 @Override
402403 public void elementStateValidationChanged(final Object element, final boolean isStateValidated) {
403404 if (element != null && element.equals(getEditorInput())) {
404 Runnable r= new Runnable() {
405 @Override
406 public void run() {
407 enableSanityChecking(true);
408 if (isStateValidated) {
409 if (fValidator != null) {
410 ISourceViewer viewer= fSourceViewer;
411 if (viewer != null) {
412 StyledText textWidget= viewer.getTextWidget();
413 if (textWidget != null && !textWidget.isDisposed())
414 textWidget.removeVerifyListener(fValidator);
415 fValidator= null;
416 }
405 Runnable r = () -> {
406 enableSanityChecking(true);
407 if (isStateValidated) {
408 if (fValidator != null) {
409 ISourceViewer viewer1 = fSourceViewer;
410 if (viewer1 != null) {
411 StyledText textWidget1 = viewer1.getTextWidget();
412 if (textWidget1 != null && !textWidget1.isDisposed())
413 textWidget1.removeVerifyListener(fValidator);
414 fValidator = null;
417415 }
418 enableStateValidation(false);
419 } else if (!isStateValidated && fValidator == null) {
420 ISourceViewer viewer= fSourceViewer;
421 if (viewer != null) {
422 StyledText textWidget= viewer.getTextWidget();
423 if (textWidget != null && !textWidget.isDisposed()) {
424 fValidator= new Validator();
425 enableStateValidation(true);
426 textWidget.addVerifyListener(fValidator);
427 }
416 }
417 enableStateValidation(false);
418 } else if (!isStateValidated && fValidator == null) {
419 ISourceViewer viewer2 = fSourceViewer;
420 if (viewer2 != null) {
421 StyledText textWidget2 = viewer2.getTextWidget();
422 if (textWidget2 != null && !textWidget2.isDisposed()) {
423 fValidator = new Validator();
424 enableStateValidation(true);
425 textWidget2.addVerifyListener(fValidator);
428426 }
429427 }
430428 }
437435 @Override
438436 public void elementDirtyStateChanged(Object element, boolean isDirty) {
439437 if (element != null && element.equals(getEditorInput())) {
440 Runnable r= new Runnable() {
441 @Override
442 public void run() {
443 enableSanityChecking(true);
444 firePropertyChange(PROP_DIRTY);
445 }
438 Runnable r = () -> {
439 enableSanityChecking(true);
440 firePropertyChange(PROP_DIRTY);
446441 };
447442 execute(r, false);
448443 }
451446 @Override
452447 public void elementContentAboutToBeReplaced(Object element) {
453448 if (element != null && element.equals(getEditorInput())) {
454 Runnable r= new Runnable() {
455 @Override
456 public void run() {
457 enableSanityChecking(true);
458 rememberSelection();
459 resetHighlightRange();
460 }
449 Runnable r = () -> {
450 enableSanityChecking(true);
451 rememberSelection();
452 resetHighlightRange();
461453 };
462454 execute(r, false);
463455 }
466458 @Override
467459 public void elementContentReplaced(Object element) {
468460 if (element != null && element.equals(getEditorInput())) {
469 Runnable r= new Runnable() {
470 @Override
471 public void run() {
472 enableSanityChecking(true);
473 firePropertyChange(PROP_DIRTY);
474 restoreSelection();
475 handleElementContentReplaced();
476 }
461 Runnable r = () -> {
462 enableSanityChecking(true);
463 firePropertyChange(PROP_DIRTY);
464 restoreSelection();
465 handleElementContentReplaced();
477466 };
478467 execute(r, false);
479468 }
482471 @Override
483472 public void elementDeleted(Object deletedElement) {
484473 if (deletedElement != null && deletedElement.equals(getEditorInput())) {
485 Runnable r= new Runnable() {
486 @Override
487 public void run() {
488 enableSanityChecking(true);
489 close(false);
490 }
474 Runnable r = () -> {
475 enableSanityChecking(true);
476 close(false);
491477 };
492478 execute(r, false);
493479 }
547533 }
548534
549535 if (wasDirty && changed != null) {
550 Runnable r2= new Runnable() {
551 @Override
552 public void run() {
553 validateState(getEditorInput());
554 d.getDocument(getEditorInput()).set(previousContent);
555 updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);
556 restoreSelection();
557 }
536 Runnable r2 = () -> {
537 validateState(getEditorInput());
538 d.getDocument(getEditorInput()).set(previousContent);
539 updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);
540 restoreSelection();
558541 };
559542 execute(r2, doValidationAsync);
560543 } else
606589 */
607590 class TextListener implements ITextListener, ITextInputListener {
608591
609 /** The posted updater code. */
610 private Runnable fRunnable= new Runnable() {
611 @Override
612 public void run() {
613 fIsRunnablePosted= false;
614
615 if (fSourceViewer != null) {
616 updateContentDependentActions();
617
618 // remember the last edit position
619 if (isDirty() && fUpdateLastEditPosition) {
620 fUpdateLastEditPosition= false;
621 ISelection sel= getSelectionProvider().getSelection();
622 IEditorInput input= getEditorInput();
623 IDocument document= getDocumentProvider().getDocument(input);
624
625 if (fLocalLastEditPosition != null) {
626 if (document != null) {
627 document.removePosition(fLocalLastEditPosition);
628 }
629 fLocalLastEditPosition= null;
630 }
631
632 if (sel instanceof ITextSelection && !sel.isEmpty()) {
633 ITextSelection s= (ITextSelection) sel;
634 fLocalLastEditPosition= new Position(s.getOffset(), s.getLength());
635 if (document != null) {
636 try {
637 document.addPosition(fLocalLastEditPosition);
638 } catch (BadLocationException ex) {
639 fLocalLastEditPosition = null;
640 }
641 }
642 }
643
644 IEditorSite editorSite= getEditorSite();
645 if (editorSite instanceof MultiPageEditorSite)
646 editorSite= ((MultiPageEditorSite)editorSite).getMultiPageEditor().getEditorSite();
647 TextEditorPlugin.getDefault().setLastEditPosition(new EditPosition(input, editorSite.getId(), fLocalLastEditPosition));
648 }
649 }
650 }
651 };
652
653 /** Display used for posting the updater code. */
654 private Display fDisplay;
592 /**
593 * Should the last edit position be updated?
594 *
595 * @since 3.0
596 */
597 private boolean fUpdateLastEditPosition = false;
598
655599 /**
656600 * The editor's last edit position
601 *
657602 * @since 3.0
658603 */
659604 private Position fLocalLastEditPosition;
605
606 /** The posted updater code. */
607 private Runnable fRunnable = () -> {
608 fIsRunnablePosted = false;
609
610 if (fSourceViewer != null) {
611 updateContentDependentActions();
612
613 // remember the last edit position
614 if (isDirty() && fUpdateLastEditPosition) {
615 fUpdateLastEditPosition = false;
616 ISelection sel = getSelectionProvider().getSelection();
617 IEditorInput input = getEditorInput();
618 IDocument document = getDocumentProvider().getDocument(input);
619
620 if (fLocalLastEditPosition != null) {
621 if (document != null) {
622 document.removePosition(fLocalLastEditPosition);
623 }
624 fLocalLastEditPosition = null;
625 }
626
627 if (sel instanceof ITextSelection && !sel.isEmpty()) {
628 ITextSelection s = (ITextSelection) sel;
629 fLocalLastEditPosition = new Position(s.getOffset(), s.getLength());
630 if (document != null) {
631 try {
632 document.addPosition(fLocalLastEditPosition);
633 } catch (BadLocationException ex) {
634 fLocalLastEditPosition = null;
635 }
636 }
637 }
638
639 IEditorSite editorSite = getEditorSite();
640 if (editorSite instanceof MultiPageEditorSite)
641 editorSite = ((MultiPageEditorSite) editorSite).getMultiPageEditor().getEditorSite();
642 TextEditorPlugin.getDefault()
643 .setLastEditPosition(new EditPosition(input, editorSite.getId(), fLocalLastEditPosition));
644 }
645 }
646 };
647
648 /** Display used for posting the updater code. */
649 private Display fDisplay;
650
660651 /**
661652 * Has the runnable been posted?
662653 * @since 3.0
663654 */
664655 private boolean fIsRunnablePosted= false;
665 /**
666 * Should the last edit position be updated?
667 * @since 3.0
668 */
669 private boolean fUpdateLastEditPosition= false;
670656
671657 @Override
672658 public void textChanged(TextEvent event) {
982968 * http://dev.eclipse.org/bugs/show_bug.cgi?id=11731
983969 * Will be removed when SWT has solved the problem.
984970 */
985 window.getShell().getDisplay().asyncExec(new Runnable() {
986 @Override
987 public void run() {
988 handleActivation();
989 }
990 });
971 window.getShell().getDisplay().asyncExec(() -> handleActivation());
991972 }
992973 }
993974
29552936 * @since 3.4
29562937 */
29572938 protected IMenuListener createContextMenuListener() {
2958 return new IMenuListener() {
2959 @Override
2960 public void menuAboutToShow(IMenuManager menu) {
2961 String id= menu.getId();
2962 if (getRulerContextMenuId().equals(id)) {
2963 setFocus();
2964 rulerContextMenuAboutToShow(menu);
2965 } else if (getEditorContextMenuId().equals(id)) {
2966 setFocus();
2967 editorContextMenuAboutToShow(menu);
2968 }
2939 return menu -> {
2940 String id = menu.getId();
2941 if (getRulerContextMenuId().equals(id)) {
2942 setFocus();
2943 rulerContextMenuAboutToShow(menu);
2944 } else if (getEditorContextMenuId().equals(id)) {
2945 setFocus();
2946 editorContextMenuAboutToShow(menu);
29692947 }
29702948 };
29712949 }
30233001 if (1 != e.button)
30243002 return;
30253003
3026 Runnable runnable= new Runnable() {
3027 @Override
3028 public void run() {
3029 if (!fDoubleClicked)
3030 triggerAction(ITextEditorActionConstants.RULER_CLICK, e);
3031 }
3004 Runnable runnable = () -> {
3005 if (!fDoubleClicked)
3006 triggerAction(ITextEditorActionConstants.RULER_CLICK, e);
30323007 };
30333008 if (delay <= 0)
30343009 runnable.run();
30693044 if (fSelectionChangedListener == null) {
30703045 fSelectionChangedListener= new ISelectionChangedListener() {
30713046
3072 private Runnable fRunnable= new Runnable() {
3073 @Override
3074 public void run() {
3075 // check whether editor has not been disposed yet
3076 if (fSourceViewer != null && fSourceViewer.getDocument() != null) {
3077 handleCursorPositionChanged();
3078 updateSelectionDependentActions();
3079 }
3047 private Runnable fRunnable = () -> {
3048 // check whether editor has not been disposed yet
3049 if (fSourceViewer != null && fSourceViewer.getDocument() != null) {
3050 handleCursorPositionChanged();
3051 updateSelectionDependentActions();
30803052 }
30813053 };
30823054
31513123 */
31523124 protected final void internalInit(IWorkbenchWindow window, final IEditorSite site, final IEditorInput input) throws PartInitException {
31533125
3154 IRunnableWithProgress runnable= new IRunnableWithProgress() {
3155 @Override
3156 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
3157 try {
3158
3159 if (getDocumentProvider() instanceof IDocumentProviderExtension2) {
3160 IDocumentProviderExtension2 extension= (IDocumentProviderExtension2) getDocumentProvider();
3161 extension.setProgressMonitor(monitor);
3162 }
3163
3164 doSetInput(input);
3165
3166 } catch (CoreException x) {
3167 throw new InvocationTargetException(x);
3168 } finally {
3169 if (getDocumentProvider() instanceof IDocumentProviderExtension2) {
3170 IDocumentProviderExtension2 extension= (IDocumentProviderExtension2) getDocumentProvider();
3171 extension.setProgressMonitor(null);
3172 }
3126 IRunnableWithProgress runnable = monitor -> {
3127 try {
3128
3129 if (getDocumentProvider() instanceof IDocumentProviderExtension2) {
3130 IDocumentProviderExtension2 extension1 = (IDocumentProviderExtension2) getDocumentProvider();
3131 extension1.setProgressMonitor(monitor);
3132 }
3133
3134 doSetInput(input);
3135
3136 } catch (CoreException x) {
3137 throw new InvocationTargetException(x);
3138 } finally {
3139 if (getDocumentProvider() instanceof IDocumentProviderExtension2) {
3140 IDocumentProviderExtension2 extension2 = (IDocumentProviderExtension2) getDocumentProvider();
3141 extension2.setProgressMonitor(null);
31733142 }
31743143 }
31753144 };
33953364 styledText.addKeyListener(getCursorListener());
33963365
33973366 // Disable orientation switching until we fully support it.
3398 styledText.addListener(SWT.OrientationChange, new Listener() {
3399 @Override
3400 public void handleEvent(Event event) {
3401 event.doit= false;
3402 }
3403 });
3367 styledText.addListener(SWT.OrientationChange, event -> event.doit = false);
34043368
34053369 if (getHelpContextId() != null)
34063370 PlatformUI.getWorkbench().getHelpSystem().setHelp(styledText, getHelpContextId());
42924256 enableSanityChecking(false);
42934257
42944258 Display display= getSite().getShell().getDisplay();
4295 display.asyncExec(new Runnable() {
4296 @Override
4297 public void run() {
4298 if (fSourceViewer != null)
4299 getSite().getPage().closeEditor(AbstractTextEditor.this, save);
4300 }
4259 display.asyncExec(() -> {
4260 if (fSourceViewer != null)
4261 getSite().getPage().closeEditor(AbstractTextEditor.this, save);
43014262 });
43024263 }
43034264
49834944
49844945 try {
49854946 final IEditorInput input= getEditorInput();
4986 BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() {
4987 @Override
4988 public void run() {
4989 validateState(input);
4990 }
4991 });
4947 BusyIndicator.showWhile(getSite().getShell().getDisplay(), () -> validateState(input));
49924948 sanityCheckState(input);
49934949 return !isEditorInputReadOnly() && !fTextInputListener.inputChanged;
49944950
59365892 action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_WRAP);
59375893 setAction(ITextEditorActionConstants.WORD_WRAP, action);
59385894
5939 blockAction.addPropertyChangeListener(new IPropertyChangeListener() {
5940 @Override
5941 public void propertyChange(PropertyChangeEvent event) {
5942 if (IAction.CHECKED == event.getProperty() &&
5943 Boolean.TRUE.equals(event.getNewValue())) {
5944 wrapAction.setChecked(false);
5945 }
5895 blockAction.addPropertyChangeListener(event -> {
5896 if (IAction.CHECKED == event.getProperty() && Boolean.TRUE.equals(event.getNewValue())) {
5897 wrapAction.setChecked(false);
59465898 }
59475899 });
5948 wrapAction.addPropertyChangeListener(new IPropertyChangeListener() {
5949 @Override
5950 public void propertyChange(PropertyChangeEvent event) {
5951 if (IAction.CHECKED == event.getProperty() &&
5952 Boolean.TRUE.equals(event.getNewValue())) {
5953 blockAction.setChecked(false);
5954 }
5900 wrapAction.addPropertyChangeListener(event -> {
5901 if (IAction.CHECKED == event.getProperty() && Boolean.TRUE.equals(event.getNewValue())) {
5902 blockAction.setChecked(false);
59555903 }
59565904 });
59575905 }
59625910 setAction(ITextEditorActionConstants.OPEN_HYPERLINK, action);
59635911
59645912 PropertyDialogAction openProperties= new PropertyDialogAction(
5965 new IShellProvider() {
5966 @Override
5967 public Shell getShell() {
5968 return getSite().getShell();
5969 }
5970 },
5913 () -> getSite().getShell(),
59715914 new ISelectionProvider() {
59725915 @Override
59735916 public void addSelectionChangedListener(ISelectionChangedListener listener) {
62306173 fColumnSupport= createColumnSupport();
62316174 return (T) fColumnSupport;
62326175 }
6176
6177 if (ITextViewer.class.equals(required))
6178 return (fSourceViewer == null ? null : (T) fSourceViewer);
62336179
62346180 return super.getAdapter(required);
62356181 }
00 /*******************************************************************************
11 * Copyright (c) 2015 Red Hat Inc.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - 469918 Zoom In/Out
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009 Avaloq Evolution AG, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Tom Eicher (Avaloq Evolution AG) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2015 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
7780 if (shell != null && !shell.isDisposed())
7881 display= shell.getDisplay();
7982
80 BusyIndicator.showWhile(display, new Runnable() {
81 @Override
82 public void run() {
83 fOperationTarget.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
84 }
85 });
83 BusyIndicator.showWhile(display,
84 () -> fOperationTarget.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS));
8685 }
8786 }
8887 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1215
1316
1417 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.events.DisposeEvent;
16 import org.eclipse.swt.events.DisposeListener;
1718 import org.eclipse.swt.graphics.Color;
1819 import org.eclipse.swt.graphics.GC;
1920 import org.eclipse.swt.graphics.Image;
102103 if (fImage == null) {
103104 fImage= createImage(control.getDisplay(), control.getSize(), rangeIndicatorColor);
104105
105 control.addDisposeListener(new DisposeListener() {
106 @Override
107 public void widgetDisposed(DisposeEvent e) {
108 if (fImage != null && !fImage.isDisposed()) {
109 fImage.dispose();
110 fImage = null;
111 }
106 control.addDisposeListener(e -> {
107 if (fImage != null && !fImage.isDisposed()) {
108 fImage.dispose();
109 fImage = null;
112110 }
113111 });
114112 } else {
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2011 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Genady Beryozkin, me@genady.org - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2011 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2009, 2015 Avaloq Evolution AG and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Tom Eicher (Avaloq Evolution AG) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2015 Holger Voormann and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Holger Voormann - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1518 import org.eclipse.swt.SWT;
1619 import org.eclipse.swt.custom.ScrolledComposite;
1720 import org.eclipse.swt.custom.StyledText;
18 import org.eclipse.swt.events.DisposeEvent;
19 import org.eclipse.swt.events.DisposeListener;
2021 import org.eclipse.swt.graphics.Color;
2122 import org.eclipse.swt.layout.GridData;
2223 import org.eclipse.swt.layout.GridLayout;
6869 fForegroundColor= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
6970 fSeparatorColor= new Color(display, 152, 170, 203);
7071
71 fPropertyChangeListener= new IPropertyChangeListener() {
72 @Override
73 public void propertyChange(PropertyChangeEvent event) {
74 handlePropertyChange(event);
75 }
76 };
72 fPropertyChangeListener = event -> handlePropertyChange(event);
7773 JFaceResources.getFontRegistry().addListener(fPropertyChangeListener);
7874
7975 fScrolledComposite= new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
8076 fScrolledComposite.setAlwaysShowScrollBars(false);
8177 fScrolledComposite.setExpandHorizontal(true);
8278 fScrolledComposite.setExpandVertical(true);
83 fScrolledComposite.addDisposeListener(new DisposeListener() {
84 @Override
85 public void widgetDisposed(DisposeEvent e) {
86 JFaceResources.getFontRegistry().removeListener(fPropertyChangeListener);
87 fScrolledComposite= null;
88 fSeparatorColor.dispose();
89 fSeparatorColor= null;
90 fHeader= null;
91 fBanner= null;
92 fText= null;
93 }
79 fScrolledComposite.addDisposeListener(e -> {
80 JFaceResources.getFontRegistry().removeListener(fPropertyChangeListener);
81 fScrolledComposite = null;
82 fSeparatorColor.dispose();
83 fSeparatorColor = null;
84 fHeader = null;
85 fBanner = null;
86 fText = null;
9487 });
9588
9689 Composite composite= createComposite(fScrolledComposite);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Benjamin Muskalla - initial API and implementation - https://bugs.eclipse.org/bugs/show_bug.cgi?id=41573
00 /*******************************************************************************
11 * Copyright (c) 2007, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2013 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
8083 if (shell != null && !shell.isDisposed())
8184 display= shell.getDisplay();
8285
83 BusyIndicator.showWhile(display, new Runnable() {
84 @Override
85 public void run() {
86 fOperationTarget.doOperation(fOperationCode);
87 }
88 });
86 BusyIndicator.showWhile(display, () -> fOperationTarget.doOperation(fOperationCode));
8987 }
9088
9189 @Override
00 /*******************************************************************************
11 * Copyright (c) 2006, 2010 Wind River Systems, Inc., IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Anton Leherbauer (Wind River Systems) - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2012 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1114
1215 import org.eclipse.swt.SWT;
1316 import org.eclipse.swt.custom.CLabel;
14 import org.eclipse.swt.events.DisposeEvent;
15 import org.eclipse.swt.events.DisposeListener;
1617 import org.eclipse.swt.events.MouseAdapter;
1718 import org.eclipse.swt.events.MouseEvent;
1819 import org.eclipse.swt.events.MouseListener;
164165 Label sep= new Label(parent, SWT.SEPARATOR);
165166 fLabel= new CLabel(parent, SWT.SHADOW_NONE);
166167
167 fLabel.addDisposeListener(new DisposeListener() {
168 @Override
169 public void widgetDisposed(DisposeEvent e) {
170 fMouseListener= null;
171 }
172 });
168 fLabel.addDisposeListener(e -> fMouseListener = null);
173169 if (fActionHandler != null) {
174170 fMouseListener= new Listener();
175171 fLabel.addMouseListener(fMouseListener);
212208 if (fFixedWidth < 0) {
213209 GC gc= new GC(control);
214210 gc.setFont(control.getFont());
215 fFixedWidth= gc.getFontMetrics().getAverageCharWidth() * fWidthInChars;
211 fFixedWidth = (int) gc.getFontMetrics().getAverageCharacterWidth() * fWidthInChars;
216212 fFixedWidth += INDENT * 2;
217213 gc.dispose();
218214 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
123126 if (shell != null && !shell.isDisposed())
124127 display= shell.getDisplay();
125128
126 BusyIndicator.showWhile(display, new Runnable() {
127 @Override
128 public void run() {
129 fOperationTarget.doOperation(fOperationCode);
130 }
131 });
129 BusyIndicator.showWhile(display, () -> fOperationTarget.doOperation(fOperationCode));
132130 }
133131
134132 /**
00 /*******************************************************************************
11 * Copyright (c) 2000, 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2015 Red Hat Inc.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - 469918 Zoom In/Out
1316 /**
1417 * @noreference This class is not intended to be referenced by clients.
1518 */
16 final public class TextZoomInHandler extends AbstractTextZoomHandler {
19 public final class TextZoomInHandler extends AbstractTextZoomHandler {
1720
1821 public TextZoomInHandler() {
1922 super(+2);
00 /*******************************************************************************
11 * Copyright (c) 2015 Red Hat Inc.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Mickael Istria (Red Hat Inc.) - 469918 Zoom In/Out
1316 /**
1417 * @noreference This class is not intended to be referenced by clients.
1518 */
16 final public class TextZoomOutHandler extends AbstractTextZoomHandler {
19 public final class TextZoomOutHandler extends AbstractTextZoomHandler {
1720
1821 public TextZoomOutHandler() {
1922 super(-2);
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2015 Andrey Loskutov and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Andrey Loskutov <loskutov@gmx.de> - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2006 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
232235 }
233236 }
234237
235 Comparator<RulerColumnDescriptor> gravityComp= new Comparator<RulerColumnDescriptor>() {
236 @Override
237 public int compare(RulerColumnDescriptor o1, RulerColumnDescriptor o2) {
238 float diff= o1.getPlacement().getGravity() - o2.getPlacement().getGravity();
239 if (diff == 0)
240 return 0;
241 if (diff < 0)
242 return -1;
243 return 1;
244 }
238 Comparator<RulerColumnDescriptor> gravityComp = (o1, o2) -> {
239 float diff = o1.getPlacement().getGravity() - o2.getPlacement().getGravity();
240 if (diff == 0)
241 return 0;
242 if (diff < 0)
243 return -1;
244 return 1;
245245 };
246246
247247 /* Topological sort - always select the source with the least gravity */
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2005 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2018 Dakshinamurthy Karra, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Dakshinamurthy Karra (Jalian Systems) - Templates View - https://bugs.eclipse.org/bugs/show_bug.cgi?id=69581
5255
5356 import org.eclipse.jface.action.Action;
5457 import org.eclipse.jface.action.IAction;
55 import org.eclipse.jface.action.IMenuListener;
5658 import org.eclipse.jface.action.IMenuManager;
5759 import org.eclipse.jface.action.IToolBarManager;
5860 import org.eclipse.jface.action.MenuManager;
6264 import org.eclipse.jface.layout.TreeColumnLayout;
6365 import org.eclipse.jface.preference.IPreferenceStore;
6466 import org.eclipse.jface.util.IPropertyChangeListener;
65 import org.eclipse.jface.util.PropertyChangeEvent;
6667 import org.eclipse.jface.viewers.AbstractTreeViewer;
6768 import org.eclipse.jface.viewers.ColumnPixelData;
68 import org.eclipse.jface.viewers.DoubleClickEvent;
69 import org.eclipse.jface.viewers.IDoubleClickListener;
7069 import org.eclipse.jface.viewers.IPostSelectionProvider;
7170 import org.eclipse.jface.viewers.ISelectionChangedListener;
7271 import org.eclipse.jface.viewers.ISelectionProvider;
500499
501500 int sashSize= fPreferenceStore.getInt(SASH_SIZE_PREF_ID);
502501 fControl.setWeights(new int[] { sashSize, 100 - sashSize });
503 fTemplateChangeListener= new IPropertyChangeListener() {
504 @Override
505 public void propertyChange(PropertyChangeEvent event) {
506 getShell().getDisplay().asyncExec(new Runnable() {
507 @Override
508 public void run() {
509 refresh();
510 }
511 });
512 }
513 };
502 fTemplateChangeListener = event -> getShell().getDisplay().asyncExec(() -> refresh());
514503 getTemplatePreferenceStore().addPropertyChangeListener(fTemplateChangeListener);
515504 updateContextTypes(getEditorContextTypeIds());
516505 }
905894 String pattern= ((String)clipboard.getContents(TextTransfer.getInstance()));
906895 if (pattern != null) {
907896 final Template template= new Template(createTemplateName(), TemplatesMessages.TemplatesPage_paste_description, getContextTypeId(), pattern.replaceAll("\\$", "\\$\\$"), true); //$NON-NLS-1$//$NON-NLS-2$
908 getShell().getDisplay().asyncExec(new Runnable() {
909 @Override
910 public void run() {
911 addTemplate(template);
912 }
913 });
897 getShell().getDisplay().asyncExec(() -> addTemplate(template));
914898 return;
915899 }
916900 TemplatePersistenceData[] templates= (TemplatePersistenceData[])clipboard.getContents(TemplatesTransfer.getInstance());
10701054
10711055 fTreeViewer.setComparator(new TemplateViewerComparator());
10721056 fTreeViewer.setInput(getTemplatePreferenceStore());
1073 fTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
1074 @Override
1075 public void doubleClick(DoubleClickEvent e) {
1076 updateSelectedItems();
1077 TemplatePersistenceData[] selectedTemplates= getSelectedTemplates();
1078 if (selectedTemplates.length > 0)
1079 insertTemplate(selectedTemplates[0].getTemplate());
1080 }
1057 fTreeViewer.addDoubleClickListener(e -> {
1058 updateSelectedItems();
1059 TemplatePersistenceData[] selectedTemplates = getSelectedTemplates();
1060 if (selectedTemplates.length > 0)
1061 insertTemplate(selectedTemplates[0].getTemplate());
10811062 });
10821063
1083 fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
1084 @Override
1085 public void selectionChanged(SelectionChangedEvent e) {
1086 updateSelectedItems();
1087 updateButtons();
1088 }
1064 fTreeViewer.addSelectionChangedListener(e -> {
1065 updateSelectedItems();
1066 updateButtons();
10891067 });
10901068 fTreeViewer.expandAll();
10911069 }
11251103 private void hookContextMenu() {
11261104 MenuManager menuMgr= new MenuManager(POPUP_MENU_ID);
11271105 menuMgr.setRemoveAllWhenShown(true);
1128 menuMgr.addMenuListener(new IMenuListener() {
1129 @Override
1130 public void menuAboutToShow(IMenuManager manager) {
1131 fillContextMenu(manager);
1132 }
1133 });
1106 menuMgr.addMenuListener(manager -> fillContextMenu(manager));
11341107 fContextMenu= menuMgr.createContextMenu(fTreeViewer.getControl());
11351108 fTreeViewer.getControl().setMenu(fContextMenu);
11361109 getSite().registerContextMenu(POPUP_MENU_ID, menuMgr, fTreeViewer);
14811454 final Template template= new Template(createTemplateName(),
14821455 TemplatesMessages.TemplatesPage_paste_description, contextId, text,
14831456 true);
1484 getShell().getDisplay().asyncExec(new Runnable() {
1485 @Override
1486 public void run() {
1487 addTemplate(template);
1488 }
1489 });
1457 getShell().getDisplay().asyncExec(() -> addTemplate(template));
14901458 return;
14911459 }
14921460 if (templateTransfer.isSupportedType(event.currentDataType)) {
14931461 final TemplatePersistenceData[] templates= (TemplatePersistenceData[]) event.data;
14941462 final int dropType= event.detail;
1495 getShell().getDisplay().asyncExec(new Runnable() {
1496 @Override
1497 public void run() {
1498 if (dropType == DND.DROP_COPY)
1499 copyTemplates(templates, contextId);
1500 else
1501 moveTemplates(templates, contextId);
1502 }
1463 getShell().getDisplay().asyncExec(() -> {
1464 if (dropType == DND.DROP_COPY)
1465 copyTemplates(templates, contextId);
1466 else
1467 moveTemplates(templates, contextId);
15031468 });
15041469 }
15051470 }
00 /*******************************************************************************
11 * Copyright (c) 2005, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2012 Dakshinamurthy Karra, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Dakshinamurthy Karra (Jalian Systems) - Templates View - https://bugs.eclipse.org/bugs/show_bug.cgi?id=69581
00 /*******************************************************************************
11 * Copyright (c) 2009 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Piotr Maj <pm@jcake.com> - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2007 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
3235
3336 import org.eclipse.swt.SWT;
3437 import org.eclipse.swt.custom.StyledText;
35 import org.eclipse.swt.events.DisposeEvent;
36 import org.eclipse.swt.events.DisposeListener;
3738 import org.eclipse.swt.events.FocusEvent;
3839 import org.eclipse.swt.events.FocusListener;
39 import org.eclipse.swt.events.ModifyEvent;
4040 import org.eclipse.swt.events.ModifyListener;
4141 import org.eclipse.swt.events.SelectionAdapter;
4242 import org.eclipse.swt.events.SelectionEvent;
5050 import org.eclipse.swt.widgets.Combo;
5151 import org.eclipse.swt.widgets.Composite;
5252 import org.eclipse.swt.widgets.Control;
53 import org.eclipse.swt.widgets.Event;
5453 import org.eclipse.swt.widgets.FileDialog;
5554 import org.eclipse.swt.widgets.Label;
56 import org.eclipse.swt.widgets.Listener;
5755 import org.eclipse.swt.widgets.Menu;
5856 import org.eclipse.swt.widgets.Shell;
5957 import org.eclipse.swt.widgets.Table;
6967 import org.eclipse.jface.action.Action;
7068 import org.eclipse.jface.action.GroupMarker;
7169 import org.eclipse.jface.action.IAction;
72 import org.eclipse.jface.action.IMenuListener;
7370 import org.eclipse.jface.action.IMenuManager;
7471 import org.eclipse.jface.action.MenuManager;
7572 import org.eclipse.jface.action.Separator;
8380 import org.eclipse.jface.preference.PreferencePage;
8481 import org.eclipse.jface.resource.JFaceResources;
8582 import org.eclipse.jface.util.BidiUtils;
86 import org.eclipse.jface.viewers.CheckStateChangedEvent;
8783 import org.eclipse.jface.viewers.CheckboxTableViewer;
8884 import org.eclipse.jface.viewers.ColumnPixelData;
8985 import org.eclipse.jface.viewers.ColumnWeightData;
90 import org.eclipse.jface.viewers.DoubleClickEvent;
9186 import org.eclipse.jface.viewers.IBaseLabelProvider;
92 import org.eclipse.jface.viewers.ICheckStateListener;
93 import org.eclipse.jface.viewers.IDoubleClickListener;
94 import org.eclipse.jface.viewers.ISelectionChangedListener;
9587 import org.eclipse.jface.viewers.IStructuredSelection;
9688 import org.eclipse.jface.viewers.ITableLabelProvider;
9789 import org.eclipse.jface.viewers.LabelProvider;
98 import org.eclipse.jface.viewers.SelectionChangedEvent;
9990 import org.eclipse.jface.viewers.StructuredSelection;
10091 import org.eclipse.jface.viewers.TableViewer;
10192 import org.eclipse.jface.viewers.Viewer;
10495
10596 import org.eclipse.jface.text.Document;
10697 import org.eclipse.jface.text.IDocument;
107 import org.eclipse.jface.text.ITextListener;
10898 import org.eclipse.jface.text.ITextOperationTarget;
10999 import org.eclipse.jface.text.ITextViewer;
110 import org.eclipse.jface.text.TextEvent;
111100 import org.eclipse.jface.text.contentassist.ContentAssistant;
112101 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
113102 import org.eclipse.jface.text.contentassist.IContentAssistant;
304293 parent.setLayout(layout);
305294 parent.setLayoutData(new GridData(GridData.FILL_BOTH));
306295
307 ModifyListener listener= new ModifyListener() {
308 @Override
309 public void modifyText(ModifyEvent e) {
310 doTextWidgetChanged(e.widget);
311 }
312 };
296 ModifyListener listener = e -> doTextWidgetChanged(e.widget);
313297
314298 if (fIsNameModifiable) {
315299 createLabel(parent, TemplatesMessages.EditTemplateDialog_name);
508492 data.heightHint= convertHeightInCharsToPixels(nLines);
509493 control.setLayoutData(data);
510494
511 viewer.addTextListener(new ITextListener() {
512 @Override
513 public void textChanged(TextEvent event) {
514 if (event .getDocumentEvent() != null)
515 doSourceChanged(event.getDocumentEvent().getDocument());
516 }
495 viewer.addTextListener(event -> {
496 if (event.getDocumentEvent() != null)
497 doSourceChanged(event.getDocumentEvent().getDocument());
517498 });
518499
519 viewer.addSelectionChangedListener(new ISelectionChangedListener() {
520 @Override
521 public void selectionChanged(SelectionChangedEvent event) {
522 updateSelectionDependentActions();
523 }
524 });
500 viewer.addSelectionChangedListener(event -> updateSelectionDependentActions());
525501
526502 return viewer;
527503 }
554530 final IHandlerService handlerService= PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
555531 final Expression expression= new ActiveShellExpression(fPatternEditor.getControl().getShell());
556532
557 getShell().addDisposeListener(new DisposeListener() {
558
559 @Override
560 public void widgetDisposed(DisposeEvent e) {
561 handlerService.deactivateHandlers(handlerActivations);
562 }
563 });
533 getShell().addDisposeListener(e -> handlerService.deactivateHandlers(handlerActivations));
564534
565535 fPatternEditor.getTextWidget().addFocusListener(new FocusListener() {
566536 @Override
614584 // create context menu
615585 MenuManager manager= new MenuManager(null, null);
616586 manager.setRemoveAllWhenShown(true);
617 manager.addMenuListener(new IMenuListener() {
618 @Override
619 public void menuAboutToShow(IMenuManager mgr) {
620 fillContextMenu(mgr);
621 }
622 });
587 manager.addMenuListener(mgr -> fillContextMenu(mgr));
623588
624589 StyledText text= fPatternEditor.getTextWidget();
625590 Menu menu= manager.createContextMenu(text);
930895 table.setSortColumn(column1);
931896 table.setSortDirection(viewerComparator.getDirection());
932897
933 fTableViewer.addDoubleClickListener(new IDoubleClickListener() {
934 @Override
935 public void doubleClick(DoubleClickEvent e) {
936 edit();
937 }
938 });
939
940 fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
941 @Override
942 public void selectionChanged(SelectionChangedEvent e) {
943 selectionChanged1();
944 }
945 });
946
947 fTableViewer.addCheckStateListener(new ICheckStateListener() {
948 @Override
949 public void checkStateChanged(CheckStateChangedEvent event) {
950 TemplatePersistenceData d= (TemplatePersistenceData) event.getElement();
951 d.setEnabled(event.getChecked());
952 }
898 fTableViewer.addDoubleClickListener(e -> edit());
899
900 fTableViewer.addSelectionChangedListener(e -> selectionChanged1());
901
902 fTableViewer.addCheckStateListener(event -> {
903 TemplatePersistenceData d = (TemplatePersistenceData) event.getElement();
904 d.setEnabled(event.getChecked());
953905 });
954906
955907 BidiUtils.applyTextDirection(fTableViewer.getControl(), BidiUtils.BTD_DEFAULT);
964916 fAddButton= new Button(buttons, SWT.PUSH);
965917 fAddButton.setText(TemplatesMessages.TemplatePreferencePage_new);
966918 fAddButton.setLayoutData(getButtonGridData(fAddButton));
967 fAddButton.addListener(SWT.Selection, new Listener() {
968 @Override
969 public void handleEvent(Event e) {
970 add();
971 }
972 });
919 fAddButton.addListener(SWT.Selection, e -> add());
973920
974921 fEditButton= new Button(buttons, SWT.PUSH);
975922 fEditButton.setText(TemplatesMessages.TemplatePreferencePage_edit);
976923 fEditButton.setLayoutData(getButtonGridData(fEditButton));
977 fEditButton.addListener(SWT.Selection, new Listener() {
978 @Override
979 public void handleEvent(Event e) {
980 edit();
981 }
982 });
924 fEditButton.addListener(SWT.Selection, e -> edit());
983925
984926 fRemoveButton= new Button(buttons, SWT.PUSH);
985927 fRemoveButton.setText(TemplatesMessages.TemplatePreferencePage_remove);
986928 fRemoveButton.setLayoutData(getButtonGridData(fRemoveButton));
987 fRemoveButton.addListener(SWT.Selection, new Listener() {
988 @Override
989 public void handleEvent(Event e) {
990 remove();
991 }
992 });
929 fRemoveButton.addListener(SWT.Selection, e -> remove());
993930
994931 createSeparator(buttons);
995932
996933 fRestoreButton= new Button(buttons, SWT.PUSH);
997934 fRestoreButton.setText(TemplatesMessages.TemplatePreferencePage_restore);
998935 fRestoreButton.setLayoutData(getButtonGridData(fRestoreButton));
999 fRestoreButton.addListener(SWT.Selection, new Listener() {
1000 @Override
1001 public void handleEvent(Event e) {
1002 restoreDeleted();
1003 }
1004 });
936 fRestoreButton.addListener(SWT.Selection, e -> restoreDeleted());
1005937
1006938 fRevertButton= new Button(buttons, SWT.PUSH);
1007939 fRevertButton.setText(TemplatesMessages.TemplatePreferencePage_revert);
1008940 fRevertButton.setLayoutData(getButtonGridData(fRevertButton));
1009 fRevertButton.addListener(SWT.Selection, new Listener() {
1010 @Override
1011 public void handleEvent(Event e) {
1012 revert();
1013 }
1014 });
941 fRevertButton.addListener(SWT.Selection, e -> revert());
1015942
1016943 createSeparator(buttons);
1017944
1018945 fImportButton= new Button(buttons, SWT.PUSH);
1019946 fImportButton.setText(TemplatesMessages.TemplatePreferencePage_import);
1020947 fImportButton.setLayoutData(getButtonGridData(fImportButton));
1021 fImportButton.addListener(SWT.Selection, new Listener() {
1022 @Override
1023 public void handleEvent(Event e) {
1024 import_();
1025 }
1026 });
948 fImportButton.addListener(SWT.Selection, e -> import_());
1027949
1028950 fExportButton= new Button(buttons, SWT.PUSH);
1029951 fExportButton.setText(TemplatesMessages.TemplatePreferencePage_export);
1030952 fExportButton.setLayoutData(getButtonGridData(fExportButton));
1031 fExportButton.addListener(SWT.Selection, new Listener() {
1032 @Override
1033 public void handleEvent(Event e) {
1034 export();
1035 }
1036 });
953 fExportButton.addListener(SWT.Selection, e -> export());
1037954
1038955 fPatternViewer= doCreateViewer(parent);
1039956
00 /*******************************************************************************
1 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
1 * Copyright (c) 2000, 2018 IBM Corporation and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
3639 */
3740 final class TemplateVariableProcessor implements IContentAssistProcessor {
3841
39 private static Comparator<TemplateVariableProposal> fgTemplateVariableProposalComparator= new Comparator<TemplateVariableProposal>() {
40 @Override
41 public int compare(TemplateVariableProposal proposal0, TemplateVariableProposal proposal1) {
42 return proposal0.getDisplayString().compareTo(proposal1.getDisplayString());
43 }
44 };
42 private static Comparator<TemplateVariableProposal> fgTemplateVariableProposalComparator = (proposal0,
43 proposal1) -> proposal0.getDisplayString().compareTo(proposal1.getDisplayString());
4544
4645
4746 /** the context type */
00 /*******************************************************************************
11 * Copyright (c) 2000, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2010 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2010 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 Dakshinamurthy Karra, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Dakshinamurthy Karra (Jalian Systems) - Templates View - https://bugs.eclipse.org/bugs/show_bug.cgi?id=69581
00 /*******************************************************************************
11 * Copyright (c) 2007, 2008 Dakshinamurthy Karra, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Dakshinamurthy Karra (Jalian Systems) - Templates View - https://bugs.eclipse.org/bugs/show_bug.cgi?id=69581
00 /*******************************************************************************
11 * Copyright (c) 2007, 2011 Dakshinamurthy Karra, IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Dakshinamurthy Karra (Jalian Systems) - Templates View - https://bugs.eclipse.org/bugs/show_bug.cgi?id=69581
11 Bundle-ManifestVersion: 2
22 Bundle-Name: %Plugin.name
33 Bundle-SymbolicName: org.eclipse.ui.workbench.texteditor.tests
4 Bundle-Version: 3.12.0.qualifier
4 Bundle-Version: 3.12.100.qualifier
55 Bundle-Vendor: %Plugin.providerName
66 Bundle-Localization: plugin
77 Export-Package:
88 org.eclipse.ui.workbench.texteditor.tests,
9 org.eclipse.ui.workbench.texteditor.tests.minimap,
910 org.eclipse.ui.workbench.texteditor.tests.revisions,
1011 org.eclipse.ui.workbench.texteditor.tests.rulers
1112 Require-Bundle:
11 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
55 <title>About</title>
66 </head>
77 <body lang="EN-US">
8 <h2>About This Content</h2>
9
10 <p>June 2, 2006</p>
11 <h3>License</h3>
8 <h2>About This Content</h2>
129
13 <p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
14 indicated below, the Content is provided to you under the terms and conditions of the
15 Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
16 at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
17 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
10 <p>November 30, 2017</p>
11 <h3>License</h3>
1812
19 <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
20 being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
21 apply to your use of any object code in the Content. Check the Redistributor's license that was
22 provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
23 indicated below, the terms and conditions of the EPL still apply to any source code in the Content
24 and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
13 <p>
14 The Eclipse Foundation makes available all content in this plug-in
15 (&quot;Content&quot;). Unless otherwise indicated below, the Content
16 is provided to you under the terms and conditions of the Eclipse
17 Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
18 available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
19 For purposes of the EPL, &quot;Program&quot; will mean the Content.
20 </p>
21
22 <p>
23 If you did not receive this Content directly from the Eclipse
24 Foundation, the Content is being redistributed by another party
25 (&quot;Redistributor&quot;) and different terms and conditions may
26 apply to your use of any object code in the Content. Check the
27 Redistributor's license that was provided with the Content. If no such
28 license exists, contact the Redistributor. Unless otherwise indicated
29 below, the terms and conditions of the EPL still apply to any source
30 code in the Content and such source code may be obtained at <a
31 href="http://www.eclipse.org/">http://www.eclipse.org</a>.
32 </p>
2533
2634 </body>
2735 </html>
00 ###############################################################################
11 # Copyright (c) 2000, 2014 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
00 ###############################################################################
11 # Copyright (c) 2000, 2005 IBM Corporation and others.
2 # All rights reserved. This program and the accompanying materials
3 # are made available under the terms of the Eclipse Public License v1.0
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License 2.0
45 # which accompanies this distribution, and is available at
5 # http://www.eclipse.org/legal/epl-v10.html
6 # https://www.eclipse.org/legal/epl-2.0/
7 #
8 # SPDX-License-Identifier: EPL-2.0
69 #
710 # Contributors:
811 # IBM Corporation - initial API and implementation
1313 <parent>
1414 <artifactId>tests-pom</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 <relativePath>../tests-pom/</relativePath>
1818 </parent>
1919 <groupId>org.eclipse.ui</groupId>
2020 <artifactId>org.eclipse.ui.workbench.texteditor.tests</artifactId>
21 <version>3.12.0-SNAPSHOT</version>
21 <version>3.12.100-SNAPSHOT</version>
2222 <packaging>eclipse-test-plugin</packaging>
2323 <properties>
2424 <testSuite>${project.artifactId}</testSuite>
00 /*******************************************************************************
11 * Copyright (c) 2017 SAP SE and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * SAP SE - initial API and implementation
0 /*******************************************************************************
1 * Copyright (c) 2018 Etienne Reichenbach and others.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Etienne Reichenbach - initial implementation
12 *******************************************************************************/
13 package org.eclipse.ui.workbench.texteditor.tests;
14
15 import static org.eclipse.jface.text.DocumentRewriteSessionType.SEQUENTIAL;
16 import static org.junit.Assert.assertFalse;
17 import static org.junit.Assert.assertTrue;
18
19 import org.junit.Test;
20
21 import org.eclipse.jface.text.Document;
22 import org.eclipse.jface.text.IDocument;
23
24 import org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer;
25
26 /**
27 * Tests for the {@link DocumentLineDiffer}.
28 */
29 public class DocumentLineDifferTest {
30
31 /** The document to connect to the {@link #fLineDiffer}. */
32 private Document fDocument= new Document();
33
34
35 /** The {@link DocumentLineDiffer line differ} under test. */
36 private DocumentLineDiffer fLineDiffer= new DocumentLineDiffer();
37
38
39 /**
40 * Test that when a document is {@link DocumentLineDiffer#connect(IDocument) connected} the
41 * differ is neither {@link DocumentLineDiffer#isSuspended() suspended} nor
42 * {@link DocumentLineDiffer#isSynchronized() synchronized} (i.e. it is initializing).
43 *
44 * @throws Exception unexpected exception
45 */
46 @Test
47 public void testLineDifferStateAfterConnectingDocument() throws Exception {
48 // when
49 fLineDiffer.connect(fDocument);
50
51 // then
52 assertFalse(fLineDiffer.isSuspended());
53 assertFalse(fLineDiffer.isSynchronized());
54 }
55
56 /**
57 * Test that when {@link DocumentLineDiffer#suspend()} is called the differ is
58 * {@link DocumentLineDiffer#isSuspended() suspended}.
59 *
60 * @throws Exception unexpected exception
61 */
62 @Test
63 public void suspendSuspendsLineDiffer() throws Exception {
64 // given
65 fLineDiffer.connect(fDocument);
66
67 // when
68 fLineDiffer.suspend();
69
70 // then
71 assertTrue(fLineDiffer.isSuspended());
72 }
73
74 /**
75 * Test that after a suspended {@link DocumentLineDiffer line differ} is
76 * {@link DocumentLineDiffer#resume() resumed} is not {@link DocumentLineDiffer#isSuspended()
77 * suspended} anymore.
78 *
79 * @throws Exception unexpected exception
80 */
81 @Test
82 public void lineDifferNotSuspendedAfterResumeIsCalled() throws Exception {
83 // given
84 fLineDiffer.connect(fDocument);
85 fLineDiffer.suspend();
86
87 // when
88 fLineDiffer.resume();
89
90 // then
91 assertFalse(fLineDiffer.isSuspended());
92 assertFalse(fLineDiffer.isSynchronized());
93 }
94
95 /**
96 * Test that when the document connected to a non suspended {@link DocumentLineDiffer line
97 * differ} starts a rewrite session the differ gets suspended.
98 *
99 * @throws Exception unexpected exception
100 */
101 @Test
102 public void nonSuspendedLineDifferNotSuspendedAfterStartRewriteSession() throws Exception {
103 // given
104 fLineDiffer.connect(fDocument);
105
106 // when
107 fDocument.startRewriteSession(SEQUENTIAL);
108
109 // then
110 assertTrue(fLineDiffer.isSuspended());
111 }
112
113 /**
114 * Test that when a document connected to a suspended {@link DocumentLineDiffer line differ}
115 * stops the rewrite session, the differ gets suspended.
116 *
117 * @throws Exception unexpected exception
118 */
119 @Test
120 public void suspendedLineDifferStillSuspendedAfterStopRewriteSession() throws Exception {
121 // given
122 fLineDiffer.connect(fDocument);
123 fLineDiffer.suspend();
124
125 // when
126 fDocument.stopRewriteSession(fDocument.getActiveRewriteSession());
127
128 // then
129 assertTrue(fLineDiffer.isSuspended());
130 }
131
132 /**
133 * Test that when the document connected to a suspended {@link DocumentLineDiffer line differ}
134 * goes through a rewrite session, the differ stays suspended.
135 *
136 * @throws Exception unexpected exception
137 */
138 @Test
139 public void suspendedLineDifferStaysSuspendedAfterDocumentRewriteSession() throws Exception {
140 // given
141 fLineDiffer.connect(fDocument);
142 fLineDiffer.suspend();
143
144 // when
145 fDocument.startRewriteSession(SEQUENTIAL);
146 fDocument.stopRewriteSession(fDocument.getActiveRewriteSession());
147
148 // then
149 assertTrue(fLineDiffer.isSuspended());
150 }
151
152 /**
153 * Test that when a document connected to a non suspended {@link DocumentLineDiffer line differ}
154 * goes through a rewrite session, the differ stays in the non suspended state.
155 *
156 * @throws Exception unexpected exception
157 */
158 @Test
159 public void nonSuspendedLineDifferStaysNonSuspendedAfterDocumentRewriteSession() throws Exception {
160 // given
161 fLineDiffer.connect(fDocument);
162
163 // when
164 fDocument.startRewriteSession(SEQUENTIAL);
165 fDocument.stopRewriteSession(fDocument.getActiveRewriteSession());
166
167 // then
168 assertFalse(fLineDiffer.isSuspended());
169 }
170
171 }
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * Genady Beryozkin, me@genady.org - initial API and implementation
1013 *******************************************************************************/
1114 package org.eclipse.ui.workbench.texteditor.tests;
1215
13 import static org.junit.Assert.*;
16 import static org.junit.Assert.assertEquals;
17 import static org.junit.Assert.assertFalse;
18 import static org.junit.Assert.assertTrue;
19 import static org.junit.Assert.fail;
1420
1521 import java.util.ArrayList;
1622 import java.util.Arrays;
8591
8692 documents[3]= new Document("###############################################################################\n" +
8793 "# Copyright (c) 2000, 2004 IBM Corporation and others.\n" +
88 "# All rights reserved. This program and the accompanying materials \n" +
89 "# are made available under the terms of the Eclipse Public License v1.0\n" +
94 "\\n"+
95 "# This program and the accompanying materials \n" +
96 "# are made available under the terms of the Eclipse Public License 2.0\n" +
9097 "# which accompanies this distribution, and is available at\n" +
91 "# http://www.eclipse.org/legal/epl-v10.html\n" +
98 "# https://www.eclipse.org/legal/epl-2.0/"+
99 "# \n"+
100 "# SPDX-License-Identifier: EPL-2.0\n" +
92101 "# \n" +
93102 "# Contributors:\n" +
94103 "# IBM Corporation - initial API and implementation\n" +
589598
590599 private List<String> createSuggestions(String prefix, List<IDocument> docsList) {
591600 ArrayList<String> results= new ArrayList<>();
592 for (Iterator<IDocument> i= docsList.iterator(); i.hasNext();) {
593 IDocument doc= i.next();
601 for (IDocument doc : docsList) {
594602 try {
595603 results.addAll(fEngine.getCompletionsForward(doc, prefix, 0, false));
596604 } catch (BadLocationException e) {
00 /*******************************************************************************
11 * Copyright (c) 2012, 2017 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1316 import org.junit.runners.Suite;
1417 import org.junit.runners.Suite.SuiteClasses;
1518
19 import org.eclipse.ui.workbench.texteditor.tests.minimap.MinimapPageTest;
20 import org.eclipse.ui.workbench.texteditor.tests.minimap.MinimapWidgetTest;
1621 import org.eclipse.ui.workbench.texteditor.tests.revisions.ChangeRegionTest;
1722 import org.eclipse.ui.workbench.texteditor.tests.revisions.HunkComputerTest;
1823 import org.eclipse.ui.workbench.texteditor.tests.revisions.RangeTest;
3338 RulerTestSuite.class,
3439 HunkComputerTest.class,
3540 ScreenshotTest.class,
36 AbstractTextZoomHandlerTest.class
41 AbstractTextZoomHandlerTest.class,
42 DocumentLineDifferTest.class,
43 MinimapPageTest.class,
44 MinimapWidgetTest.class
3745 })
3846 public class WorkbenchTextEditorTestSuite {
3947 // see @SuiteClasses
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 *******************************************************************************/
13 package org.eclipse.ui.workbench.texteditor.tests.minimap;
14
15 import org.junit.Assert;
16 import org.junit.Test;
17
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Shell;
21
22 import org.eclipse.jface.text.ITextOperationTarget;
23 import org.eclipse.jface.text.ITextViewer;
24 import org.eclipse.jface.text.TextViewer;
25
26 import org.eclipse.ui.internal.views.minimap.MinimapPage;
27
28 import org.eclipse.ui.texteditor.ITextEditor;
29 import org.eclipse.ui.texteditor.StatusTextEditor;
30
31 /**
32 * Test create of Minimap page which is possible only if {@link ITextViewer} can be get from the
33 * {@link ITextEditor}.
34 *
35 * @since 3.11
36 */
37 public class MinimapPageTest {
38
39 enum TextVieverAdapterKind {
40 None, ITextViewer, ITextOperationTarget
41 }
42
43 class MyTextEditor extends StatusTextEditor {
44
45 private final TextVieverAdapterKind kind;
46
47 public MyTextEditor(TextVieverAdapterKind kind) {
48 this.kind= kind;
49 }
50
51 @Override
52 public <T> T getAdapter(Class<T> required) {
53 switch (kind) {
54 case ITextViewer:
55 if (ITextViewer.class.equals(required)) {
56 Composite parent= new Shell();
57 return required.cast(new TextViewer(parent, SWT.NONE));
58 }
59 case ITextOperationTarget:
60 if (ITextOperationTarget.class.equals(required)) {
61 Composite parent= new Shell();
62 return required.cast(new TextViewer(parent, SWT.NONE));
63 }
64 case None:
65 default:
66 return null;
67 }
68 }
69 }
70
71 @Test
72 public void createNoneMinimapPage() {
73 ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.None);
74 MinimapPage page= MinimapPage.createMinimapPage(textEditor);
75 Assert.assertNull(page);
76 }
77
78 @Test
79 public void createMinimapPageWithITextViewerAdapter() {
80 ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.ITextViewer);
81 MinimapPage page= MinimapPage.createMinimapPage(textEditor);
82 Assert.assertNotNull(page);
83 }
84
85 @Test
86 public void createMinimapPageWithITextOperationTargetAdapter() {
87 ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.ITextOperationTarget);
88 MinimapPage page= MinimapPage.createMinimapPage(textEditor);
89 Assert.assertNotNull(page);
90 }
91 }
0 /*******************************************************************************
1 * Copyright (c) 2018 Angelo ZERR.
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * Contributors:
11 * Angelo Zerr <angelo.zerr@gmail.com> - [minimap] Initialize minimap view - Bug 535450
12 *******************************************************************************/
13 package org.eclipse.ui.workbench.texteditor.tests.minimap;
14
15 import org.junit.Assert;
16 import org.junit.Before;
17 import org.junit.Test;
18
19 import org.eclipse.swt.SWT;
20 import org.eclipse.swt.custom.StyleRange;
21 import org.eclipse.swt.custom.StyledText;
22 import org.eclipse.swt.widgets.Composite;
23 import org.eclipse.swt.widgets.Shell;
24
25 import org.eclipse.jface.text.ITextViewer;
26 import org.eclipse.jface.text.TextPresentation;
27 import org.eclipse.jface.text.TextViewer;
28
29 import org.eclipse.ui.internal.views.minimap.MinimapWidget;
30
31 /**
32 * Minimap widget tests to check that changed of {@link ITextViewer} of the editor update the
33 * {@link StyledText} of the Minimap:
34 *
35 * <ul>
36 * <li>check that {@link StyledText} content of minimap is synchronized with the text of the
37 * {@link ITextViewer} of the editor.</li>
38 * <li>check that {@link StyledText} styles of minimap is synchronized with the styles of the
39 * {@link ITextViewer} of the editor.</li>
40 * </ul>
41 *
42 * @since 3.11
43 */
44 public class MinimapWidgetTest {
45
46 private ITextViewer editorViewer;
47
48 private StyledText editorStyledText;
49
50 private StyledText minimapStyledText;
51
52 @Before
53 public void createMinimap() {
54 Composite parent= new Shell();
55 editorViewer= new TextViewer(parent, SWT.NONE);
56 MinimapWidget minimapWidget= new MinimapWidget(parent, editorViewer);
57 minimapWidget.install();
58
59 editorStyledText= editorViewer.getTextWidget();
60 minimapStyledText= (StyledText) minimapWidget.getControl();
61
62 }
63
64 @Test
65 public void testMinimapContent() {
66 editorStyledText.setText("abcd");
67 Assert.assertEquals("abcd", minimapStyledText.getText());
68
69 editorStyledText.replaceTextRange(1, 0, "ABCD");
70 Assert.assertEquals("aABCDbcd", minimapStyledText.getText());
71 }
72
73 @Test
74 public void testMinimapSetStyles() {
75 // As it doesn't exists listener to track styles changed of StyledText, update styles directly in StyledText of the editor doesn't update the styles of StyledText of the minimap.
76 StyleRange[] orginalMinimapStyles = minimapStyledText.getStyleRanges();
77 editorStyledText.setText("abcd");
78 StyleRange[] ranges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) };
79 editorStyledText.setStyleRanges(ranges);
80 // Styles of minimap doesn't changed
81 Assert.assertArrayEquals(orginalMinimapStyles, minimapStyledText.getStyleRanges());
82 }
83
84 @Test
85 public void testMinimapSetStylesWithTextPresentation() {
86 // Track styles changed of TextPresentation, update the styles of StyledText of the minimap.
87 editorStyledText.setText("abcd");
88
89 StyleRange[] ranges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) };
90 TextPresentation presentation= new TextPresentation();
91 presentation.mergeStyleRanges(ranges);
92 editorViewer.changeTextPresentation(presentation, false);
93 StyleRange[] expectedRanges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) };
94 Assert.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges());
95
96 ranges= new StyleRange[] { new StyleRange(1, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_RED), null) };
97 presentation= new TextPresentation();
98 presentation.mergeStyleRanges(ranges);
99 editorViewer.changeTextPresentation(presentation, false);
100 expectedRanges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null),
101 new StyleRange(1, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_RED), null) };
102 Assert.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges());
103 }
104 }
00 /*******************************************************************************
11 * Copyright (c) 2005, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2005, 2015 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2006, 2008 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
00 /*******************************************************************************
11 * Copyright (c) 2000, 2016 IBM Corporation and others.
2 * All rights reserved. This program and the accompanying materials
3 * are made available under the terms of the Eclipse Public License v1.0
2 *
3 * This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License 2.0
45 * which accompanies this distribution, and is available at
5 * http://www.eclipse.org/legal/epl-v10.html
6 * https://www.eclipse.org/legal/epl-2.0/
7 *
8 * SPDX-License-Identifier: EPL-2.0
69 *
710 * Contributors:
811 * IBM Corporation - initial API and implementation
1414 <parent>
1515 <groupId>org.eclipse</groupId>
1616 <artifactId>eclipse-platform-parent</artifactId>
17 <version>4.8.0-SNAPSHOT</version>
17 <version>4.9.0-SNAPSHOT</version>
1818 <relativePath>../eclipse-platform-parent</relativePath>
1919 </parent>
2020
2121 <groupId>eclipse.platform.text</groupId>
2222 <artifactId>eclipse.platform.text</artifactId>
23 <version>4.8.0-SNAPSHOT</version>
23 <version>4.9.0-SNAPSHOT</version>
2424 <packaging>pom</packaging>
2525
2626 <properties>
1313 <parent>
1414 <artifactId>eclipse.platform.text</artifactId>
1515 <groupId>eclipse.platform.text</groupId>
16 <version>4.8.0-SNAPSHOT</version>
16 <version>4.9.0-SNAPSHOT</version>
1717 </parent>
1818 <artifactId>tests-pom</artifactId>
19 <version>4.8.0-SNAPSHOT</version>
19 <version>4.9.0-SNAPSHOT</version>
2020 <packaging>pom</packaging>
2121 <properties>
2222 <code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>