@@ -1,31 +1,51 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.gmf.figures;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Shape;
import org.eclipse.swt.graphics.Color;

/**
* @author Miles Parker
*/
class FigureChild {
IFigure figure;

Color color;

Color hideColor;

public FigureChild(IFigure figure, Color color, Color hideColor) {
super();
this.figure = figure;
this.color = color;
this.hideColor = hideColor;
}

void restore() {
figure.setForegroundColor(color);
if (figure instanceof Shape) {
((Shape) figure).setAlpha(255);
}
}

void reveal() {
figure.setForegroundColor(color);
if (figure instanceof Shape) {
((Shape) figure).setAlpha(150);
}
}

void hide() {
figure.setForegroundColor(hideColor);
if (figure instanceof Shape) {
Expand Down
@@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.gmf.figures;

import java.util.HashMap;
Expand All @@ -12,8 +23,7 @@
/**
* Allows us to handle all of the various combinations of figures in a consistent way.
*
* @author milesparker
*
* @author Miles Parker
*/
public class FigureManagerHelper {

Expand Down Expand Up @@ -79,7 +89,6 @@ public void unreveal(IFigure figure, Color maskingColor) {
}
}


public final Color create(RGB rgb) {
Color color = colorCache.get(rgb);
if (color == null) {
Expand Down
@@ -1,11 +1,20 @@
package org.eclipse.mylyn.modeling.gmf.figures;
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.gmf.figures;

/**
* We have to mirror edit part functionality for Figure because we don't have access to the edit parts. Sigh.
*
* @author milesparker
*
* @author Miles Parker
*/
public interface IRevealable {

Expand All @@ -19,8 +28,8 @@ public interface IRevealable {
/**
* Restores any elements -- such as connectors and text -- that could not be made alpha to their prior state before
* we started managing them. Note that this is different from unrevealing them. In this case, we want to reveal them
* completely as the result of their parent figures being restored. This is awkward but seems necessary
* because of decoration design.
* completely as the result of their parent figures being restored. This is awkward but seems necessary because of
* decoration design.
*/
void restore();
}
@@ -1,11 +1,21 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.gmf.figures;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Locator;

/**
* @author milesparker
*
* @author Miles Parker
*/
public interface IRevealableFigure extends IRevealable, IFigure, Locator {
}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies and others.
w * Copyright (c) 2011 Tasktop Technologies 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
Expand All @@ -20,6 +20,9 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.services.decorator.Decoration;

/**
* @author Miles Parker
*/
public class NodeLandmarkFigure extends RectangleFigure implements IRevealableFigure, Locator {

private static final int BORDER_SIZE = 2;
Expand Down
@@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.gmf.figures;

import org.eclipse.draw2d.IFigure;
Expand All @@ -6,6 +17,9 @@
import org.eclipse.gmf.runtime.diagram.ui.services.decorator.Decoration;
import org.eclipse.swt.graphics.Color;

/**
* @author Miles Parker
*/
public class NodeMaskingFigure extends RectangleFigure implements IRevealableFigure {

private final IFigure decorated;
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.mylyn.modeling.papyrus-feature/feature.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009 Tasktop Technologies and others.
Copyright (c) 2011 Tasktop Technologies 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
Expand Down
11 changes: 10 additions & 1 deletion org.eclipse.mylyn.modeling.papyrus/plugin.xml
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<?eclipse version="3.4"?><!--
Copyright (c) 2011 Tasktop Technologies 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:
Tasktop Technologies - initial API and implementation
-->
<plugin>
<extension point="org.eclipse.mylyn.context.ui.bridges">
<uiBridge
Expand Down
@@ -1,9 +1,22 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.papyrus;

import org.eclipse.mylyn.modeling.gmf.MylynDecoratorProvider;
import org.eclipse.mylyn.modeling.ui.IModelUIProvider;


/**
* @author Miles Parker
*/
public class UML2DiagramDecoratorProvider extends MylynDecoratorProvider {

@Override
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2009 Tasktop Technologies and others.
* Copyright (c) 2011 Tasktop Technologies 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
Expand All @@ -22,7 +22,7 @@
import org.osgi.framework.BundleContext;

/**
* @author mparker
* @author Miles Parker
*/
public class UML2DiagramUIBridgePlugin extends AbstractUIPlugin {

Expand Down
@@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.papyrus;

import javax.management.relation.Relation;
Expand All @@ -13,6 +24,9 @@
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;

/**
* @author Miles Parker
*/
public class UML2DomainBridge implements IModelStructureProvider, IModelUIProvider {

private static UML2DomainBridge INSTANCE = new UML2DomainBridge();
Expand Down
@@ -1,9 +1,24 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.papyrus;

import org.eclipse.mylyn.modeling.context.IModelStructureProvider;
import org.eclipse.mylyn.modeling.gmf.GMFStructureBridge;

/**
* @author Miles Parker
*/
public class UML2StructureBridge extends GMFStructureBridge {
@Override
public IModelStructureProvider getDomainContextBridge() {
return UML2DomainBridge.getInstance();
};
Expand Down
Expand Up @@ -15,7 +15,7 @@
import org.eclipse.mylyn.modeling.ui.IModelUIProvider;

/**
* @author milesparker
* @author Miles Parker
*/
public class UML2UIBridge extends DiagramUIBridge {

Expand Down
Expand Up @@ -20,6 +20,9 @@
import org.eclipse.mylyn.internal.ide.ui.IdeUiBridgePlugin;
import org.eclipse.mylyn.modeling.tests.WorkspaceSetupHelper;

/**
* @author Miles Parker
*/
public class AbstractDiagramContextTest extends AbstractContextTest {

protected InteractionContextManager manager = ContextCorePlugin.getContextManager();
Expand Down
Expand Up @@ -17,6 +17,9 @@
import org.eclipse.mylyn.modeling.ecoretools.EcoreDiagramStructureBridge;
import org.eclipse.mylyn.modeling.tests.WorkspaceSetupHelper;

/**
* @author Miles Parker
*/
public class AbstractEMFContextTest extends AbstractDiagramContextTest {

protected DomainDelegatedStructureBridge structureBridge;
Expand Down
Expand Up @@ -23,6 +23,9 @@
import org.eclipse.mylyn.internal.resources.ui.ResourcesUiBridgePlugin;
import org.eclipse.mylyn.internal.resources.ui.ResourcesUiPreferenceInitializer;

/**
* @author Miles Parker
*/
public class BasicEMFResourceTest extends AbstractEMFContextTest {

protected ResourceInteractionMonitor resmonitor = new ResourceInteractionMonitor();
Expand Down
Expand Up @@ -20,6 +20,9 @@
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;

/**
* @author Miles Parker
*/
public class EMFStructureBridgeTest extends AbstractEMFContextTest {

public void testSimpleHandle() {
Expand Down
Expand Up @@ -22,6 +22,7 @@

/**
* @author Benjamin Muskalla
* @author Miles Parker
*/
public class AllEMFTests {

Expand Down
Expand Up @@ -36,6 +36,9 @@
import org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader;
import org.eclipse.osgi.util.NLS;

/**
* @author Miles Parker
*/
@SuppressWarnings("restriction")
public class CommonTestUtil {

Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2009 Tasktop Technologies and others.
* Copyright (c) 2011 Tasktop Technologies 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
Expand Down Expand Up @@ -37,6 +37,9 @@
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.pde.internal.core.natures.PluginProject;

/**
* @author Miles Parker
*/
public class WorkspaceSetupHelper {

private static final String HELPER_CONTEXT_ID = "helper-context";
Expand Down
Expand Up @@ -27,6 +27,9 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;

/**
* @author Miles Parker
*/
public class EMFUIBridgeTest extends AbstractEMFContextTest {

private DiagramUIEditingMonitor monitor;
Expand Down Expand Up @@ -72,6 +75,6 @@ public void testModification() throws Exception {
"platform:/resource/org.eclipse.mylyn.emf.tests.library/model/library.ecore#//Book");
assertTrue(element2.getInterest().isInteresting());

assertEquals(element2.getContentType(), EcoreDiagramDomainBridge.ECORE_CONTENT_TYPE);
assertEquals(element2.getContentType(), EcoreDomainBridge.ECORE_CONTENT_TYPE);
}
}
Expand Up @@ -31,6 +31,9 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;

/**
* @author Miles Parker
*/
public class EcoreDiagramEditorUIBridgeTest extends AbstractEMFContextTest {

protected DiagramUIEditingMonitor monitor;
Expand Down
Expand Up @@ -33,6 +33,9 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.uml2.uml.internal.impl.ClassImpl;

/**
* @author Miles Parker
*/
public class PapyrusDiagramEditorUIBridgeTest extends AbstractDiagramContextTest {

private static final String RESOURCE_URI = "platform:/resource/org.eclipse.mylyn.emf.tests.papyrus/model/model.uml#_xkh2ALJFEeCYupgj-BJj-Q";
Expand Down
Expand Up @@ -25,6 +25,9 @@
import org.eclipse.ui.part.Page;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;

/**
* @author Miles Parker
*/
public abstract class DiagramUIBridge extends AbstractContextUiBridge {

boolean initialized;
Expand Down
Expand Up @@ -20,7 +20,7 @@
import org.eclipse.ui.IWorkbenchPart;

/**
* @author milesparker
* @author Miles Parker
*/
public class DiagramUIEditingMonitor extends AbstractUserInteractionMonitor {

Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2009 Tasktop Technologies and others.
* Copyright (c) 2011 Tasktop Technologies 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
Expand All @@ -21,7 +21,7 @@
import org.eclipse.mylyn.modeling.context.IModelStructureProvider;

/**
* @author milesparker
* @author Miles Parker
*/
public abstract class EcoreDomainBridge implements IModelStructureProvider, IModelUIProvider {

Expand Down
@@ -1,10 +1,24 @@
/*******************************************************************************
* Copyright (c) 2011 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/

package org.eclipse.mylyn.modeling.ui;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPart;
import org.eclipse.mylyn.modeling.context.IModelStructureProvider;
import org.eclipse.ui.IWorkbenchPart;

/**
* @author Miles Parker
*/
public interface IModelUIProvider extends IModelStructureProvider {

boolean acceptsPart(IWorkbenchPart part);
Expand Down