Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JBIDE-23353 Deploy Docker Wizard: Enable checking "Used by route" (#1357
- Loading branch information
Showing
2 changed files
with
134 additions
and
40 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
...ift.common.ui/src/org/jboss/tools/openshift/internal/common/ui/TableCellMouseAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is 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: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package org.jboss.tools.openshift.internal.common.ui; | ||
|
||
import org.eclipse.swt.events.MouseEvent; | ||
import org.eclipse.swt.events.MouseListener; | ||
import org.eclipse.swt.graphics.Point; | ||
import org.eclipse.swt.widgets.Table; | ||
import org.eclipse.swt.widgets.TableItem; | ||
|
||
/** | ||
* @author Kabanovich | ||
* @author Andre Dietisheim | ||
* | ||
*/ | ||
public class TableCellMouseAdapter implements MouseListener { | ||
|
||
private int column; | ||
|
||
public TableCellMouseAdapter(int column) { | ||
this.column = column; | ||
} | ||
|
||
@Override | ||
public void mouseUp(MouseEvent event) { | ||
if (isWithinCell(column, event)) { | ||
mouseUpCell(event); | ||
} | ||
} | ||
|
||
@Override | ||
public void mouseDown(MouseEvent event) { | ||
if (isWithinCell(column, event)) { | ||
mouseDownCell(event); | ||
} | ||
} | ||
|
||
@Override | ||
public void mouseDoubleClick(MouseEvent event) { | ||
if (isWithinCell(column, event)) { | ||
mouseDoubleClickCell(event); | ||
} | ||
} | ||
|
||
private boolean isWithinCell(int column, MouseEvent event) { | ||
Point pt = new Point(event.x, event.y); | ||
if (!(event.widget instanceof Table)) { | ||
return false; | ||
} | ||
TableItem item = ((Table) event.widget).getItem(pt); | ||
return item != null | ||
&& item.getBounds(column) != null | ||
&& item.getBounds(column).contains(pt); | ||
} | ||
|
||
public void mouseUpCell(MouseEvent event) { | ||
}; | ||
|
||
public void mouseDownCell(MouseEvent event) { | ||
}; | ||
|
||
public void mouseDoubleClickCell(MouseEvent event) { | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters