Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-11-02 18:30:45 +0000
committeratikhomirov2006-11-02 18:30:45 +0000
commitabbc70232d4322ac7ef98cdb38ac508b7668bc48 (patch)
tree59c2a36b946d9281f5e4b46b4a448333a87da76c
parenta2b68d799202219e6f19d437e4b0cecde63943da (diff)
downloadorg.eclipse.gmf-tooling-abbc70232d4322ac7ef98cdb38ac508b7668bc48.tar.gz
org.eclipse.gmf-tooling-abbc70232d4322ac7ef98cdb38ac508b7668bc48.tar.xz
org.eclipse.gmf-tooling-abbc70232d4322ac7ef98cdb38ac508b7668bc48.zip
changed ids not to clash with oaw plugins (just in case), get rid of nature nobody seemed to be really using
-rw-r--r--plugins/org.eclipse.gmf.xpand.editor/plugin.xml18
-rw-r--r--plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/editor/ui/NewTemplateFileWizard.java73
-rw-r--r--plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/expression/codeassist/ExpressionProposalComputer.java1
-rw-r--r--plugins/org.eclipse.gmf.xpand/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.gmf.xpand/plugin.xml17
-rw-r--r--plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawBuilder.java2
-rw-r--r--plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawNature.java88
7 files changed, 64 insertions, 136 deletions
diff --git a/plugins/org.eclipse.gmf.xpand.editor/plugin.xml b/plugins/org.eclipse.gmf.xpand.editor/plugin.xml
index 91e13d35c..ff73d6c23 100644
--- a/plugins/org.eclipse.gmf.xpand.editor/plugin.xml
+++ b/plugins/org.eclipse.gmf.xpand.editor/plugin.xml
@@ -8,7 +8,7 @@
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
extensions="xpt"
icon="icons/templatefile.gif"
- id="org.eclipse.xpand.editor.XpandEditor"
+ id="org.eclipse.gmf.xpand.XpandEditor"
name="Xpand Editor">
</editor>
</extension>
@@ -18,18 +18,18 @@
<category
name="Xpand Editor"
description="Xpand Editor Commands"
- id="org.openarchitectureware.xpand2.editor">
+ id="org.eclipse.gmf.xpand.editor">
</category>
<command
name="Insert LT"
- categoryId="org.openarchitectureware.xpand2.editor"
+ categoryId="org.eclipse.gmf.xpand.editor"
description="Insert Xpand start terminal"
id="org.eclipse.gmf.xpand.editor.insertLT"
>
</command>
<command
name="Insert RT"
- categoryId="org.openarchitectureware.xpand2.editor"
+ categoryId="org.eclipse.gmf.xpand.editor"
description="Insert Xpand end terminal"
id="org.eclipse.gmf.xpand.editor.insertRT"
>
@@ -54,16 +54,16 @@
<extension
point = "org.eclipse.ui.newWizards">
<category
- id = "org.openarchitectureware.newWizards"
- name="openArchitectureWare">
+ id = "org.eclipse.gmf.xpand.newWizards"
+ name="GMF-Xpand">
</category>
<wizard
- id = "org.openarchitectureware.xpand2.wizard.NewTemplateFileWizard"
+ id = "org.eclipse.gmf.xpand.wizard.NewTemplateFileWizard"
name = "xPand Template"
class="org.eclipse.gmf.internal.xpand.editor.ui.NewTemplateFileWizard"
- category="org.openarchitectureware.newWizards"
+ category="org.eclipse.gmf.xpand.newWizards"
icon="icons/templatefile.gif">
- <description>Create a new oAW Template File</description>
+ <description>Create a new Xpand Template File</description>
<selection class="org.eclipse.core.resources.IResource"/>
</wizard>
</extension>
diff --git a/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/editor/ui/NewTemplateFileWizard.java b/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/editor/ui/NewTemplateFileWizard.java
index 3ea364050..8d42273f9 100644
--- a/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/editor/ui/NewTemplateFileWizard.java
+++ b/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/editor/ui/NewTemplateFileWizard.java
@@ -7,13 +7,22 @@
*
* Contributors:
* committers of openArchitectureWare - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactored. Add builder on project with new templates.
*******************************************************************************/
package org.eclipse.gmf.internal.xpand.editor.ui;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.internal.xpand.build.OawBuilder;
+import org.eclipse.gmf.internal.xpand.editor.Activator;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;
-
public class NewTemplateFileWizard extends BasicNewFileResourceWizard {
public NewTemplateFileWizard() {
@@ -21,32 +30,50 @@ public class NewTemplateFileWizard extends BasicNewFileResourceWizard {
@Override
public void addPages() {
-/*
- final String extension = "xpt";
- WizardNewFileCreationPage page = new WizardNewFileCreationPage("newFilePage1", getSelection()) { //$NON-NLS-1$
-
- @Override
- public String getErrorMessage() {
- if ( !getFileName().endsWith("."+extension) ) {
- return "extension must be ."+extension;
- }
- return null;
- }
- @Override
- protected InputStream getInitialContents() {
- if (super.getInitialContents() == null) {
- return new ByteArrayInputStream("\u00ab\u00bb".getBytes());
- }
- return super.getInitialContents();
- }
-
- };
- addPage(page);
-*/
super.addPages();
WizardNewFileCreationPage page = (WizardNewFileCreationPage) getPage("newFilePage1");
page.setTitle("New Template File");
page.setDescription("Creates a new xPand Template File");
page.setFileName("NewTemplateFile.xpt");
}
+
+ @Override
+ public boolean performFinish() {
+ if (super.performFinish()) {
+ IFile f = ((WizardNewFileCreationPage) getPage("newFilePage1")).createNewFile();
+ configureBuilder(f.getProject());
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private void configureBuilder(final IProject project) {
+ try {
+ final IProjectDescription desc = project.getDescription();
+ final ICommand[] commands = desc.getBuildSpec();
+
+ for (ICommand element : commands) {
+ if (element.getBuilderName().equals(OawBuilder.getBUILDER_ID())) {
+ return;
+ }
+ }
+
+ project.getWorkspace().run(new IWorkspaceRunnable() {
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+ final ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+ final ICommand command = desc.newCommand();
+ command.setBuilderName(OawBuilder.getBUILDER_ID());
+ newCommands[commands.length] = command;
+ desc.setBuildSpec(newCommands);
+ project.setDescription(desc, monitor);
+ }
+
+ }, project.getWorkspace().getRoot(), 0, null);
+ } catch (CoreException ex) {
+ Activator.log(ex.getStatus());
+ }
+ }
}
diff --git a/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/expression/codeassist/ExpressionProposalComputer.java b/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/expression/codeassist/ExpressionProposalComputer.java
index 9e996d66b..632a1c11b 100644
--- a/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/expression/codeassist/ExpressionProposalComputer.java
+++ b/plugins/org.eclipse.gmf.xpand.editor/src/org/eclipse/gmf/internal/xpand/expression/codeassist/ExpressionProposalComputer.java
@@ -15,7 +15,6 @@
package org.eclipse.gmf.internal.xpand.expression.codeassist;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
diff --git a/plugins/org.eclipse.gmf.xpand/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.xpand/META-INF/MANIFEST.MF
index 7e13c331a..d5bfe3e32 100644
--- a/plugins/org.eclipse.gmf.xpand/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.xpand/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport,
Export-Package: lpg.lpgjavaruntime;x-friends:="org.eclipse.gmf.xpand.editor,org.eclipse.gmf.tests.xpand",
org.eclipse.gmf.internal.xpand;x-friends:="org.eclipse.gmf.xpand.editor,org.eclipse.gmf.tests.xpand",
org.eclipse.gmf.internal.xpand.ast;x-friends:="org.eclipse.gmf.xpand.editor,org.eclipse.gmf.tests.xpand",
+ org.eclipse.gmf.internal.xpand.build;x-friends:="org.eclipse.gmf.xpand.editor",
org.eclipse.gmf.internal.xpand.expression;x-friends:="org.eclipse.gmf.xpand.editor,org.eclipse.gmf.tests.xpand",
org.eclipse.gmf.internal.xpand.expression.ast;x-friends:="org.eclipse.gmf.xpand.editor,org.eclipse.gmf.tests.xpand",
org.eclipse.gmf.internal.xpand.expression.parser;x-friends:="org.eclipse.gmf.tests.xpand,org.eclipse.gmf.xpand.editor",
diff --git a/plugins/org.eclipse.gmf.xpand/plugin.xml b/plugins/org.eclipse.gmf.xpand/plugin.xml
index 181a62241..d796b1b06 100644
--- a/plugins/org.eclipse.gmf.xpand/plugin.xml
+++ b/plugins/org.eclipse.gmf.xpand/plugin.xml
@@ -3,19 +3,8 @@
<plugin>
<extension
- id="org.openarchitectureware.base.oawNature"
- name="oAW Project Nature"
- point="org.eclipse.core.resources.natures">
- <runtime>
- <run
- class="org.eclipse.gmf.internal.xpand.build.OawNature">
- </run>
- </runtime>
- </extension>
-
- <extension
- id="org.openarchitectureware.base.oawBuilder"
- name="Oaw Builder"
+ id="oawBuilder"
+ name="Xpand Template Builder"
point="org.eclipse.core.resources.builders">
<builder
hasNature="false">
@@ -25,7 +14,7 @@
<extension
id="problem"
- name="oAW Problem"
+ name="Xpand Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.core.resources.problemmarker"/>
<super type="org.eclipse.core.resources.textmarker"/>
diff --git a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawBuilder.java b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawBuilder.java
index 52bb271ff..eb0e96137 100644
--- a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawBuilder.java
+++ b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawBuilder.java
@@ -49,7 +49,7 @@ public class OawBuilder extends IncrementalProjectBuilder {
private final Map<XpandResource, IFile> xpandResourcesToAnalyze = new HashMap<XpandResource, IFile>();
public static final String getBUILDER_ID() {
- return "org.openarchitectureware.base.oawBuilder";
+ return Activator.getId() + ".oawBuilder";
}
private static boolean isFileOfInterest(IFile file) {
diff --git a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawNature.java b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawNature.java
deleted file mode 100644
index 5231917ee..000000000
--- a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/OawNature.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * <copyright>
- *
- * Copyright (c) 2005-2006 Sven Efftinge and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sven Efftinge - Initial API and implementation
- *
- * </copyright>
- */
-package org.eclipse.gmf.internal.xpand.build;
-
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.runtime.CoreException;
-
-public class OawNature implements IProjectNature {
-
- private IProject project;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.resources.IProjectNature#configure()
- */
- public void configure() throws CoreException {
- final IProjectDescription desc = project.getDescription();
- final ICommand[] commands = desc.getBuildSpec();
-
- for (ICommand element : commands) {
- if (element.getBuilderName().equals(OawBuilder.getBUILDER_ID())) {
- return;
- }
- }
-
- final ICommand[] newCommands = new ICommand[commands.length + 1];
- System.arraycopy(commands, 0, newCommands, 0, commands.length);
- final ICommand command = desc.newCommand();
- command.setBuilderName(OawBuilder.getBUILDER_ID());
- newCommands[newCommands.length - 1] = command;
- desc.setBuildSpec(newCommands);
- project.setDescription(desc, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.resources.IProjectNature#deconfigure()
- */
- public void deconfigure() throws CoreException {
- final IProjectDescription description = getProject().getDescription();
- final ICommand[] commands = description.getBuildSpec();
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(OawBuilder.getBUILDER_ID())) {
- final ICommand[] newCommands = new ICommand[commands.length - 1];
- System.arraycopy(commands, 0, newCommands, 0, i);
- System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
- description.setBuildSpec(newCommands);
- return;
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.resources.IProjectNature#getProject()
- */
- public IProject getProject() {
- return project;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
- */
- public void setProject(final IProject project) {
- this.project = project;
- }
-
-}

Back to the top